Introduction: Beating Heart Candy Bowl With LED's and Arduino
I wanted to make a candy bowl for trick or treat that looked like a spooky heart was beating under the candy. I hope the younger kids find it spooky and not too scary. I’m sure the teenagers with no costume and a pillow case will not be impressed.
- An inexpensive candy bowl
- Some acrylic
- A hot glue gun
- An MP3 player with an extension cable and a splitter
- A set of powered speakers
- An Arduino and bread board
- Some LED’s, resistors, a capacitor, and a 3.5 mm audio input.
- A few bits of scrap wood.
Step 1: Cut the Shelf
I made a shelf for the candy to sit on and the electronics to set under.
- I drilled a hole for the center of the circle and inserted a small nail.
- I measured the 5” radius and made a mark in one area.
- I used string to roughly mark the circle area so I can cut away the excess in advance.
- I cut away material to the exact 5” mark.
- I attached the acrylic to some hardboard, positioned the blade where I cut away, and clamped the hardboard to the band saw table.
- I rotated the acrylic carefully to cut a good circle.
Step 2: Finish the Shelf
It fit at about the depth I was intending, but too much pressure at the edge could cause it to fall into the bowl and disturb the electronics.
- I marked where the shelf sat on the bowl
- I cut 3 pieces from some scrap wood to support the shelf.
- This seemed to work as intended, so I painted them black and hot glued them to the sides of the bowl.
- I drilled a hole for the speaker wire.
- I removed the protective film from the acrylic and used some sandpaper to “frost” it.
Step 3: Arduino and Electronics
The Arduino can only detect positive voltages in its analog inputs. The audio signal will run between positive and negative voltages.
- To handle this we set up a “voltage divider” using two equal resistors connected in series from the Arduino +5 volt connection and ground.
- The voltage value in between the resistors is 2.5 V, as described by Ohm’s law.
- Now the audio input is applied at the point between the resistors, through a capacitor. This varies the 2.5 volts at this point.
- This is where we connect analog input A0 of the Arduino.
The Arduino uses digital outputs where it puts out values of +5 volts and 0 volts. It will turn the signal on and off at a given frequency that will give the appearance of different brightness’s. (This is called pulse width modulation. Not all output pins support it)
- I placed the 2 LED’s on digital output 3, adding a resistor in series to keep the proper voltages across the LED’s.
- The Arduino sketch (program) handles converting the analog signal to the frequency for the LED pulsing.
Step 4: Test the LED Flashing
Load the Arduino sketch (found in the zip file attached to this Instructable on page 1)
A quick test without sound had each LED showing up as a distinct point on the shelf, which spoils the illusion. After coming up with various complicated ways to diffuse the light further, I discovered that a single piece of masking tape across the 2 LED’s gave the effect I wanted very simply.
Step 5: Put It Together
- I placed a heartbeat soundtrack on the MP3 player and set it to repeat.
- I put a splitter into the output and connected one end to the audio input and the other to the speakers.
- I powered the Arduino with a 9 volt battery.
- I put the shelf on top.
Step 6: Finished
This was my first trip into the world of Arduino and electronics. Let me know in the comments if you have any other ideas about how to make this work.
You can download the Arduino sketch, Fritzing File, a wiring diagram, a schematic, and the soundtrack is available in a zip file on the first page.