Making floppy music with a raspberry pi

Introduction

To make music with old, unused floppy drives has become very popular especially on Youtube.
;any People did it with an Arduinos, but because i didn’t had one, i tried to do it with a
Raspberry Pi, but i think there was a lack of good tutorials how to wire the Pi etc, so i will
provide this to you.
Please notice this is my first tutorials and there could be mistakes, pls let me know that in
the comments.

Materials

You need:

  • Raspberry Pi
  • Floppy disk drive
  • Power source: Its perfect if you have one from an old PC, it should be 5V, I used a 4.5 V Battery, but this is quite difficult as you need to have an adapter for the drive to connect the wires, i found one in an electronic shop specialised on things like this.
  • wire: to connect everything, e.g. the power source and the battery
  • jumper wire: I don’t had something like this, and i tell you, it’s very annoing to connect the GPIOs together to the disk drive. Just google “jumper wire female to female” and you can just stick them together. If you are working with GPIO you will anyway often need them.
  • jumper: If you dont have a Jumper but jumper wires thats fine, just use them.

Wiring

Wiring the Pi with the Battery and the Floppy Disk drive
Wiring the Pi with the Battery and the Floppy Disk drive

With this picture, it should be no problem to connect the disk drive properly.  Im very sorry for the bad wiring, i have never done such a picture before. Connect the Pi without having it attached to any Power Source, because while wiring the Pi  may crash if you accidentaly hit some wrong pins. If the Jumper from Pin 11 to 12 is set and you have the power source connected, the LED of the disk drive should be on. If you dont want to use the Picture:
Connect Pin 11 and 12 with a Jumper on the drive.
Connect Pin 18 of the drive with Pin 11 of the Pi(Also called GPIO 0).
Connect Pin 20 of the drive with Pin 12 of the Pi(Also called GPIO 1).
Connect the rightest Pin of the Power from the drive to the minus of your battery and also to the ground of the Pi, which is pin 6.
Connect the Pin left of the rightest Pin with the plus of the Battery.

Programming

To have easy access to the GPIO Pins of the Raspberry Pi, you have to install wiringPi.
I won’t help you with this because it’s very easy and there is a really good tutorial on this
website: https://projects.drogon.net/raspberry-pi/wiringpi/download-and-install/
From the command line, you have now a Programm called gpio.
To initalise, do these commands:
“gpio mode 0 out” and “gpio mode 1 out”
The two pins we want to use for the music are now outputs.
If you type
“gpio write 1 0″
“gpio write 1 1″
You should hear a light ‘click’, and if you opened the drive you can see the head moving forward.
That should identify you have wired everything correctly.

Software

You can now try to run a programm to make real music. In the command line write:
“mkdir floppymusic”
“cd floppymusic”
“nano main.cpp” (You can also use another editor if you want, i prefer nano.)
Now, copy and paste the code provided on this site:
http://www.raspberrypi.org/forums/viewtopic.php?f=41&t=69947
It’s a Programm written in C. You can now exit nano with CTRL-C. Save your Changes!
Before you can run it, you have to compile it using:
“sudo apt-get install g++” (If you haven’t got it yes)
“g++ main.cpp -lwiringPi” (The last thing so that you can use wiringPi in the Programm)
You should now be able to run the Programm by simply typing:
“./a.out”
It should play some Starwars Song.

Improvements

If you know how to write code in C, you can make a better Programm or maybe one that ready
Midi files, or you can try to use other softwares, this one was the first working for me,
but there are more complex works where you can work with 2 floppy disk drives or more…