Arduino Motion Controlled Demonic Piano Toy by Declan, Ben, and Merrick

by PHS_Engineering in Circuits > Arduino

179 Views, 0 Favorites, 0 Comments

Arduino Motion Controlled Demonic Piano Toy by Declan, Ben, and Merrick

IMG_0363.JPG

This is an step by step guide to control the notes produced by a toy piano using an Arduino relay and an ultrasonic sensor. Also included are pictures, a supply list, a circuit diagram and the necessary code.

Supplies

1. Fischer price toy piano

2. Arduino

3. Arduino 5V relay

4. Ultrasonic sensor

5. 1K ohm resistor

6. Diode rectifier

7. NPN transistor PN2222

8. Assorted wires

9. Breadboard

10. Alligator clip wires

11. 3 C Batteries

12. A computer and Arduino IDE (to program the Arduino)

Open the Toy

IMG_0363.JPG
IMG_0364.JPG

First step is to use a screwdriver to take out all the screws holding the outer plastic casing together. Once all of the screws are removed the plastic front should easily lift off exposing the inner wiring.

Cut the Wires

DOAH4894.JPG
LUJO9107.JPG

Step two is to cut the wires. Cut one of the wires leading to the key button which you want to manipulate, and then strip the rubber lining about half an inch so that it is easy to connect the alligator clamps. When you go to strip the wire make sure not to cut all the way through.

Build the Arduino Circuit

relay diagram.png
IMG_0362.JPG

Build the Arduino relay make sure the diode and transistor are facing opposite ways. Also the wires should be put in such a way that the circuit won't be a short circuit.

Attach the Wires

49082AED-C677-4D47-962D-E188B480DF18.jpeg
ECFA9D8A-B6E2-43B2-9E61-E708874C7B7A.jpeg

Once the wires on the piano have been cut and the circuit has been built, attach the exposed wires you cut on the piano to the wires coming out of your relay on the Arduino using the alligators clips, if need be to make the connection more stable wrap the exposed wire around the clips.

Code the Program

Screenshot 2021-12-10 071714.png
Screenshot 2021-12-10 071856.png

Use the code above to activate the relay using the an ultrasonic distance sensor. There are no libraries that need to be imported for the code to work and you can customize the code to any distance you want, it is currently set for the relay to go off whenever it senses an object within 10 cm.

Downloads