Halloween is one of my favorite holidays for one reason. Candy! However by the end of the night, the neighborhood kids have usually picked over my candy bucket. This year I’m going to change that! To keep kids away, I’m going use an Arduino to detect when someone has their hand in the candy bowl, and use a solenoid to shoot silly string at the candy thief. To detect when a hand was in the candy bowl, I used an infrared LED and infrared sensor to create an invisible beam on the opening of the plastic pumpkin.
When the beam is broken the Arduino will send a command to a power switch tail which in turn makes a solenoid push down on the silly string can.
I mounted the solenoid and silly string to a few pieces of foam board so the solenoid hits the silly string every time.
To allow for easy connection of the solenoid and IR LED and sensor, I mounted a terminal block on a project enclosure. The Arduino and 9V battery sit inside the project box and the terminal block connects to the Arduino through short jumper wires.
The Arduino code for this project can be found at my GitHub page
ADVERTISEMENT