DC motor speed control using PWM
New ! EAGLE files available
If you do not have EAGLE, you can download a full working version from CadSoftUSA http://www.cadsoftusa.com
Here is a zip file with the EAGLE schematics and PCB layout. http://hans-w.com/MotorSpeedEAGLE.zip
New ! Source code available
C source code... requires CCS PCM compiler.
PCM is available from CCS http://www.ccsinfo.com/picc.shtml
//(C)Copyright 2002 Hans Wedemeyer Houston Texas U.S.A
Source code and Hex files are available here: http://hans-w.com/motorspeed.zip
////////////////////////////////////The original text and pictures://////////////////////////////////////////////////////////////
I tried several ready made PWM speed control circuits. Of the few I tried, there were problems that I did not like.
1) Lots of components.
2) PWM running as a low frequency which became audible as a loud buzzing sound from the motor.
3) I needed to build it now, and did not have all the components.
My solution, although it's much like cracking nuts with a sledge hammer, solved these problems.
Here is the schematic.
The assembled PCB
Complete and in service
The PWM frequency is about 10 kHz and does not make a noise in the motor.
The 5 K Ohm potentiometer is connected to ADC input channel 0 and is converted to
1024 (10 bit) value, this value is applied to the PWM control and produces very smooth speed control.
The HEXFET type IRL1004 has extremely low on resistance (0.009 Ohm) and requires only logic level drive, in this
application it does not get warm even when controlling 1 Amp motor current. according the IRL1004 data sheet it
can handle much higher motor current.
It is important to have a moderately fast diode across the motor supply, as close to the motor as possible.
Possible future changes:-
Add RS-232 for software control which could be used for other projects.
Allow the motor to rotate in either direction by adding an H-Bridge output stage.
Control more than one motor using the same microcontroller.
Use a smaller microcontroller.
HEX file for PIC16F876 (overkill) will be made available at the end of the month.
Add tachometer for precise speed control.
email: hans at this web site
(C)Copyright 2005 Hans Wedemeyer, Houston, Texas. All rights reserved.