How to Make a Floppy Drive Music Mix (16 Drives, 5 Songs, 1 myRIO) - myFloppyDriveOrchestra
Being one of the most popular DIY/maker projects around, Musical Floppy Drives are nothing new. However, myFloppyDriveOrchestra includes a few unique features, which separate it from the crowd.
- FPGA - by implementing the drive control on an FPGA, I have effectively created a x16 core processor! I have a "core" dedicated to each drive. This means that, although I can share clocks and synchronisation between each "core", all 16 drives execute truly in parallel!
- Wireless Interface - No PC is required to play the orchestra. In stead I implemented a GUI (which allows users to transpose tracks, select songs, monitor processor usage etc), for use with any iOS or Android tablet.
- Daft Punk Helmet - Using the same embedded controller, we arent just playing a daft punk song... but we are controlling a Daft Punk-esque electronic power helmet!
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 here, 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: 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.
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).
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!!
Head to the link to download the code and read more into how it works