NHCAD
NHCAD

Fun Projects in Mechanical Design & Custom Programming
Lebanon, NH


NHCAD Home

CAD(Computer Design)
Free CAD Software
SolidWorks
SolidWorks Macros
SolidWorks Custom Properties

CNC / Steppers
5804 Stepper Driver Circuit
Floppy Stepper Motors
DIY CD Plotter
DIY CNC Mill

J2ME Mobile Programs
Sprtint Wireless Toolkit
Device / ESN Activation
Favorite Apps
JPGViewer

1964 Oday Javelin
1964 Oday Javelin
Centerboard
Rudder
Tiller
Transom
Hull
Topside
Deck
Details
First Sail
Floppy Stepper Motors

The stepper motors you see here have been scavenged from 5-1/4 floppy drives. Old floppy drives can be found at dumps or sometimes in people's basements collecting dust. I suppose any floppy drive will do. I prefer to work with larger 5-1/4 drives with bigger stepper motors. The larger motors have more power, though not enough to do any harm. They can easily be stopped by grabbing onto the shaft and they do not generate any noticable heat at rest (unlike larger stepper motors).

The great thing about floppy stepper motors is that there aren't any hidden costs to operate them. Everything you need to experiment is there. You just have to pick out the parts that you want.
  1. They can be powered by a PC power supply
  2. They can be controlled by PC parallel port
  3. The controller card for the stepper is included with the floppy drive. The controller card converts logic signals from the parallel port to electrical currents that drive the stepper motor. In the picture below, a brown ribbon cable (6 wire) connects the controller card to the stepper motor.




Testing the floppy

I think this is an important first step. I was just given 5 floppy drives. 4 of them actually worked. I prefer to test the floppy before I start ripping it apart. There's always that chance that I'll cut something I sholdn't have. Then the motor doesn't work. Then I don't know if it was something that I did or didn't do.
Test the motor first, as it sits in the alumunum frame. Make sure you can drive it in both directions. You'll learn a lot in this step by seeing how it works and how to control the location of the motor shaft.



Power Supply

As I said, you can use the power supply of a PC for your floppy drive. Of course there's a catch. You have several options to get power to the floppy drive.



Option 1

You can extend one of your internal power cords from your working PC to your floppy. This way the floppy can reside outside of the PC case and you can get wires to it etc. Just cut the four wires (1 red, 1 yellow, two black) and patch in a couple feet.




Option 2A

You can also use a power supply scavenged from a PC. The catch is that these are switching power supplies that won't work properly without a load being applied to them. One option is to attach a couple of old hard drives. The hard drives will spin up and the power supply fan should start spinning.




Option 2B

Another way to put a load on the power supply is to put a resistor across the 5V (red wire) to ground (black wire). You'll need a pretty hefty resistor. I'm using a 10 ohm resistor from Radio Shack. I've purposely kept the resistor inside the case and near the fan to keep it cool. Be careful of shorts and getting wires too close to the fan. Zip ties are useful for keeping things secure. If you do remove the cover to your power supply, realize there are some good size capacitors in there that can store a charge, even after you unplug it. This is not a difficult thing to do, but it does take some sense if you're not experienced.





The Personal Computer (PC)

Older PCs actually work better for this kind of project. I suppose a new one would too, but I typically have too many important things on my desktop and I would rather use an older project PC for this kind of project. If it fries, I'm not out much.

At any rate, it is advisable to use a seperate Parallel Port card to drive your motors. If your motherboard has an integrated parallel port (most do) then you just go into the Bios settings, disable the integrated LPT1 and install the extra card. If something fries, you'll probably save your MB and have to get another cheap parallel card. I've never had any problems to date.






An additinal requirement is that you DO want to be running DOS for this project. Doesn't matter that you have a fast PC, or WindowsXYZ. Because Windows is a multitasking system, the sensitive timing of this project will be interrupted by other programs taking control of the the CPU. DOS is actually a better OS for this project becuase it can get access to the parallel port instantly (using interupts) and reliably without having to share CPU resources with any other application running in the background. Even starting Win98 and dropping to a DOS window won't cut it.

Don't have DOS laying around? Use FreeDOS. Do a google search to find it. It is a public license and has been driving my stepper software and TurboCNC without any problems. It's a great OS for what we need it for.



Making The Connections

Floppy Pinout

reference: http://www.hut.fi/Misc/Electronics/circuits/diskstepper.html



Connect the floppy to the parallel port as follows




The ribbon calbe I use to connect to the floppy has two connectors on it (A and B drives). I use the connector on the far end, which would be the A drive and pin 14 as outlined above.

