Introduction: Control the Speed of Jingle Bells With Arduino
This Instructable will show you how to program a strip LED to correspond with notes played by the Arduino. You can also speed up or slow down the song by bringing your hand closer or further away from the photoresistor. My example is with the song Jingle Bells however you could change it to be any song if you translate the notes.
- Arduino board
- 10K resistor (x2)
- LED strip
- Speaker amplifier
- Wires (male and female)
Step 1: Wiring
Reference the link below to see the proper set up for your wires.
All pink wires align to pin numbers.
All black wires lead to ground.
All red wires lead to 5V.
All black with tan signify a resistor.
The green wires signify the wires coming out from the LED strip.
Step 2: Coding
Copy the code that is attached.
The rest is explanation of how to code works:
The coding has comments however you will see that it’s quite long.The initial notes declared ensure that your board can make any musical tone. There is then a declaration of colors to correspond with each note. The void setup turns all of your pins on and begins the programming. The void loop is where the main coding takes place. It begins with a float tempo, this ensures that your song will speed up or slow down depending on how close you are to the photoresistor. The closer you are the faster it plays. It then goes on to play jingle bells. Each note has its own function. Initially is clears the LED strip of all colors, it then dictates the note and how long it is. For a quarter note in plays for 250 milliseconds, a half note plays for 500 milliseconds and a whole note plays for 1000 milliseconds. After this declaration there is a loop that tells the board how many lights should light up; for a quarter note 5 lights light up, for a half note 10 lights and for a whole note 10 lights light up. There is then a dictation of color and delay to end the note. This repeats continuously unless unplugged from the board.
Step 3: Test It Out!
The way to test your code and wiring is to plug it in! If it is not functioning properly, check your wires and that you have copied all of the coding. You may have a ground going to 5V or other mix up.
Step 4: It Works, Now Share!
Now that you’ve worked out any issues you’re done with the project! Snap a picture and share away with your friends. If you wanted you could change the song by making the notes different and changing the colors correspondingly. Up to you, the possibilities are endless!