iImage Information

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.)
Step 1Look at the circuit
iImage Information

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.
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..