Posted: May 2009
So I saw other people doing this on YouTube and I wanted to be cool like them and do it too. Basically what I'm doing here is shaking the hell out of a floppy disk head at certain frequencies to make music. I was originally going to do this with 2 floppy drives so they could each play a part of Bach's Invention 13 from the midi file I used in my SID Player project. Unfortunately because of the way floppy drives work, this wasn't possible while having two drives on the same cable and I didn't have room on my PC board (or the patience) to solder another floppy connector. Anyway, if you want to hear an example of what this sounds like I have a video on YouTube:
Update May 20, 2012: I made a new version of this circuit that takes input from my guitar and vibrates the floppy disk head based on input from the guitar. Sound files and/or video coming soon...
Btw, this isn't very healthy for a floppy drive. I actually destroyed a floppy drive doing this :). Also, the quality of the drive really affects the sound. The drive I destroyed actually had a pretty nice sound and kept the notes in tune suprisingly well. The floppy drive in the video above is a piece of crap from an old Gateway 2000 computer. The notes were kind of sound out of key sometimes. I had a third drive that was made by TEAC that was so high quality it was almost dead silent. TEAC made some of the best drives around in my opinion.
Original Circuit Explanation
So there are many sites that have floppy drive pinouts including this one: http://www.interfacebus.com/PC_Floppy_Drive_PinOut.html. Basically it works like this: all the odd pins on the floppy drive cable are connected to ground. Since all I was doing was playing with the stepper motor, I didn't need any of the drive's output connections to the inputs of the micro since I wasn't reading anything, but I hooked up the index and track 0 pin anyway for fun. For microcontroller I used the Atmel ATmega168. Probably if I were to redo this project I would use a smaller chip such as the ATtiny2313 since it only requires 1 Vcc and 1 Gnd, it would save space on the board and would be easier to wire it up. Unfortunately, back then I was pretty much only using the ATmega168. For output pins on the micro to the floppy drive I used PD2 for density select (always high if I remember right), PB0 for motor on, PB1 for drive select B, PB2 for drive select A, PB3 for motor B on, PB4 for direction, and PB5 for a step pulse. All these lines are reverse logic so setting them low selects the signal. For example if I wanted to make floppy drive A's motor spin, I'd clear the PB0 output pin setting it low. My firmware doesn't touch any of the drive B pins for reasons I'll explain later.
So for my circuit I was trying to make the floppy head move back and forth and different speeds to create music. For example if the head moved back and forth at 440 steps a second it would be an A440 note. I originally tried to move the head up and down from track 0 to 80 and back to 0 at different speeds to create tones, but it was too quiet, so I decided to just move the head back and forth by 1 track. To move the head I simply set the direction pin (PB4) low or high depending on which direction I want to move the head, set the drive select A pin low (PB2), and set the step pulse (PB5) low for at least 1ms. Unfortunately the drives don't have any latches, which is the reason why I couldn't control 2 drives from a single cable to make music. Drive select and the step pulse have to be kept low for each drive for at least 1ms. Switching to drive B during this time is not an option.
So in order to make this chip play songs, I made the microcontroller connect to a computer via an RS232 and accept MIDI commands. So basically to make the chip play a middle C the computer would send 0x90 60 127. To turn off the note 0x80 60 0. I modified the midi player I wrote for the SID player project to echo the MIDI commands it parses out to the micro instead of sending the commands I used to control the SID.
Guitar Ciruit Explanation
Since I noticed that everyone and their mother is now creating floppy disk music circuits, I decided I wanted to try something different. This circuit and firmware is pretty simple really. It takes the input from my guitar, raises the voltage by half of 3.3v (since 0v to 3.3v are the rails to the reference voltage), puts this signal into the A/D converter of an MSP430G2231, and if the number read in is above 512+threshold, it moves the head 1 step. This makes the floppy disk head vibrate at the speed of the string. Probably the most tedious part of this circuit is that since the microcontroller runs at 3.3v and the floppy disk is 5v, it takes 1 transistor per input / output to interface the drive with with the micro. The source code below can be assembled with naken_asm.
Warning this code is in terrible shape. Since I was originally going to use two drives I wrote most of the code for it and didn't remove or a lot of debug code and commented out code I might want to keep.
New MSP430 Guitar Floppy Circuit:
Copyright 1997-2013 - Michael Kohn