THE CIRCUIT IN THE figure provides three levels of speed control for a dc motor, using a PC’s parallel port (LPT1). A C++ program performs the control functions by allowing the signals from the PC port to deliver three different voltages to the motor.
The system is an interface circuit that connects the motor to the PC using a 4-bit binary counter (a 74LS193), three current- limiting resistors, three npn transistors, three 5-V relays, and two supply resistors. Counter inputs A, B, and C receive the control signals from three of LPT1’s data pins, through a suitable cable. The counter acts as a buffer for the weak signals coming from the PC, so any other buffer IC, like a 74LS244, can be used.
Counter outputs QA, QB, and QC connect to the three transistors (2N2222s were used in this example) through the currentlimiting resistors. The transistors increase the current level of the PC signals in order to drive the relays. Depending on the control signals generated by the PC, the relays insert or take out the supply resistors. This action applies the desired voltage level from the 12-V supply to the motor to achieve the proper speed. The On/Off operation of the relays depends on the digital sequence generated by the computer program (see the table).
When the program is selected, a Start screen appears. Pressing any key brings up a screen containing a selection menu. From this menu, the user selects the desired motor speed or Exit. Once the motor is running—at any speed—the user can stop it by pressing any key, causing the selection menu to appear again.
The integer variable “choice” in the program listing stores the selection case of the user. Based on the value of this variable, the necessary digital sequence is stored at the integer variable “data.” The function “outportb()” places the suitable digital signal at the data lines of the PC’s parallel port, which is identified through its address. (The program is available at http://electronicdesign.com.)
Wow, that code must be based on Win98 or an earlier DOS based system, there is noway you can run that code using an NT kernel, I am not sure about Linux.
Anonymous -October 14, 2009
Where are the diodes that prevent the inductive voltage spike resulting from the relay coil turn-off from blowing the transistors?
Anonymous -October 12, 2009
Where's the code??
Anonymous -October 12, 2009
Nobody would actually design a motor controller like this in the real modern world. Isn't ED an INDUSTRY publication, not a hobby rag?
Anonymous -October 12, 2009
What is the purpose of putting the three relay contacts in series instead of putting them in parrellel and changing R2 to a 470 Ohm. This would allow troubleshotting a failure easier by which function doesn't work. the contact resistance would be 1/3 to the motor.
Bill Ross -September 30, 2009
Your Comments:
Enter the text from the image below
Please refresh the page if you have trouble reading this text.
Search Electronic Design
Email Newsletter
Sponsored By:
Electronic Design UPDATE provides readers with late-breaking news, opinions from industry experts, and timely technology stories. It's a unique opportunity to get your product message in front of engineers, engineering managers, and corporate managers while they're reading about critical information online.