Control a dc motor with your PC
Firas M Ali Al-Raie, Polytechnic Higher Institute of Yefren, Yefren, Libya; Edited by Martin Rowe and Fran Granville - August 26, 2010
| View as PDF |
The circuit in this Design Idea controls the speed of a 5V permanent-magnet dc motor through the PC’s parallel port (Figure 1). You use the C++ computer program to run the motor at three speeds. The circuit uses PWM (pulse-width modulation) to change the average value of the voltage to the dc motor. You connect the motor to the PC’s parallel port with an interface circuit. The design comprises IC1, a 74LS244 buffer; IC2, a ULN2003 driver; relay switches S1, S2, and S3; IC3, a 555 astable multivibrator circuit; and Q1, a 2N2222 driving transistor. The 555 timer operates as a variable-pulse-width generator. You change the pulse width by using relays to insert or split resistors in the 555 circuit.
The computer program controls these
resistors. When S1 is on and both S2 and
S3 are off, the timer output is set to logic
one, thereby driving the motor with its
maximum speed. When S1 and S2 are
on, the 555 timer generates a pulse signal
with a 50% duty cycle. In this case,
the charging resistor, RA1, is equal to
the discharging resistor, RB. In the third
case, S1 and S3 are on, and the charging
resistor is RA2,where RA2=0.1×RB, reducing
the on time of the pulse signal and, consequently, the speed of the motor to
the lower limit. Table 1 summarizes the
on/off-operation conditions of the relays
and the corresponding dc-motor speeds.The code prompts you to select a certain speed, stores your selection as an integer variable choice, generates the proper digital sequence, and stores it at another integer variable. You place the value of the integer variable data at a PC’s parallel port using the outportb function. The program uses the kbhit function to stop the motor when you hit any key on the keyboard.
BigDog robot: a sensor-based enhancement of human capabilities
Maxim Integrated 30th anniversary
The Black and Decker GH1000 Type 2 string trimmer
War of currents: Tesla vs Edison
Understanding the basics of setup and hold time
Simple reverse-polarity-protection circuit has no voltage drop
Gnat-power sawtooth oscillator works on low supply voltages
Simulation shows how real op amps can drive capacitive loads
Why bypass caps make a difference - Part 1: How a regulator and its output capacitor can interact
Ensure long lifetimes from electrolytic capacitors: A case study in LED light bulbs
