Stepper driver and GoTo control

Overview

- See below

Experiments

- Single processor design
- Proto board
- Vixen Polaris - polar drive

Final design

- Bluetooth controlled driver
- Prototype
- Controller description in PDF
- Juggler realtime kernel in PDF


System

This page discusses driving a telescope using stepper motors from 5.25" floppy drives ( if can you still find these...).


The intention is to have a system that can interface with a PC application, but also be controlled with a hand pad controller. This implies that the whole software stack from the coordinate transformation to the stepper control is contained in the driver system. A hand controller or PC merely provides the RA/Dec coordinates to point at, and will be mor data-base or planetarium oriented.
Since the transformation is quite CPU intensive, a processor should be selected preferably with multiply and floating point support.

Mechanics

Unipolar stepper motors can easily be retrieved from old 5.25" floppy drives (together with a lot of other useful components: see the "Floppy Tester" page). Because the speed has to be slowed down to siderial or even lower, the effective torque will increase proportionally. Therefore it is perfectly possible to drive relatively large scopes with such small motors.



When properly driven, stepping rates of a few steps per second are possible, although these rates are in the danger zone with respect to resonance effects. The floppy motors do 200 full steps per second, and the revolution rate can then be as low as 10 rpm. For tracking in an equatorial mount this has to be converted to 1 revolution per siderial day (approximately 23h 56m), which is a ratio in the order of 14360:1. This ratio has to be realized mechanically, for exmple with a gear train.
When the steppers are driven binary, i.e. with square waves, the best you can do is half steps, or 400 per revolution. The resolution of a half step must be lower than de resolving power of the scope, say 0.25 arcsecond. This means that resolutionwise, each half step (0.9°) must be reduced to 0.25". This would require a reduction ratio of 12960:1, again to be realized mechanically.
As an example, my RFT scope has an equatorial fork mount riding on a polar disk of 230mm diameter, which is driven by an axle of 5mm diameter. This axle is the output of a geartrain of 12:20 and a 1:40 worm. In total the reduction is just over 3000, requiring a stepper revolution rate of approximately 2rpm.


Driving the stepper motor

In general a stepper drive citcuit splits up in two parts: the control logic and the current driver. The drive logic generates the signal patterns that will activate the windings of the stepper motor, and hence control the stepping rate and direction. The current driver converts these signals into a current through the motor windings, where the torque is proportional to the current.
See "Jones on Stepping motors" for an extensive treaty on controlling steppers.



Below three modes are described: discrete steps (half or full), analog control, microstepping.

Full or half stepping

The nice thing about the unipolar stepper is that the drive circuit can be relatively simple. Given a stepping rate well away from the resonance frequency, some discrete logic combined with a 2803 octal darlington driving chip will do. Disadvantages are a jerky step behaviour, resulting in all kinds of vibrations, and relatively high minimum stepping rate (50 halfsteps per sec or so). Many examples of such simple driver circuits can be found on the web.

Sine/cosine drive

A better approach, allowing much lower stepping rates, is to use sine/cosine waves (or at least an approximation) to drive the motor windings. The signal is similar to the halfstep driver, but instead of blocks the positive halves of the sine wave are used to control the current in each winding. This could in principle be realized with an analogue quadrature oscillator, which delivers a sine and a cosine signal of the same frequency. The downside of this method is that a quadrature oscillator is almost impossible to make, without the phase difference, amplitude and shape of the signal to be frequency dependent. This means that a certain design can only be used in a very limited range of stepping rates.

Microstepping

The usual way to overcome this problem is to use Pulse Width Modulation (PWM) or an A/D converter to determine the current value. Such circuits are usually microprocessor controlled and can have a wide bandwidth of stepping rates. The microcontroller divides a full step into a number of microsteps, and outputs the corresponding sine values ether by changing the PWM dutycycle, or as a binary input for an ADC.


Practical examples

PIC 16F628 and ULN2803



Note that this circuit has not been built or tested

The circuit consists of only three ICs, a ULN2803 that drives the steppers, a MAX232 for interfacing to the PC, and a PIC 16F628 microcontroller. This PIC type has built in USART circuits, that make implementation of an RS232 interface a breeze. All that is needed is to connect a RS232 line driver to the USART I/O pins of the PIC, being port B bits 1 and 2. For driving the darlington array both I/O ports are used: port A(0..3) and port B(4..7). Vdd (12V) leads directly to the stepper driver, the stepper itself and also to an LM78L05 voltage regulator, which makes the Vcc. Last two items are the crystal oscillator, and the reset circuit R1/C7.

The PC interface is intended to work on 9600 baud, which should be plenty fast for the few controls that pass through it. These controls should facilitate setting the current coordinates and time, retrieving the current coordinates (and time?), slewing and possibly also some calibration of the tracking speed.
Part of the intelligence, such as conversions of coordinates to steps and v.v., taking acceleration into account when moving between coordinates and such, is contained in the PIC firmware itself. Calculation of the angles and user interface is contained by a PC program, or possibly a program in a PDA.


An analog sin-cos driver

The circuit to the left consists of a low frequency triangle wave generator and two integrators. The first integration of a triangle wave yields a sinewave, and integration of a sine yields a cosine. The generator is quite hard to tune, and probably not too stable.

The integrators have a resistor in their feedback loop, to suppress DC offsets. Also for that reason the generator and integrators are coupled with C10.

It must be noted that the phasedifference is slightly more than 90°, but this probably doesn't harm too much. Amplitude difference can be tuned by selecting a different value for R17.

This circuit has been built an tested, but in general it sucks. This is due to its frequency dependency and inherent instability.

This is the circuit that converts the signal into the current through the motorwindings. The OpAmps will regulate the voltage over the 1Ω emitter resistors, according to the input signal. Per motor half the signal is inverted for one of the windings, which together with diodes and transistors implicitly functions as a rectifier. The non-inverting branch produces the current for the positive half period, and the inverting branch for the negative half.

The input signals for the winding couples are quadrature signals, i.e. the sine and cosine from the generator circuit. This driver stage can be used with other quadrature generators too, for example based on a controller and a couple of DACs. In this case the current drivers can be simpler, since any signal can be generated by the controller.

The peak current for the floppy stepper is approximately 150mA, so the signal at the input of the OpAmp should be comparable. This is achieved with a 1/10 resistor divider for the non-inverting and a 0.1 amplification factor for the inverting branches.


A digital sin-cos driver

The analog quadrature oscillator appers to be extremely hard to get stable, variable in frequency and amplitude, and to produce sine waves at the same time. Therefore the next plan is to make a digital oscillator with a PIC 18F452 and a pair of MAX534 DACs. Since the motor only consumes 150mA, and the driving voltage is fairly smooth, the need for real power transistors is relaxed. A set of darlingtons (bc517) are used instead.



This design is currently being built and tested, results can be found here. The schematics and PCB layout can be downloaded from the Resources page.