Showing posts with label A3983. Show all posts
Showing posts with label A3983. Show all posts

Sunday 9 August 2009

Mixed decay, mixed blessing

Having set the correct off time to suit my motor I can now micro step it with equal spaced steps, but only if I disable the mixed decay mode.


When the chopper switches off it can do it two ways. It can turn on both low side transistors. That short circuits the motor and lets the current recirculate. If the coil was a perfect inductor and the transistors perfect switches, the current would circulate forever and you would have a superconducting magnet. Real coils and transistors have some resistance, which causes the current to decay, but as these are relatively small the mode is called slow decay.

This is fine and efficient until you take the motor's back emf into account. During the rising part of the sine wave the magnet is moving towards the pole piece, so it generates a voltage that causes the current to fall faster. The on time gets longer to compensate and all is well.

On the trailing edge of the sine curve the magnet has gone past the pole piece and generates a voltage that increases the current in the coil. If it is going fast enough it can mean that the current doesn't fall at all during the slow decay period. As I showed previously that can cause a severely distorted waveform which makes the motor noisy.



The Allegro chips offer a mixed decay mode, where they switch to fast decay for part of the chopping cycle on the downward half of the sine curve. In fast decay mode one low side and one high side transistor turn on and reverse the voltage across the motor. That overcomes the BEMF and causes the current to fall much faster. It also returns current to the supply rail, which can upset some power supplies if there isn't some other load to absorb it.

Mixed decay gives a current waveform like this: -



The off time is fixed, so the current falls further making the ripple greater. If you set the percentage fast decay to give a clean waveform at your top speed, then the ripple increases at slower speeds. It is maximum when stationary, when there is no BEMF and fast decay is not required at all.

The problem is that the target current is the trip point of the comparator, so it is the peak of the chopping waveform. That means the average current is less by half the ripple current giving a positional error.

With the low inductance motor I am using, the ripple current has a large amplitude, so the error introduced when the motor is stationary is about the same as a micro step. That means the first step with fast decay is about twice as big as it should be and the last step is virtually zero.

With the A3977 I can disable fast decay and the steps are fairly even, but fast running is then distorted. The PFD setting needs to change with speed.

With the A3983 that I have used on my new extruder controller the PFD setting is fixed at 31.25%. That means I can't get evenly spaced microsteps with the NEMA17's that I have, when running slowly. Not a big problem with the extruder because I plan to gear it down 40:1, which means one micro step is only about 0.02mm. I am only using microstepping to give smooth motion rather than extra resolution.

The problem is exaggerated because not only am I using a low inductance motor, but I am also trying to run it at 1A, whereas it is rated for 2.5A. At 2.5A the off time would be about 2.5 times smaller, so the ripple would be 2.5 times less. The steps in the current waveform would be 2.5 times bigger, so the distortion would be reduced by 6.25 times. As it is about one microstep now, it would reduce to 1/6th of a microstep, so would be acceptable. The temperature rise would then be 6.25 times greater of course.

I was planning to use A3977s for my axis control though, where positional accuracy is important. I am beginning to think I will be better off just using dual H-bridges and doing the rest in software using a powerful micro with a fast ADC.

To be able to cope with a wide variety of motors you need to change the current, the off time setting and the percentage of fast decay. You also need to take the ripple current amplitude into account to control the average current, rather than the peak. All these things could be automated with a software solution.