From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Student Projects

cancel
Showing results for 
Search instead for 
Did you mean: 

myMozart: A robotic piano player

 myMozart: A robotic piano player

 

Turn any old keyboard into a robotic instrument using the myMozart.

Low cost and easy to set up, simply pick a MIDI file and start listening.

 

Summary:

Use a myRIO to create a robot that will automatically play any keyboard you might have lying around out of materials that you can find around the house.

 

 

Why?:

I've always loved music and always thought that robots are cool. So I decided to join the two with myMozart and prove that engineering can be fun.

 

IMG_20170804_140904.jpgIMG_7917.JPG

     

Overview:

myMozart uses a myRIO and LabVIEW to play the keys on a keyboard to play songs automatically. Reading a MIDI file (see below for a brief description of what a MIDI file is) and uses this file to determine what notes to play and when to play them.

 

From this link

"A file with the .MID or .MIDI file extension (pronounced as "mid-ee") is a Musical Instrument Digital Interface file.

Unlike regular audio files like MP3 or WAV files, MIDI files don't contain actual audio data and are therefore much smaller in size. For example, MID files explain what notes are played and how long or loud each note should be.

Instead, they are basically instructional files that explain how the sound should be produced once attached to a playback device or loaded into a particular software program that knows how to interpret the data.

 

This makes MIDI files perfect for sharing musical information between similar applications.

You can read more about the MIDI file format at MIDI.org: About MIDI."

 

myMozart plays the keyboard using solenoid actuators which are positioned over each key in one full octave, giving 12 notes it can play. This can be re positioned to any other octave on the keyboard if needed. Additionally, using the 3OctaveOn variable the user can play notes from one octave on either side of the middle octave on the same keys, giving up to 3 octaves that can be played on the same 12 keys. This sounds good for some songs, and terrible for others so trial and error is needed to see if this is useful for any given song.

 

The solenoids are controlled with an on or off (boolean) signal which is provided by the FPGA on the myRIO. As the myRIO can only output 3.3V on its digital pins MOSFET transistors were needed to allow the solenoids to use a 12V power supply while still being controlled in this manner. (Information used from the Arduino tutorial here).

 

 

Hardware:

Mounting board- just needed to hold solenoids over keyboard, dimensions will be specific to the keyboard used. Mine is: … 320mmx440mm base, 130mm total height (20mm mdf base, 3mm acrylic top).Mounting Board for the robotMounting Board for the robotSteel Mounting Plate- To attach the solenoids to the acrylic section of the mounting board, I used 1mm steel (in my case a re-purposed drawer divider) which was measured to fit, drilled with holes to screw on the solenoids and bent at 90° Solenoids mounted on steel plateSolenoids mounted on steel plate

Solenoid Fingers- 3D printed solenoid fingers are used to translate the pulling motion of the solenoid into a pushing motion to press keys.  (See here for details on importing the attached .f3d files to Fusion 360)

3D printed solenoid finger3D printed solenoid finger

Electronics- Solenoid driver circuits were created to convert a 3.3V digital signal from the myRIO to a 12V power on/off for the solenoids. These circuits were originally built on breadboard then stripboard, and then converted to PCB using Multisim and Ultiboard, and the raw files can be found attached along with the Gerber files needed to print off the PCB's. (I used EasyEDA and their partner website LCSC to ship both PCB's and components together and they were fantastic). 

image.pngUntitled.png

 

Components used- 12*12V 10mm push/pull solenoids similar to this, note that when mine arrived they didn't have the section coming out of the top which would allow the push motion, which is why I needed to create the 3d printed "fingers".

12*MOSFET transistors such as these.

12*Recovery Diodes such as these

12*12kOhm resistors

Various female-female wires to connect the myRIO pinout to the solenoid driver board.

 

Software:

Find the source code attached for both the myRIO and the host used to control the robot.

This code looks at all MIDI files saved on a USB drive and inserted into the myRIO (in my case, looks at all files in the folder “Music” saved on the top level of the USB drive). The user can then pick which of these songs is desired, along with other information such as which track in the MIDI file is to be played.

This user interface is provided as either a VI that can run on a laptop, or an iPad running Data Dashboard and can be downloaded as needed.

The actual code itself reads a .midi binary file and picks out all relevant information, in my case I was only concerned with the events “Note On” and “Note Off” and at what time these events occurred. This information is then stored in an array where each element is a cluster containing all events that happened at that time (this array is sorted so the events are grouped together and the times are all in order).

Using this array, the code continuously checks the current time against the time of the next event. When they are the same, the corresponding note events are passed into a separate loop using a queue to turn on or off elements of a boolean array which is applied to the digital output pins controlling the solenoids through the FPGA. The code runs through the entire array, and so the entire song and then returns to the beginning, waiting for user input before playing the next song.

 

About me:

My name is Henry Delf-Rowlandson and I'm currently studying Mechatronic Engineering at the University of Manchester. I created myMozart during a year in industry at National Instruments and had inspiration from the Manchester Robot Orchestra who I spent a summer placement working with.

Contributors