Controlling floppy stepper motors from FTDI USB chips in bitbang mode

From Electron Cloud

Jump to: navigation, search

I have several old Teac FD-55GFR 5¼" floppy drives, and wondered if the steppers could be used for a miniature 3-axis RepRap or some other type of CNC machine; it would be especially nice to re-use the controller boards as well, since they are compact enough. As a basic feasibility experiment, I wanted to try to control them from a DLP Design DLP-2232 board which I already had handy. That's quite a versatile board - it connects via USB and can provide two logic-level serial ports, or a bunch of GPIO pins, and there are drivers for Linux, MacOS and Windows. I have used it in the past mostly for monitoring serial communications between microcontrollers: the connection between the micros is full-duplex (RX and TX lines) but with just one of these boards you can monitor both at the same time by connecting to the two RX lines of the two separate serial ports (and the TX lines on the 2232 go unused, unless you need to inject data somewhere).

To do bit-banging on Linux though, there is libftdi, which includes some example code. I started with examples/bitbang.c and went from there. I used a stock 2232 board, no need to modify its eeprom (although I think you can modify it to indicate that it's intended to be in bit-bang mode by default, if memory serves). I think the code will work fine on any FTDI device though (as long as your USB device ID matches); at the end, you only need 2 GPIO pins for step and direction signals.

The other tutorials I've found about re-using floppy drives seem to focus on the PC end of the floppy cable, so I was having trouble at first figuring out which pin on the drive's card-edge connector is "drive select". Going by this pinout you'd tend to think pin 10, but it turned out to be pin 12. All of the signals on that connector are active low, BTW. As it turns out this page has a nice explanation of the "Programmable Shunt Socket" (seems to be jumpers on the Teac drives) which select the drive's address... must be why pin 12 activated this example (which does have a jumper on it, actually). Back in the day I only had 360K floppy drives, and 3½" drives were available shortly thereafter so I upgraded to that and never had a high-density 5¼" drive (except for now... they came out of junk machines that I was accumulating for a while).

pins 6 and 10-20. Note that pins 2-4 are also connected to +5V from the PC power supply. It's NOT 12V, even though the wire happens to be yellow! A normal 4-pin molex cable will have red wire for +5V.
pins 6 and 10-20 plugging into pins 33 and 35-40 on the 2232 board

So after making the wrong assumption at first, I connected all of the possible "select" pins to GPIO pins on the 2232, so that I could experiment and find out which one it was necessary to bring low. I did that by cutting some short wires, about 1/2 inch or so, stuck them into pins 6 and 10-20 of the "PC" end of a floppy cable, and then connected those to pins 33 and 35-40 on the 2232 board, which I had plugged into a solderless breadboard. Then I was able to "select" the drive, control the main motor (on and off), and step the head back and forth (there are 80 tracks on a high-density floppy, so you can step 79 times until you run into the limit on either end).

On the edge connector, pin 12 is grounded, and we have wires connected from the step, direction and "main motor on" pins to the D0-D2 pins on the 2232 board

Then I was able to correct the wires I had soldered onto another floppy drive, and verify that it still worked. I found that the maximum step speed is about 1 millisecond per step, but only for short distances (e.g. 20 steps), and I'm not sure that it didn't miss any steps in that case. With 1.6 milliseconds per step it is able to seek from one end to the other more reliably.

Look ma, no floppy drive! but the stepper still works
Then I removed the board and stepper from that floppy, and verified that they can stand alone. It doesn't seem to mind having the other board with the main motor disconnected. Indeed, with no physical stop, the stepper can run indefinitely as long as you do not block the photo-interrupter, which normally detects that the head has reached the "track 0" position. If you let it step in a long loop, and then suddenly interrupt the light beam with a business card or some such, it will not allow any more stepping until you allow both the step and direction signals to go high, and then try again. So ideally when using these for a CNC machine, maybe it can be mechanically designed so that the photo-interrupter detects the end of travel of the axis, and the machine will be "safe" on at least one end of the axis: it will be impossible to go beyond that point. Or maybe two photo-interrupters could even be wired in parallel to the same pins.

The torque seems a bit weak though compared to the NEMA 23 steppers I have on my Sherline milling machine; it's not very hard at all to stop it with my fingers, even at slow step rates. But I still suspect the torque might be sufficient for a really lightweight mini-Mendel design. (After I get my first RepRap machine built, maybe I will try to build a mini one with floppy steppers.) These are relatively beefy steppers for PC floppies; some newer drives had wimpier ones, and 3½" drives definitely have much smaller steppers. Also they run cool, so it might be possible to greatly increase the torque by using a higher voltage, or just using a modern Allegro controller chip with settable current limiting.

Last but not least you can download ftdi-stepper.c and compile it like this (on Linux):

 gcc ftdi-stepper.c -lftdi -o stepper

and run it as

 ./stepper number-of-steps

where the number of steps can be positive to go to higher-numbered tracks or negative to to back towards track 0.

Personal tools