DIY mechanics and electronics projects

DIY mechanics and electronics projects

Google Search

WebThis site

Buy me a Beer :)

This web page is run by me on my spare time. If you find any of the information useful and worth a couple of bucks, I will be very grateful if you buy me a beer by donating a small amount using the PayPal link below :)



DIY microstepping motor driver Print E-mail
User Rating: / 23
Article Index
DIY microstepping motor driver
Configuration and adjustment
All Pages

StepperMotorWith the introduction of the A3977, and now recently the upgraded version, A3979, Allegro microsystems have made stepper motor driver design a simple task.

The A3979 is a complete stepper motor driver, including high current output stage (up to 35 V and ±2.5 A) and micro stepping waveform generation. Together with a handful of components this device can be directly controlled by simple digital STEP and DIRECTION signals.

Determining the components and creating the schematics:

The datasheet of the A3977 can be found on the Allegro webpage. The datasheet contains an example shecmatic, and together with the FAQ section, provides information of how to best select the component values and make the PCB layout.

Rsense: This is the current sensing resistor, and should be of a non-inductive type. Adding inductance adds reactance (AC resistance) to switching signals, and this introduce a measurement error when measuring the pulse width modulated (switching) motor drive signal.

The value of Rsense should be: Rsense ‹ o,5/Itrip

With Itrip = 2,5A, this equals a resistor of 0,2Ω or less. There is also a restriction on Vref = 8*Itrip*Rsense ‹= 4V. With Itrip=2,5A and Rsense = 0,2Ω, Vref = 4V. therefore Rsense is set to 0,15Ω, giving Vref of 3V.

As the motor current flows trough this resistor the power dissipation is fairly high. The dissipated power can be calculated as P=U*I, where U=R*I (ohms law). This gives P=I2*Rsense = 2,5A2 * 0,15Ω = 0,94W. To add some headroom, a resistor with power rating of at least 2W should be selected.

RT and CT: These components sets the time constant for the blanking time and the switching time of the PWM circuit. The datasheet specifies values between 12KΩ to 100KΩ for RT and 470pF - 1500pF for CT. To reduce audible noice a relatively high switching frequency is desirable. Also if the inductances of the attached motor is low (E.g. due to bipolar parallell wiring scheme), the blanking time does not need to be very long. Therefore the lowest values suggested is selected, CT = 470pF and RT = 12KΩ.

PFD voltage divider: The voltage on the PFD pin determine the current decay mode. Optimum performance is achieved for most motors by selecting mixed decay mode. Mixed Decay Operation is selected if the PFD input is between 0.6 × VDD and 0.21 × VDD. To allow for highest possible noice marging, a level of 0.4 VDD is selected. This level is acieved by a voltage divider consisting of a 3,3KΩ resistor in series wih a 2,2KΩ rsistor between VDD and GND (Vdiv = (Rdiv->GND / Rtotal) * U = 2.2KΩ/5.5KΩ = 0,4 VDD

Here is the complete schematic (click the image to download in pdf version)



Bill of Materials

Qty Value Device Parts
1 PIN header 1X2. Not mounted
1 PIN header 2X5 2.54mm pitch
2 0R15 SMD resistor 2512 2W
R11, R12
1 2K2 SMD resistor 0805 R8
1 3K3 SMD resistor 0805 R4
1 10K SMD resistor 0805 R7
1 10K SMT trimpot, Bourns 3314J
6 12k SMD resistor 0805 R1, R2, R3, R5, R9, R10
4 100n SMD capacitor 0805 C5, C9, C10, C11
1 100u/50V Electrolythic cap SMD G case
4 220n SMD capacitor 0805 C1, C2, C3, C4
2 470p SMD capacitor 0805 C6, C7
1 A3979 Allegro A3979 IC1
1 3.5mm pitch, Stelvio MRT9 P3.5/6SQ

PCB layout:

There are two main issues to consider with laying out the PCB for the A3979 driver IC:

TSSOP 28 package with exposed thermal pad: The package for the A3979 driver IC is a very small package with high density pins. In addition it have a thermal pad on the underside which would need to be soldered to the PCB to ensure good heat transfer capabilities. In automatically assembled and reflow soldered industrial PCBs this package does not cause any problem. But on a DIY board, and without reflow soldering equipment the standard PCB layout for this type of package can no be used. Instead I made a new PCB symbol featuring a larg trough hole pad under the thermal pad. by using this layout you can easily access and solder the thermal pad trough the hole from the underside.


TSSOP28 footprint


Designing for maximum heat dissipation

The amount of copper area (and thereby PCB to air heat transmission) and the required motor current determines whether a heatsink is required or not. An approximation of the dissipated power can be found by PD = I2(2rdson). At 2 A motor current this gives 22*2*0.36 = 2,88W

This dissipated power can then be used to calculate the thermal resistance needed by the PCB.


If we are able to keep ambient temperature at 25°C, and allow the A3979 to reach its absolute maximum junction temperature of 150ºC we find the thermal resistance needed to be 125/2,88 = 43,4ºC/W

A more realistic case would be that we can keep ambient temperature below 50 degrees, and to avoid shutdown, keep the junction temperature of A3979 at 125ºC t max. This give us a thermal resistance of 75/2,88 = 26,1ºC/W. Therefore we must make the board to have a thermal resistance below 43,4ºC/W and preferrably as low as 26,1ºC/W.

If we look at the package thermal characteristics we see that with 1 in2 of dual side copper area we get a thermal resistance of 40ºC/W. Increasing to 3 in2 reduces thermal resistance to approximately 30ºC/W. As the size of my boards are limited by the modular casing I would like to use for the stepper drivers, I just had to make the copper area as large as possible, and then add a heat sink if not low enough.

The picture below shows the layout. Note the large uninterrupted PCB areas stretching from underneath the package and the thermal pad to get as low thermal resistance as possible.

PCB layout

The PCB artwork files can be downloaded here: NOTE: ONLY for private use. You might not under any circumstance use these for any commercial purpose. I am under no circumstance responsible for anything resulting from  usage of these boards (AKA the standard disclaimer stuff to ensure I am not liable if you hurt yourself, others or anything :)

Top Layer
Bottom Layer
Component Placement
Eagle design files
I have had a few requests from people wanting to buy PCBs for this build. When I ordered the boards, I ordered a few in spare, and have added a very simple shop function to allow people buying and paying trough PayPal. Update: Unfortunately all boards are now Sold Out

This layout provides approximately 2,7 in2 of copper area, giving a thermal resistance of appx. 35ºC/W. This means we should be fine without a heatsink if we keep the ambient temperature below 50ºC. The picture below shows my completed prototypes (made with another layout, with to high thermal resistance).

The picture below shows the prototype board for the stepper motor driver connected to a NEMA23 size 2A stepper. Step and dir pulses for test of the driver is generated by the USB interface described in my DIY Roomba USB interface cable article. The software used to toggle the pins is the accompanying software from Atmels AVR309 application note.


First prototype

The next two pictures show the final version of the stepper driver PCB, mounted in a DIN rail encapsulation. This PCB have better power dissipation significantly reducing temperature of the driver. If you reach temperatures of above 100ºC you should add a heatsink to the A3979 device.

finished board in encapsulation
with cables connected

On the next page I will show you how you set up and adjust the stepper motor driver.

Joomla 1.5 Templates by Joomlashack