3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

Serial Controlled Variable Speed Motor

Serial Controlled Variable Speed Motor
Control the speed of a small DC motor with nothing but the serial port on your computer, a single MOSFET, and some trivial software. (The MOSFET and the serial port make up the "speed control"; you'll still need a motor and an appropriate power supply for that motor; while the serial port can provide the voltage to turn a mosfet on and off, it can't supply the current needed by a typical motor.)

 
Remove these adsRemove these ads by Signing Up
 

Step 1Look at the circuit

Look at the circuit
We're going to do Pulse Width Modulation using a generic N-channel power MOSFET connected to the Transmit data pin from the computer's rs232 port. When the serial port is idle, the pin will sit at the "1" state, which by the time it's translated to rs232, is something like -12V (depending on drivers, it might be closer to -9V or -5V), and the transistor will be quite OFF. When we transmit "0" bits on the serial port, the rs232 pin will go to +12V or so, which is enough to turn on most mosfets pretty well.

If we transmit a lot of "0" bis in a row, the motor will be close to fully ON and the motor will run fast. If we transmit mostly "1" bits, the motor will run more slowly.
« Previous StepDownload PDFView All StepsNext Step »
57 comments
1-40 of 57next »
Jul 29, 2010. 8:27 PMcylove says:
can i have the codes for this?thank you!
Apr 4, 2010. 8:31 AMprofpat says:
 greetings,

i tried this design using a desktop instead, an IBM P3 model 300PL, it didnt work, whenever i type copy 0.pwm com1:, the dos prompts writes " WRITE FAULT ERROR WRITING DEVICE COM1" 
abort, retry, ignore, fail?

in order it to work, i wired the 9pin dsub as  a null modem...now it worked..

to make a 9pin null modem..
connect pins 3 to 2, pins 7 to 8, pins 1,4,6 and 9...

now connect gate of mosfet to pin 2 and 3, and ground wire to pin 5...

it works great...

have a nice experiments..



Jan 21, 2010. 7:16 AMprofpat says:
 great! will try this, hope it will work on my laptop using a usb to serial port cable..
Oct 11, 2009. 5:33 PMMACKattacksnipe says:
i used this for my pc tube light and giant cooling fan
Apr 19, 2009. 9:42 AMHADJISTYLLIS says:
I founded one on old graphics card!
Mar 26, 2009. 8:48 AMgeeklord says:
Will one of these work? I found them on an old mother board.
Mar 28, 2009. 5:24 PMgeeklord says:
Thanks, what kind of voltage/current is at the gate of the MOSFET when its on?
Feb 27, 2009. 1:14 PMTOCO says:
I have downloaded your link. How do I use it? If I click on it, it will say illegal command or somthing like that. Do I need to hook up the motor first or can it be opened without pluging it in?
Feb 25, 2009. 2:34 PMTOCO says:
Could you send me all of the software or links for the use of your serial port controlled motor? Please! I think that you should probably put the links onto the instructable so people can use it easier. I mean so they can build it and use it. And also, I have a few differend mosofets and they say different things on them. Can I use them or do I have to buy a new one?
Feb 14, 2009. 7:06 AMraj007 says:
yaa pls send me a sotware to control multiplestepper motors
Jan 30, 2009. 11:26 AMcupnoodles2 says:
Can this sistem controll 2 motors? i mean is there anyway? thanks my email is positiveguy11@yahoo.com Thanks
Nov 27, 2008. 10:33 AMrab63 says:
thanks for prompt reply westfw. will look at getting a usb to serial adaptor. thanks again.
Dec 8, 2008. 5:38 PMmoordere says:
yes
Nov 26, 2008. 1:56 PMrab63 says:
hi, all How can i do the same using pinter port.
Aug 20, 2008. 12:15 PMMetaferia says:
interesting ... just a quastion, how many volts can a serial port can give us? what about a USB port? thanks
Dec 15, 2006. 6:54 AMcombomatrix says:
Really nice thing to work on. Controlled by a program.... Is there any way to do this using an USB cable attached to a similar circuit from a USB port?
Jun 22, 2008. 10:16 AMDerin says:
the only way is a ftdt chip
May 4, 2008. 6:53 PMadi12104 says:
sorry about my previous comments i justy realize that i havent install the vb.net program so i cannot run the execute file and ask for some serial number by the way sir i still cannot find the 0.pwm 1.pwm 3.pwm 7.pwm 15.pwm 31.pwm 63.pwm 127.pwm in your zipped file
May 1, 2008. 11:57 PMadi12104 says:
pardon me somebody please give me the file of 0.pwm 1.pwm 3.pwm 7.pwm 15.pwm 31.pwm 63.pwm 127.pwm by the way can any one tell me ho to use the com speed zip file because when i opened it it want the pass
Nov 14, 2007. 11:07 PMSonic says:
how risky is this project? I mean there is some obvious risk of damaging the mobo or killing the computer... isnt it? ..or is it safe?
Jan 18, 2008. 2:22 AMSilence says:
Use diodes... will isolate the wires from feedback.
Nov 11, 2007. 6:33 PMrobin4286 says:
Is there a way I can use the serial port to turn a single LED on or off using similar methods? Thanks!
Nov 12, 2007. 2:42 PMrobin4286 says:
hmmm okay so it would seem I have a problem: So when I copy a file (made in notepad, using alt+01 repeatedly, it is a .txt format) of 5000 bytes, in windows xp to com4, which is a USB-to-db9 serial adapter (by cables to go, if it helps), it sits there and does absolutely nothing, no errors, but also no confirmation of sending. I checked the settings multiple times and had them set properly. I used a multimeter to check charge and it stayed at about -6.10 volts(Or maybe positive, but I didn't think so). The multimeter(and an LED) were connected from pin 3 to pin 5. I think the actual problem was in the copy in dos, as it gave no confirmation as it did when I tried a parallel port, and basically locked up, so I had to close the window. Could it be that this does not work in windows XP? Any Ideas on what the problem would be? Thanks!
Nov 13, 2007. 2:25 PMrobin4286 says:
Oh wow I feel like an idiot now... This feels like Java all over again (or javascript, or C#). 3 years of programming and I still forget the Semi/colons I forgot to put the colon at the end of the copy statement... Really sorry to trouble you!
May 13, 2007. 11:27 PMfoxwestjava says:
Does anyone know the most universal mosfet series i use for that ? Thank's
Feb 17, 2007. 1:32 PMSonic says:
I still haven't tried this yet, but does it go backwards also? if not, can it be done with reprogramming? or do you have to use a different circuit?
1-40 of 57next »

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
157
Followers
29
Author:westfw
Middle aged geek username also works at yahoo.com, mac.com, comcast.net, wharton-10.arpa