This was completed as my final project for a graduate level course entitled Advanced Mechatronics of Reactive Spaces in a team of three people. We were tasked with creating a robotic piano to play in a robotic band.
One of the design constraints for the system was that each note must be played with 5ms accuracy. From this, we opted to individually actuate each key with a pull solenoid to greatly reduce the time required to play each key. A MIDI file was sent out from the source to each instrument. The piano received the necessary information and actuated the solenoids properly via custom PCBs.
Each solenoid was powered with 15V and was controlled using a power MOSFET as a low side switch. These switches were turned on and off using shift registers. Eight solenoids can be controlled with each shift register and every pin is shifted on/off in parallel with each other.
A look-up table was created to map the MIDI notes to the solenoid numbers. This table is queried using the findIndex() function, which takes the MIDI note number as input and returns the solenoid number. Once the solenoid number is found, the regWrite() function is used to change the state of the shift register bit. The regWrite() function takes the solenoid’s pin number and the state the pin should be changed to and then changes the state of the solenoid pin.
The piano successfully played all songs. Its limitation, however, was playing more than four keys simultaneously due to current limits. Each solenoid pulled up to 2.5A of current and the team only had access to a 10A power supply. Thus, when attempting to play more than four notes at once, none of the solenoids had enough voltage available to depress the keys. In songs such as the Minute Waltz you can hear the effect of this at times. This could be rectified by obtaining a power supply with a higher current limit or by using multiple power supplies.
Full videos can be found at the following links:
Foreplay - Boston: https://youtu.be/jNhjGteu8xc
Boom Boom Boom - John Lee Hooker: https://youtu.be/sFQGzxCrk34
Fool in the Rain - Led Zeppelin: https://youtu.be/bfIT8kFVw0M
Hedwig’s Theme - Harry Potter: https://youtu.be/3oR_wPjuhnc
Minute Waltz - Chopin: https://youtu.be/9dG2arwf1Tw
Octopus’s Garden - The Beatles: https://youtu.be/tg1NyoE-aJg
Still Alive - Portal: https://youtu.be/niMTOl0Nj8A