Thursday, October 13, 2011

Electronics lessons: Pulse width modulation

Right now, this lesson is going to be useless.
Because in this lesson there is no application.
What this means is that this is another lesson of reasonably boring theory,
All I can say is hang in there, there are plenty of applications for pulse width modulation, so this is an important thing to get your head around.


Pulses
Often times in anything modern, we take existing words and try to shoe-horn new meanings into them, like how we describe an integrated circuit as a chip. it's not a chip really, it's definitly not a potato product, and it's not a small piece of anything really, (yes it is a small piece of a silicon wafer that was removed during production) but the name is poor.

The word pulse in pulse width modulation however is perfectly used.
imagine pulse in your wrist, goes on, goes off, goes on, goes off.
the pulse button on a blender, (used for turning on and off).
something that is pulsating.

An electronic signal that rises and falls between logic levels is perfectly described as a pulse.




Firstly:
All pulses have a rising edge, (where the voltage rises).
All pulses have a duration, (marked as t on the above diagram).
All pulses have a falling edge, (where the voltage falls).

There is also a period of time when the voltage is low.

A series of pulses is a pulse train.
pulse trains may have a defined repeating interval, -but this may also not happen.

pulses may not appear regular as above, the off time may be longer or shorter, and the pulse duration may vary. pulse trains do not have to appear as signals with regularity, indeed in pulse width modulation, the width of pulses changes specifically as a way to convey information.




One of the more popular uses of pulse width modulation is servo control.

Servos (as in the little hobby RC servos) are controlled by Pulse width modulation.
basically, a short pulse tells the motor to move all the way to the left of the travel, whilst a long pulse means move all the way to the right.



In servo control, pulses may be between 800 microseconds, and 2200 microsecond, with a pulse interval of 20 milliseconds.

To make a servo move all the way to the left extreme of travel, you need to:

Turn on the pulse, (rising edge)
Wait for 800us (pulse width)
Turn off the pulse, (falling edge)
wait for 19,200us (off time) - to make up the 2milisecond pulse interval expected.
repeat

To make a servo move all the way to the right extreme of travel, you need to:

Turn on the pulse, (rising edge)
Wait for 2200us (pulse width)
Turn off the pulse, (falling edge)
wait for 17,800us (off time) - to make up the 2milisecond pulse interval expected.
repeat

Varying the duration that the pulse stays on for, (between 800us and 2200us) causes the arm on the servo to go to any position to control.

for example, to centre the arm, you need to send pulses with a duration on 1.5miliseconds, 1500us

No comments: