myFloppyDriveOrchestra

Have any old-school floppy drives lying around? Get hacking! Transform them into an electronic orchestra!!

The Project Overview.

This project uses one myRIO embedded controller and a series of floppy disk drives. The myRIO effectively plays the drives like musical instruments, by stepping the disk drive's integrated motors at specific frequencies.

Since the original posting, I have scaled the project from a quartet into a 16-piece orchestra!



By referencing the following table, I developed a LabVIEW VI (which runs on the myRIOs real-time processor) that converts a musical note (such as a C4) in to a wave frequency. For example, the note C4 would be a frequency of 261.63 Hz. This frequency value is then passed to the myRIOs on-board FPGA, which generates a digital pulse train used to control the floppy drive motors. To generate the pulse train, I used LabVIEW to create a simple FPGA personality that inverts the digital true/false within a loop, but I dynamically set the loop timing to be half the period of the requested frequency value.

Note Frequency (Hz) Wavelength (cm) C 0 16.35 2109.89 C# 0 /Db 0 17.32 1991.47 D 0 18.35 1879.69 D# 0 /Eb 0 19.45 1774.20 E 0 20.60 1674.62 F 0 21.83 1580.63 F# 0 /Gb 0 23.12 1491.91 G 0 24.50 1408.18 G# 0 /Ab 0 25.96 1329.14 A 0 27.50 1254.55 A# 0 /Bb 0 29.14 1184.13 B 0 30.87 1117.67

Note: the period has to be halved, because one loop cycle would be true and the next cycle would be false. Therefore, two loop cycles is equal to one wave period. See the formula below.

The next task is to change the motor direction when the floppy drive's read head reaches the end or the start of the disk. To ensure that the myRIO never tries to drive the read head beyond the start/end of the disk, I implimented a custom counter on the FPGA, to constantly monitor the position of the read head and invert its direction as appropriate.

The History Lesson.

Floppy disks are made from a thin piece of plastic coated with a ferromagnetic material, which is magnetised to retain data. More specifically, the disk is divided into 80 data-tracks arranged in concentric circles, like the rings of a tree.

Therefore the floppy drive's integrated motors are designed to step the read head through each of these 80 tracks. Using this information, I created 16 custom counters on the myRIO FPGA (one for each floppy-drive) to ensure that the direction of the motor changed when it reached the start or end of the disk. So, for values 0-79 the read head will go forward (writing a digital true on the direction line of the floppy drive), then for 80-159 the read head will go back (a digital false to the direction line).

Finally, after the myRIO has finished playing a song, the read head must be return back to the starting position, by driving the motor back the remaining steps. This can be done quite simply using the custom counter that is already created.

The ability to create/duplicate many parallel tasks is one of the major benefits of FPGA. By using LabVIEW FPGA, I only had to write ONE of the customer counters for ONE of the drives - I could (literally) copy 'n' paste the code to take control of the remaining 15 drives. Each duplicated counter would carve out its own circuit within the FPGA - allowing each counter to run in independently and in parallel.

Now that the drives can be sent a tonal frequency and produce a musical note, the next part of the project was to teach the myRIO some tunes!!

System Explanation (recorded while a quartet):



Midi Reader and USB Writer.

To teach the floppy drives to sing, I chose to use MIDI files. To quote wikipedia: "A MIDI file is not a recording of actual music. Rather, it is a spreadsheet-like set of instructions".

A MIDI file has up to 15 tracks of messsges, each representing a seperate instrument within the song (e.g. piano, syth, gutiar, bass, etc). Each MIDI message includes channel number, the note to be played, note start time and note duration. These messages can then be turned into arrays of notes for each channel on the myRIOs realtime processor, which can then be passed down to the FPGA.

In order to make the device easy to use I wanted to have the myRIO read it's playable songs from a USB memery stick plugged into the USB port - to simply the process, I created a vi that converts MIDI files into an appropriate format for the myRIO.

The Wiring.

The wiring requirements of myFloppyDriveOrchestra are surprisingly simiple, because each drive needs just two digital lines - one for step and one for direction. You also need to short the drive select pins and conected the ground pins back to DIO ground of the myRIO. The following image illastrates how to wire a "quartet" of floppydrives to the myRIOs integrated MSP Connector. To control a full 16-piece orchestra, you need to replicate this wiring on two MXP connectors on the reverse side fo the myRIO.

Each drive will also need 6 Volts for power.

The Graphical User Interface.

Now that the embedded software (both real time and FPGA) is developed and the hardware wired, there is one final piece of the puzzle... the GUI (graphical user interface). To control myFloppyDriveQuartet (select the music track, start/stop the floppy drives, transpose music notes etc), I created two user interface options.

PC/Laptop Interface: a simple LabVIEW VI which communicates data from a front panel to a library of network-published shared variables hosted on the myRIO Tablet Interface: I created a portable GUI for use with Apple iPad and Android tablets, using the free network-published shared variables, you can use the PC or Tablet GUI without modifying the code running on the myRIO.

I created a portable GUI for use with Apple iPad and Android tablets, using the free NI Data Dashboard app. This was a very simple process that required no programming what so ever. As the Data Dashboard GUI connects to the same

The Steps to Execute the Code.

Download the attached soucecode and wire up the drives (as described above) connect your myRIO to the computer and power Run the RT VI Run the host VI Choose a song and click play. Once that is working, you can then turn that in start-up VI and use the datadash board app to select music with out a computer connected.

The Requirements.

Software

LabVIEW for myRIO 2014

Data Dashboard (optional)

Hardware

myRIO

Floppy drives (more the better)

A 5V power supply for the drives (1 amp for each drive)

The Useful Resources.

The Developer.

My name is James Willis I'm a student from Cardiff University studying electrical and electronic engineering, currently on my placement year working as a Applications Engineer at National Instruments. If your interested in doing a placement at NI have a look at this page.

