Sunday, October 18, 2015

Make a "Beating Heart" Candy Bowl for Halloween


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 spookyand not too scary. I’m sure the teenagers with no
costume and a pillow case will not be impressed.

I used:

  • 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.

I made a shelf for the candy to sit on and the electronics to set under. I didn’t want a hole in the shelf, so I found a kitchen lid that was about the right size, traced it, and cut the acrylic with a jigsaw. It cracked. More tries resulted in more cracks and a shelf not circular enough.

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.


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 and 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.

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. I’m not sure how this works, but this varies the 2.5 volts at this point. Can someone explain how this works to me? 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.

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.

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.

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.


You can download the Arduino sketch, Fritzing File, a wiring diagram, a schematic, and the soundtrack.

Sketch in a GitHub repository.

You can also get all of the above in a zip file.




2 comments:

  1. Love the tutorial, how could this be expanded to run 3 separate channels that react to different frequencies?

    ReplyDelete