CONTENTS

Home
Projects
  Electronics
  Graphics
  Java
  Java Mobile
  Android
  Other Stuff
Resume
Music
Pictures
Contact



Floppy Music

Related pages on www.mikekohn.net: MSP43F169 Guitar Proc, MSP430G2231 Guitar Proc, 6581 Sound Chip, Floppy Music, Metal X Mod, YJM Mod, DAC Sound, SD/MMC, MSP430 Assembler

Posted: May 2009

Introduction

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:

http://www.youtube.com/watch?v=beNCUsfpvYc

Pictures

Just a picture of the circuit board attached to the floppy drive.
Schematic of the circuit. Someone pointed out to me I didn't show power connections on the floppy. The floppy drive is powered from a separate cable. It requires a 12v connection on the yellow wire and 5v on the red. If anyone has any questions feel free to email me.

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

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

Download

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.

Download:
floppy_midi.hex
floppy_midi.asm
midi_notes.inc
floppy_music.tar.gz



Copyright 1997-2012 - Michael Kohn