How it works
The piano has five piano keys with a button underneath each. These can be easily tapped into by soldering a wire directly to one of the pins on each button board. When a key is pressed the voltage signal of the corresponding button wire will go high.
By connecting each of these buttons to GPIO pins of a microcontroller like the Adafruit KB2040, you can programmatically detect a button press when the voltage goes from low to high. (ex: 0 → 3.3v)
Disassemble
Start off by removing the 16 Phillips-head screws along the bottom side of the piano.
Gently pull apart the two halves with the top half remaining facedown. This will help prevent the plastic piano keys from falling out of place.
Mount the Microcontroller
There is a lot of free space within this toy to mount your microcontroller. So you have a lot of options. For this guide we'll use a 3D printed mount for holding the KB2040 and cutting a small opening for exposing the USB-C port within the barrel on the far right end.
The 3D printed mount fits the KB2040 stealthily within either the left or right ends (used to screw the piano to the rest of gym). This way the piano can be easily restored to normal function later down the road and the cuts will remain hidden.
Mounting to the right-side is ideal as it is close enough to reach the existing power wires.
Cut the Case
Using the 3D printed jig you can drill some initials holes on either end and then use flush cutter pliers to trim out the remaining.
Roughly a 9mm x 2.8mm opening for the KB2040's USB-C port.
Fit the Mount
Slide the button end of the KB2040 into the notches of the mount.
Then slide the mount and KB2040 into place to verify the USB-C connector fits within the hole cut.
Connect the Power
To make sure the piano is within a safe operating range for the KB2040 GPIO to read input from, you can power the piano by USB through the KB2040's built-in voltage regulated 3.3v pin.
Start by cutting the red and black wires coming out of the battery compartment.
Cut as close to the plastic as possible to ensure there is enough length to reach the microcontroller.
Then solder the red wire to the 3V pin and the black wire to a GND pin of the KB2040.
Wire the Boot Button (optional)
Optionally the "Try Me" button, which is normally triggered by the packaging, can be repurposed into an externally accessible boot button for the KB2040.
Start by cutting the two wires for the "Try Me" button close to the main PCB of the piano.
Then solder either one of leads to the small circle solder pad on the bottom of the KB2040 and other to one of the ground pins.
Make sure to route the wire going to the underside of the KB2040, through the small slot under the mount.
Wire the Keys
Each piano key button board has three wires connected to it. The lead with the white wire, closest to the button membrane, carries the button's state signal. It is 3.3v when pressed and 0v when released.
For each button, cut a wire long enough to run between it and the mounted KB2040 board. Then solder the wire to the white wire's pin hole.
PIANO KEY Red ⏺ - 1 |
KB2040 PIN A0 - Left |
Text editor powered by tinymce.