Introduction: Halloween “head-in-a-jar” Candy Dispenser Decoration With Arduino

This project explains how to build a candy dispenser to use as Halloween decoration build with Arduino Uno.

The leds light up in a back and forward sequence in red and will turn into green if the ultrasonic sensor detects a hand. Next, a servo will open a trapdoor that contains candy and it will fall directly into your hand.

Step 1: Build the Head-in-a-jar

We got our inspiration to do this Halloween prank from another Instructable.
You can learn to do this first step in this link:

After that, we’re going to add the arduino circuit to convert it into a candy dispenser.

Step 2: Build the Jar Holder

To build the Jar Holder was necessary to make a wood structure to subject all the electronic and mechanical components used to run the candy dispenser.

The external structure holds the jar. Also there is a shelf to hold the electronic and the candy cavity pasted to the table.

Step 3: Build the Candy Dispenser

The candy dispenser consists in a cavity where is possible to put different kind of sweets and the barrier that allows or not the falling of a single candy each time. The whole is made by wood and the barrier is connected to the servo to be moved when the sensor feels a hand near.

Step 4: Electronic Components

In this project we use the following components:

- Servo Motor x1: movement of the gate.

- Movement sensor x1: detection of hand to take a candy.

- LED's RGB x4: output of the sensor (informs the user about the correct use).

- Battery x1: energy to the servo running.

- Cocodriles: to connect the circuit.

- Resistors (220) x8

- Arduino 1

Step 5: Electronic Circuit