A Stand Alone Musical Floppy Jukebox

I saw a video of some Musical Floppies and thought “Yea, I could get in on that”.

By mashing some stuff together and with some overarching Java code here is a self contained MoppyJukebox.

What was Used:
Raspberry Pi
-Java 1.8.0-b132
$ sudo apt-get update && sudo apt-get install oracle-java7-jdk
-Arduino SDK Installed
$ sudo apt-get install arduino
$ curl -s | sudo bash
Floppy Disk Drives
Power Supply
-With Some Molex to Floppy Adapters
Some sort of VFD/LCD 20×2
3 x Push Buttons

My code extends and uses the MoppyDesk code provided by IAmSammy. All the source code is here:
(What a great person!)

Unzip the source files, import the src/ directory into your eclipse workspace and attach the necessary libraries.

The following libraries will need adding to the Java Build Path:

  • pi4j-core.jar
  • pi4j-device.jar
  • pi4j-gpio-extension.jar
  • pi4j-service.jar
  • RXTXcomm.jar

pi4j Version: 0.0.5
RXTX Version: 2.2pre2

I had 8 Drives available to me so I went ahead and created a 6 Drive MoppyJukebox (I killed 2 of them). Most of the information needed to get the initial drives setup can be found on SammyIAm’s site. But as a quick reference for myself here’s a recap.

Pin 11/12: Drive Select
Pin 17: GND
Pin 18: Direction (Green)
Pin 19: GND
Pin 20: Step (Yellow)
Moppy WireingDo this for each drive moving up the Arduino pins.

Trick the PSU into supplying power without a Motherbord (At own risk!)
Connect green to black (14/15) Reference

The Pi is wired up like this:

MoppyPi2I’m using a VFD so I have no backlight. If you are using a LCD with backlight remember to wire in the LED. Currently 20×2 is hard coded.

The buttons are in the order you would expect, from left to right: Previous,  Play/Stop, Next.

Here is a link to the jar that needs to be run on the Raspberry Pi.
Source code can be found here.


Or from the pi

$ wget

On the pi this jar needs to be run with Super User privileges to access the pi4j stuff. Also the RXTX library .so files need to be included in the library path

$ sudo java -Djava.library.path=/usr/lib/jni/ -jar moppyjukebox.jar

If you get the following error messages you need to link the RXTX .so files in the java library path.
java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path thrown while loading
Exception in thread "main" java.lang.UnsatisfiedLinkError: no rxtxSerial in java.library.path

When the program starts up it will setup the com port for communication with the Arduino running SammyIAm’s code. This port can change and is configurable with file.

Next it will run away to find the midis to play. The midi files need to be named in a specific way so that both the top line is the artist and the bottom is the song.

Artist Name$$Track Name.mid

Note: for long song/artist names there is text scrolling.

The midi files should be placed in the following directory:


This directory can be made with these commands:

$ sudo mkdir moppyjukebox
$ chmod -R 0777 moppyjukebox/

I’m not worried about file security as I have no services running, you may want to be a little stricter with file permissions.

Now naturally I want this thing to be stand alone, turn it on and go. To automatically run the jar file on boot I used a cron job.

$ sudo crontab -e

and added the following line (My moppyjukebox.jar is in /opt/moppyjukeboxbin):

@reboot /usr/bin/java -classpath /opt/moppyjukeboxbin -Djava.library.path=/usr/lib/jni/ -jar /opt/moppyjukeboxbin/moppyjukebox.jar

I think that’s pretty much it.

This entry was posted in arduino, java, linux, pi, Programming. Bookmark the permalink.

3 Responses to MoppyJukebox

Leave a Reply

Your email address will not be published.