A replacement stepper motor circuit

When I started to design a Stepper Motor Driver Module for the Electronics in Meccano Circuits Shop, I intended to use the circuit from issue 2 as a basis for my design. Then I discovered that the SAA1027 IC, which is a stepper motor driver, had been discontinued by major UK distributors such as Maplin, Rapid, RS and Farnell.

A replacement circuit for the SAA1027 IC is shown in figure 2.

Figure 1: Pinout of the 4029 counter ICIt requires the use of two other ICs - one 4070 XOR gate IC and one 4029 counter IC.  The pinout of the 4070 was given in figure 1d of issue 6 and the pinout of the 4029 is shown in figure 1, right.

A single 4070 actually contains four XOR gates, but this circuit needs only three of them, so one is left unused, with its inputs connected permanently to 0V so that they cannot cause interference.

How the circuit works

Of the four binary outputs available from the 4029 counter, only two, QA and QB, are required in this circuit. These outputs produce the binary sequence 00b, 01b, 10b, 11b, which is decoded by three XOR gates to produce four outputs to the stepper motor. These outputs change state in the sequence required to drive the stepper motor correctly – this sequence was given in the table on page 2 of issue 2.

Use four transistors as shown on page 3 of issue 3 to drive the stepper motor coils since the outputs of the XOR gates cannot drive the coils directly.

The Clock input of the SAA1027 is replaced in this circuit by the Clock input of the 4029. Likewise, the Mode input of the SAA1027, which determines the direction of motor rotation, is replaced by the Up/Down input of the 4029.

The power supply to the ICs in this circuit must be regulated, either 5V or 12V. The power supply to the stepper motor coils is determined by the requirements of the motor and the maximum voltage that the TIP31C transistors can withstand.

Figure 2: A replacement circuit for the SAA1027 stepper motor driver IC

See also: Stepping out:  Using stepper motors , Driving more powerful stepper motors

The Electronics in Meccano Circuits Shop Buy Stepper Motor Driver Modules from the Electronics in Meccano Circuits Shop

Click here for details

 

Goto top of page


The model crane. Click here to enlarge this photo...Model Study: A cliff lift
By Gilbert Ghyselbrecht

An overview of the model

To be quite honest, there is no model! To me, the electronics are more important than the building of a full scale model. The circuit described can be used in for instance a cliff lift, but for the gathering in Mechelen (Belgium) I made a very simple crane (shown right).

An elevator, shown here with three Lego figures, goes up 50 cm, comes back down again and stops 1mm above the table.  The design is my own.

The electronics are used here to compensate for the shortcomings of the mechanics. When the movement has to stop exactly, it is not sufficient to switch off the motor, because it continues to rotate for a while and the stop position depends on the mechanical resistance and inertia of the model. In my design the motor turns – at the end of the mechanism’s travel – at a very low speed so that the motor can be stopped immediately by short-circuiting the motor winding.

The speed and direction of the motor is controlled by a microcontroller which obtains positional information about the motor from four slotted opto switches fitted to the model. A block diagram of the system is shown in figure 4.

A close-up on the motor, gearing, and slotted opto switches. Click here to enlarge this photo...Mechanics

A gear wheel (no 27c) with 95 teeth is connected to the winding drum of the lift, via a set of gears, so that it makes half a turn every time the lift goes up or down. Four slotted opto switches are mounted with 1" angle brackets around the gear as shown in figure 3. A fishplate is mounted on the gear with a long bolt and washers such that it can pass through the centre of each slotted opto switch.

Figure 3: The slotted opto switches arranged around the gear

Slotted opto switches

The slotted opto switches I have used in the model consist of two separate sections as shown in figure 5.

The first section is an infrared light emitting diode (LED) acting as a transmitter. The receiver, in the second section, is a phototransistor. Between the two sections there is a small gap so that an object may cut the infrared beam of light that passes between the two sections.

The circuit that makes the switch useful is shown in figure 5. The phototransistor is wired as shown so that when an object cuts the infrared beam of light, the output of the switch becomes 5V instead of the usual 0V when there is no object obstructing the beam.

In order to mount the slotted opto switches in a Meccano model I have developed a printed circuit board (PCB) that is the same size as perforated strip part no 6a (1" x 1/2").  This PCB can be supplied ready-built via the Electronics in Meccano Circuits Shop.

Figure 5: A slotted opto switch and the circuit which makes it useful

A close-up on the printed circuit board. Note the 7-segment display on the top right. Click here to enlarge this photo...Using a microcontroller

