Electronics and Kinetics Technical Resource Display Case
                                Kinetic display object #
15
PWM Control of a Motor's Speed and Direction - Relay and Transistor Method                        

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

<< Prev Next >>
 
K-15-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.

Relay-based driver circuit

This motor controller uses an interface constructed of two transistors and a relay to control the motors speed and direction. The type of relay is a DPDT, Double Pole Double Throw. The relay is comprised of a coil and a switch. The switch is mechanical and is moved by the relay's electromagnet coil (you can hear a click when it goes). The switch is what reverses the motor. It is the direction part of the interface. The coil of the relay is switched by a transistor connected to the PIC. When this transistor is on, the motor runs forward. When it is off, the motor runs in reverse. The second transistor switches the current through the relay switch which then feeds the motor - this is the actual PWM. In the display the transistor connected to the relay by the red wire controls the speed and the transistor connected to the relay with the green wire controls the direction.

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 >>