Electronics and Kinetics Technical Resource Display Case
                                Kinetic display object #
16
PWM Control of a Motor's Speed and Direction - H-bridge Method                        

Top of  Electronics Section
Top of Kinetics Section
 Display Case Home
Ed Bennett Home

<< Prev Next >>
 
K-16-1
 

video (0.5 megs)

Press the button once to start the display. The motor will do three cycles of ramping up from zero speed to full speed and then ramping back down to zero speed. The control knob controlls the rate of acceleration, not the speed per se. This demo actually consists of two PWM motor drivers - demo numer 15 and demo number 16. What is shown is two approaches to producing a nearly identical result. The relay method (demo 15) is cheap and fault-tolerant, and the H-bridge method (demo 16) is modern and compact.

This motor's speed is controlled through the technique of PWM. A PIC12F683 microcontroller uses the TIMER2 PWM generator in the PIC. The PIC chip is not connected directly to the motor. Between the PIC chip and the motor there must be some sort of interface device which converts the logic-level PIC output into the 24 volt power the motor requires. All PWM interfaces have two inputs: speed and direction. The speed line is the actual PWM signal. Instead of being called speed, which is wat it is, the line is often called PWM. It turns on an off very fast (fast enough to make a whisling sound in some cases), and the greater the percentage of time it is "on", the faster the motor goes. The direction line is either high or low and it causes the interface to flip the direction of the current in order to reverse the motor's direction of rotation. So if the PIC causes the direction line to be logic "high", then the motor runs forward, and if the direction line is "low" the motor runs in reverse.

H-bridge driver chip

This motor controller uses an interface constructed from an LM18200 H-bridge driver chip. The LM18200 is a very commom motor driver chip for controlling the speed and direction of small and medium DC motors. When building a very accurate servo motor controller, for instance, H-bridge chips are a necessity. The are, however, rather expensive and very easy to fry. Jerking around a motor on the high end of the H-bridge's rated capacity can cause the chip to partially fail. There are around four or five popular H-bridge driver chips from different manufactuers. They all do pretty much the same thing but the wiring and software to support different models csn be slightly different. The source code link on this page has a wiring chart detailing all the connections between the LM18200 and the other parts on the board.

The code which runs in the PIC chip is exactly the same in the relay based pwm controller and the H-bridge controller. The wiring from the PIC to the interface and the interface to the motor is also the same.

More discussion on PWM with the PIC, with wiring digrams, etc are in the PDF. The source code is HBridge1.c
 
<< Prev Next >>