The card edge on the floppy drive has 17 gold colored contacts on each side of the card. All of the even numbers are on one side (notice white numbers 2, 10, 20, 30, 34 in the photo below). The odd numbered pins are on the bottom side of the card.



I have used a floppy ribbon cable to connect to the card. I use cut paper clips, inserted into the ribbon cable pinout and also into the 25 wire parallel extension cable. I used micro clips and aligator clips to make the actual connections between the paper clip stubs. No soldering and it's non-destructive. A voltmeter, for continuity testing, is really helpful in troubleshooting your connections.




The Whole Setup



So you think you have it all? The power supply works, the parallel port is connected. Notice I'm using a Toshiba notebook. I think it's a P60. Perfect for running FreeDOS and it was given to me. I've tried this with an IBM thinkpad too, but the parallel port is not capable of driving the controller cards. I don't know why, but I've heard elsewhere that the thinkpads won't work for this. Guess they were right.



Software

The easiest way to test the motors is with a little pascal program that changes the states (0 or 1) of the data pins on the parallel port. The parallel port has 8 data pins. They are numbered 2-9 on your parallel port. when a data pin is high it will put out 4.2 volts or so. When it is tied low, it will be close to 0 Volts. WARNING: Don't touch a data pin directly to a ground pin, it will draw too much current and probably fry your parallel port.

The following pascal program LPTOUT.EXE can be used to test the stepper motor. The lptout program is not my own code. It is available, along with some additonal details and code at http://soviva.com/picsoftlpt.htm. BTW Turbo Pascal is a programming language marketed by Borland. It is antique software and can now be downloaded for free. Man am I showing my age. If you would like to download Turbo Pascal and learn more about it read the article Antique Software: Turbo Pascal v5.5 by David Intersimone


Program lpt1_output;

Uses Dos;

Var
   addr:word;
   data:byte;
   e:integer;

Begin
   addr:=MemW[$0040:$0008];
   Val(ParamStr(1),data,e);
   Port[addr]:=data;
End.



Download the executable version of the software. From DOS try the following commands to step your floppy motor.

lptout 0 
lptout 2 
lptout 0 
lptout 2 
That should step the motor in one direction

lptout 1 
lptout 3 
lptout 1 
lptout 3 
Should step the motor in the other direction



Counting Binary

Now you're asking yourself why does this work? I'm glad you asked.

The data pins (there are 8) are numbered P2-P9 on your parallel port. Recall that P2 is the direction and P3 is step (see chart above).

lptout      P2		P3
Value    Direction     Step
  0	=   0		0
  1	=   1		0
  2	=   0		1
  3	=   1		1

Remember that logic 1 equates to 4.2 Volts and logic 0 is no voltage. The motor will step when the state of Pin 3 is toggled on. Most of my floppy stepper motors move when the step pin changes from 0 to 1, goes high. They don't move when the step pin changes from 1 back down to 0, but of course it is necessary to reset the state of the pin.
          2345 6789 <-- 8 data pins (P2-P9)
lptout 0 (0000 0000 resets all data pins)
lptout 2 (0100 0000 sets second data pin high - second data pin is #3 and tells the motor to step once)
lptout 0 (0000 0000 sets all data pins low again)
lptout 2 (0100 0000 tells the motor to step once again)


If you've been paying attention you'll notice that
lptout 255 (1111 1111 sets all data pins high P2-P9, nothing we'll use today)



To step the motor in the other direction
          2345 6789 <-- 8 data pins (P2-P9)
lptout 1 (1000 0000 resets all data pins, keeping the direction high)
lptout 3 (1100 0000 sets second data pin high) second data pin is #3 
          and tells the motor to step once - direction is still high)
lptout 1 (1000 0000 resets step pin - keeps direction pin high)
lptout 3 (1100 0000 tells the motor to step once - direction pin is still high)



TurboCNC

I agree, there has got to be a better way. Stepping the motors by one step at a time is not a bad thing, especially as you are trying to trouble shoot your floppy drives, power supply, & cables. A voltmeter is really handy for trouble shooting. Remember, logic 0 = 0 volts, logic 1 = 4.2 volts.

One way to drive these motors with precision is to use G-Code. It is a language used to program machining centers. CNC (Computerized Numeric Control) uses G-Code to give commands to the motors. Each stepper motor needs only two inputs (step & direction). Having eight data pins available, you could control up to 4 stepper motors at once.

I can't say enough good things about TurboCNC. It is a program used to interperet G-Code and drive stepper motors via a parallel port. You can control every aspect of the motor, its position, speed, acceleration, etc. Some benefits of TurboCNC are:



I use TurboCNC on two other projects. The CD Plotter and the CNC Mill both use TurboCNC to control the motors. The CD Plotter even uses floppy stepper motors to label CDs with a Sharpie marker.