I have used the PIC16C84 microcontroller from Microchip before and so have discovered the advantages of a software design:

The block diagram of the system in figure 4 shows the four inputs from the slotted opto switches connected to a port of the microcontroller and the two Speed and Direction outputs from another port which are fed into another IC, the L6219.

Figure 4: A block diagram of the system

The L6219 Motor Driver from SGS-Thomson

The L6219 is a bipolar monolithic integrated circuit intended either to control and drive the windings of a bipolar stepper motor, or to bi-directionally control up to two DC motors.

The power stage is a dual full bridge capable of sustaining 46V and including four diodes for current recirculation.

Internal pulse width modulation (PWM) can control an output current of up to 750mA with a maximum start-up current of 1A.

More information about this IC can be obtained from the SGS Thompson website at http://us.st.com/stonline/index.shtml 

In order to short-circuit the motor winding when the motor is required to stop dead as mentioned previously, it is connected to the L6219 driver via the Normally Open (N.O.) contacts of a relay. The PWM pulses produced by the L6219 continually trigger a 555 time delay (monostable) circuit, the output of which keeps the relay switched on. 40ms after the PWM pulses cease, the monostable time period ends and the relay is switched off, and the motor stops rotating immediately because its winding is short-circuited.

Programming

To write the PIC16C84 program I used the JAL (Just Another Language) compiler which was developed by Wouter van Ooijen (Holland). It is a combination of the C & BASIC languages, specially developed for the Microchip PIC16x84 microcontrollers. The compiler and libraries can be downloaded from his website, www.xs4all.nl/~wf/wouter/pic/jal/index.html 

For information about the PIC series of microcontrollers, visit the Microchip website at www.microchip.com 

The program model I used is a ‘finite state’ machine.  The program runs in a continuous loop and performs the actions described in each state. It is by means of an external event that the program moves on to the next state.  The state of the program can be followed on a 7-segment display mounted on the main PCB:

State No

State

Description

0

INIT

The motor turns slowly to the left and waits till the Left End Sensor is interrupted.  We now move to State 1.If the Right End Sensor gets interrupted there is a fault in the circuit; the motor turns the wrong way and there is an error.

1

HALT

We wait for the Start button to be pushed before moving to State 2.

2

START UP

The motor accelerates to maximum speed and we move to State 3.

3

RUN

The motor turns at full speed until the Right (or Left) Sensor opens, then we move to State 4.

4

SLOW DOWN

The motor slows down to minimum speed and we move to State 5.

5

RUN OUT

We wait until the opening of the Right (or Left) End Sensor, then we move to State 6.

6

STOP

When the Auto Run flag is set, we move to State 7, otherwise we move to State 1.

7

WAIT

We wait 15 seconds and then move to State 2.

The auto run mode

As a demonstration model, it can run fully automatically by pushing the Reset button while the Start button is already pushed in so the Auto Run mode starts. The lift then goes up and down automatically every 15 seconds.

The Electronics in Meccano Circuits Shop Buy Slotted Opto Switch Modules from the Electronics in Meccano Circuits Shop

Click here for details

 

Goto top of page


Title: Shopping ListThe following lists the electrical parts that are discussed in the articles. Prices and order codes given are taken from the current Maplin catalogue, which is the probably best source of electronic components for the hobbyist in the UK.

If you have access to a company account with Rapid Electronics or RS Electronics you may find these companies are cheaper.

A replacement stepper motor circuit
 
Parts required to build the circuit in Figure 2.  Four of the transistor circuits in issue 3 will also be needed to drive the stepper motor coils.
Maplin Order Code Price Page
1 x 4029 counter IC QW20W 99p 250
1 x 4070 4x XOR logic gate IC QX26D 49p 250

Maplin charge £2.50 for delivery on orders under £30.00 ex VAT.
Prices are taken from the September 2000 - August 2001 Maplin catalogue, and include VAT at 17.5%

Contact their order line on 0870 264 6000 or visit one of their shops.
Their customer service line is 0870 264 6002 and they have a website at www.maplin.co.uk where on-line ordering is available.

Goto top of page


EiM Logo

www.eleinmec.freeserve.co.uk

Electronics in Meccano January 2001 -- Issue 10

Edited by Tim Surtell
E-mail: timsurtell@eleinmec.freeserve.co.uk


| Home | Contents of Issues | Index | About | Letters | Printed Edition | Wizards | SELMEC | Links |