Floppy Drive Music
Making music with things is fun. You can do it with almost anything such as stepper motors, floppy drives or tesla coils. However, to do this, you need certain musical skills like knowing the
musical alphabet and having the ability to hear if something sounds wrong.
Notes and frequencies
Every note has its own frequency. There are 12 halftones in the musical alphabet:
C - C# - D - D# - E - F - F# - G - G# - A - A# - B
This is one octave. The frequency multiplies by two each octave. So playing a tone one octave higher will result in double pitch/frequency. Playing it two octaves higher will result in four
times the pitch. This means that notes scale logarithmic and the difference between two halftones is the 12th root of 2, which is about 1.0594630943. If you multiply any note with this number,
you'll get the next halftone. This way we can calculate any note on the piano.
Connecting the floppy drive motor to the Arduino
This may be the harder part. You need to connect at least two pins of the IDE cable to the Arduino and address it using digitalWrite's.
This article explains the pinout of the floppy IDE cable. There are 34 pins, where the uneven 17 of them are GND.
You don't need to connect the GND pins of the floppy drive as long as you share GND of Arduino and your PSU. The even ones (2, 4, 6 and so on) are the pins we connect to the ardiuno.
We need to connect the following:
- 14: Drive select enables or disables the motor and also the LED. This is useful if you want the LED only to be active when you hear a tone but clearly optional.
- 20: Step steps the motor by one step by changing it from HIGH to LOW.
- 18: Dir controls the direction of the motor. You should change it every step so your motor vibrates. Personally, I prefer vibrating over moving up and down as moving is not very loud and doesn't sound very good either.
When using my source code, you need to connect a button for the "skip song" function. Schematics are here.
I've been struggeling with multiple voices for quite a long time. On an Arduino, you don't have multi threading - meaning you have to find a way to do it without. So I just made a loop
which checks every CPU cycle wheter to step the motor, advance by one note or do nothing. There might be better attempts with timers and interrupts, but so far it works very well. The current
version supports 6 channels.
Photos of the 3.0 version
Videos of the machine in action (left to right: version 3.0, 2.0, 1.0)
This project is available under the BSD license.