Sunday 13 December 2009

Motoring on with the A3977

Previously I have blogged about how to set up the Allegro A3977 driver chip to suit a particular motor: -

hydraraptor.blogspot.com/2009/07/lessons-from-a3977
hydraraptor.blogspot.com/2009/08/motor-math
hydraraptor.blogspot.com/2009/08/mixed-decay-mixed-blessing

Most boards I have seen using the A3977 and similar chips just have a current adjustment, with all the other values fixed. Unless you strike lucky this is not going to allow accurate microstepping because the off time and PFD need to be adjusted to suit the motor and supply voltage.

A while ago Zach sent me samples of the prototype V3 stepper controller kits and the NEMA17 motors used on the MakerBot. I made up the board using my SMT oven (pizza oven controlled by HydraRaptor, more on that later).



It works well, but the initial component values are not optimum for the motor, so I decided to make a test bench from the older prototype board that I have been experimenting with. I RepRapped a chassis for it with a panel to mount some switches to vary the timing components.



The chassis is one of the biggest parts I have made, not in volume, but in overall expanse. It warped a little, despite being PLA, heated bed coming soon!



The switch on the left must be at least 20 years old and the one on the right more than 40 but they both still work fine. I save all this junk and eventually it comes in handy.

I also have potentiometers on V
ref and PFD, so together with a bench PSU and a signal generator I can vary every parameter.

I knocked up a label on a 2D printer, it's so much easier to make this sort of thing than it was when the switches were born!



Zach has updated the board to have four preset potentiometers to make it fully adjustable. There are test points to allow the pots to be set to prescribed values with a multi-meter.

Vref and PFD can be measured as a voltage, but the two RT values have to be set by measuring resistance with the power off. My multimeter seems to give accurate readings of these despite them being in circuit. A good tip is to measure the resistance with both polarities and if it reads the same either way round then it is most likely the chip is not affecting the reading.


So here is a list of motors and optimised settings: -

MakerBot Kysan SKU1123029 NEMA17





This is the motor that MakerBot use for the axis drive on the Cupcake, details here. It is actually a 14V motor, so is not ideally suited to being driven from a 12V chopper drive. You normally want the motor voltage to be substantially lower than the supply.

You can't run it at its full current because the duty cycle would tend to 100%. With a fixed off-time, the on-time tends towards infinity and the frequency drops into the audio range.
In practice I found the maximum current at 12V was 0.3A, any higher and the microstepping waveform was distorted on the leading edge due to the current not being able to rise fast enough.



To maintain the sinusoidal waveform at faster step rates requires the current to be lowered further, 0.25A gives a good compromise. It is not a bad idea to under run steppers anyway, otherwise they can get too hot for contact with plastic.

I used the minimum values for CT and RT, i.e. 470pF and 12K to keep the chopping frequency as high as possible, so that it is outside of the audio range. Not only is this a good idea to keep it quiet when idling, but also you want it much higher than your stepping frequency, otherwise they beat with each other.

The values give a minimum frequency of ~17kHz @ 0.3A and a maximum of ~150kHz on the lowest microstep value.
17kHz is not audible to me, but younger people might be able to hear it. There is still some audible noise at the point in the cycle when both coils have similar currents and so similar high frequencies. The beat frequency, which is the difference of the two, is then in the audio range. It isn't anywhere near as loud as when the chopping is in the audio range though.

I can't see any spec for the maximum switching frequency although a couple of parameters are given at less than 50kHz. I suspect 150kHz is a bit on the high side, which would increase switching losses, but with such a low current compared to the rating of the chip I don't think it is a problem.

One problem I had initially was that the switching waveform was unstable. It had cycles with a shorter on-time than required, which let the current fall until it then did a long cycle to catch up. The long cycle gave a low frequency that was back in the audio range.



I think it was a consequence of the motor needing a very short off-time in order to be able to have the duty cycle nearly 100%. The current hardly falls during the off period, so a little noise due to ringing can trigger it to turn off too early. It is not helped by using the minimum blank time. I fixed it by putting 1uF capacitors across the sense resistors.

The PFD value is best set to 100% fast decay with this motor.

It works better with a 24V supply. The full 0.4A current can be achieved (but it gets much hotter of course) and it maintains microstepping accuracy at higher step rates than it does on 12V.

MakerBot Lin SKU4118S-62-07 NEMA17





