The best way to control the speed of a DC motor is by means of pulse width modulation (PWM) which is lossless. Uninvited heat is avoided and you can employ a simple potentiometer. Implementing such a scheme in PIC Micro Pascal is a snap, since there are library units for reading the pot (ADC.pas) and manipulating the pulse width (PWM_CPP_alt.pas). You'll note the "alt" in the latter. That's because I added a few things to the stock unit provided with PMP to make it easier to use.
Let's see the circuit:
There are three options. The first two (above) are virtually identical to what we saw in the preceding exercise with the incandescent lamp. There are two additions, however. First of all, a capacitor (C2) is placed across the terminals of the motor to help dump some of the inductive noise occurring when the motor spins.
And then, a back-biased rectifier (D1) keeps the reverse inductive kick of the motor from trashing the the transistor.
Option (c) employs one of the Darlington transistors of a ULN2003A array. Note that his device incorporates the back-biased rectifier within, obviating the need for an external one.
Would you like to see it in operation?
Expect a giggle at the end...
Click to get the source code.
Click to get the schematic PDF.
Next Project: Motor Direction Control #1
No comments:
Post a Comment