fast direction changes instead of PWM


I have heard that if you change motor direction very fast, and leave it running in one direction longer than the other, it will spin at controlled speed in the desired direction. But the thing that supposedly makes it better than ordinary PWM is that the motor is always under precise control, it never spins uncontrollably. I don't know how this way of control is called so I cannot Google it :\

I am interested to know if there is any existing project / library for Arduino that utilises this way of control? I could easily program it myself, yes, but problem arises when I try to take the frequency up to 21 kHz (beyond the hearing range). This makes the timing very problematic, as I have only 47 microseconds to let it spin in one, then the other direction. Specifically, the problem is the Arduino's timer, which increments every 4 microseconds. This doesn't allow me fine control of the motor as there are only about 12 steps for motor speed in such small time frame.

I would appreciate any help/advice on this matter!

Thank you.

I have heard that

Where did you hear it?


I have heard that

Where did you hear it?


I have heard this from my friend who works at computer aided automation company. They use 3-phase frequency changers to fine-control strong 3-phase AC motors, but he said that a "DC frequency changer" would work as I described in the first post.

Yes, that's just antiphase drive, it is PWM, just a slightly different form.

It has the great advantage of having completely smooth transistion between forward
and backward, very useful for high-performance servos which are under load as they

Disadvantages are higher iron losses at low speeds due to the larger amplitude of
the waveform then.

Its also related to class-D amplifiers (a speaker is just a specialised DC motor) - antiphase
drive minimised cross-over distortion for the same reason antiphase is smooth across
direction changes for servos. The voice-coil motor that drives hard-disk drive head-assemblies is an example of a high-performance motor where cross-over distortion
is unacceptable (the drive would mis-track horribly).

Thank you for this explanation! Now I was able to Google around a bit and found a few things on this topic. You can inverse the signal either with a negator or with messing around the timer registers. Would a negator introduce a problem by making a slight delay on one signal? Do I have to introduce a delay on the other signal too, so that they will have roughly the same delay?

If you are driving a bridge that already generates dead-time (shoot-through prevention),
then you don't have to do anything special, just drive it in anti phase using inverter(s).

If not then you must switch off both high and low driver before switching to the other
set, leaving enough deadtime for the switches to switch (for MOSFETs this is usually a
few 100 ns.

Some bridges are wired diagonally so that you can only drive in antiphase, in other
words inverters are built in to the bridge.

For 3-phase motors you have 6 inputs to the bridge and inverters cannot be used, you
have to sequence those 6 signals correctly. The antiphase scheme in superimposed on
the commutation pattern. I know this because I've done it using a whacky scheme
where one timer is setup to produce PWM on an unconnected pin, and a pin-change
interrupt registered on that pin so an ISR does the actual bridge sequencing! I should
document it sometime in a separate thread I think as its quite a handy way to get multiple
PWM pins from one timer.