This is the NEMA17 that MakerBot used to supply. It is at the opposite extreme compared to the one above, i.e. it is a very low voltage motor, only 2V @ 2.5A. As mentioned before, this causes a couple of issues: -
  1. The inductance is so low that the ripple current is significant compared to the lowest current microstep, causing positional errors. OK at 2A, but gets worse with lower currents.
  2. It is difficult to get 2.5A from the A3977 without it overheating. The PCB layout has to be very good. The datasheet recommends 2oz copper and four layers. 2A is no problem and that is the maximum with the 0.25Ω sense resistors fitted to the board.
At 2A the motor runs at about 40°C, so just about OK for use with PLA. The chip gets a lot hotter, about 77°C measured on the ground pins.

I used a value of 56K for RT and 2.1V on PFD. To some extent the optimum PFD value depends on how fast you want it to go.

Motion Control FL42STH47-1684A-01 NEMA17





This is the recommended motor for the Mendel extruder, details here. After buying a couple of these a friend pointed out that Zapp Automation do the same motor with dual shafts for about half the price!

This is a high torque motor so it is longer and heavier than the previous two NEMA17s. Electrically it is in the sweet spot for the A3977 with a 12V supply. The A3977 can easily provide the full current and the switching frequency doesn't have wild fluctuations or drop into the audio range.

When microstepped at 1.7A it gets to about 43°C but the chip only gets to 56°C.

I used 39K for RT and 0V on PFD, i.e. 100% fast decay.

I have high hopes for this motor as a replacement for the one above that is in my extruder currently. It should give me almost twice the torque and has the correct sized shaft, i.e. 5mm. The Lin and Kysan motors both have imperial shaft sizes which caught me out as I drilled the worm gear for 5mm thinking NEMA17 specified that, but it must just be the frame dimensions.

MakerBot Keling KL23H251-24-8B NEMA23





This is the motor I used on my Darwin. It has 8 wires so it can be connected in bipolar serial or parallel. Series has the advantage that the full torque can be achieved with 1.7A which is easily within the range of the A3977. Parallel has one quarter of the inductance so torque will fall off with speed four times slower. To get full torque 3.4A is needed but I found 1A was enough for the X and Y axes. I think Z needs more torque but my z-axis uses different motors so I don't know how much.

An RT value of 56K is fine for currents in the range 1-2A. PFD is best at 0v, i.e. 100% fast decay.

Summary

Here is a summary of the motor specifications :-

Motor Resistance Max Current Voltage Max Power Holding Torque Inductance
LIN 4118S-62-07 0.8 Ohm 2.5 A 2.0 V 10.0 W 0.30 Nm
Kysan SKU 1123029 35.0 Ohm 0.4 A 14.0 V 11.2 W 0.26 Nm 44.0 mH
Motion Control FL42STH47-1684A-01 1.7 Ohm 1.7 A 2.8 V 9.5 W 0.43 Nm 2.8 mH
Keling KL23H251-24-8B Series 3.6 Ohm 1.7 A 6.1 V 20.8 W 1.10 Nm 13.2 mH
MakerBot Keling KL23H251-24-8B Parallel 0.9 Ohm 3.4 A 3.1 V 20.8 W 1.10 Nm 3.3 mH

Here are my suggested settings :-

Motor Current Vref CT RT PFD
Kysan SKU 1123029 0.25 – 0.3A 0.5 – 0.6V 470pF 12K 0
LIN 4118S-62-07 1 – 2A 2 – 4V 470pF 56K 2.1V
Motion Control FL42STH47-1684A-01 1 – 1.7A 2 – 3.4V 470pF 39K 0
Keling KL23H251-24-8B Parallel 1 – 2A 2 – 4V 470pF 56K 0

Friday 4 December 2009

Quality control

I RepRapped a doorstop for our new bathroom shower: -



It has a 10mm hole most of the way down and a countersink to take a ~5mm wood screw.



A 2mm self adhesive felt pad covers the screw hole and acts as a shock absorber.

It has a rim around the bottom to prevent it rocking if the base warps or the wall is not flat. To support the bottom of the hole there is a one layer membrane: -



I removed it with a 5mm drill: -



I was quite proud of it but my wife had something more like this in mind: -

I can't print chrome yet, so I will have to go out and buy one, and it has three screws which have to be drilled through the tiles into the wall.

The files are on Thingiverse if you prefer function over form.

Monday 30 November 2009

Pinchless Extruder

While dismantling my extruder for a small mod I accidentally discovered that the worm pulley has so much grip that it will still extrude PLA with the pressure roller removed. It is hard to see on this low quality video but it was extruding 0.4mm filament at 32mm/s.



I will still run it with a roller because it helps to guide it into the tube when self feeding to start a new filament. I also expect softer plastics would need it.

BTW, I have stopped using Vimeo and gone back to YouTube because they added an artificial processing delay unless you pay.