What the world needs is an Arduino Jack-o-lantern! Don't you agree?
This project is a jack-o-lantern that can provide Tricks AND Treats!
Press the button on the side of its head and you get a randomly selected Halloween joke with the accompanying music.
Put your hand under the mouth and it dispenses a Smartie(TM) with an accompanying tune.
Let's build it!
(Note: The static you hear in the video is just rf noise from the servo motor that was picked up by the phone. You cannot hear it in actual use. Sound is nice and clear.) If you want, you could put a small decoupling capacitor across the VCC and GND of the servo but I didn't find it necessary.
- Some kind of jack-o-lantern (this one is injection-molded foam that I picked up for $2 at a charity store)
- Arduino UNO or Nano (any thing you have is fine)
- Small Servo
- 4x20 I2C LCD Display
- An arcade style pushbutton
- 10K Ohm pull down resistor for the button
- Small 8 Ohm speaker
- SR-04 Distance Sensor for candy dispenser
- Small piece of 3/4" plastic conduit for the Smarties dispenser
- Some plexiglass or other thin material for the Smarties dispenser
- Small piece of plastic to make the Smarties dispenser trough
- Small L-bracket and other scraps to complete the dispenser
- Connecting wire, hot glue etc
- Small breadboard for the circuit (or solder it up for permanent use)
You can use M&Ms,Lifesavers etc. You'll just have to adjust the hole size, pipe diameter and height of the dispenser swing arm to handle the dimensions and thickness of the type of candy.
- Utility knife to cut into your jack-o-lantern
- Drill to drill holes for the speaker and pushbutton (or cut carefully with the knife)
- Thick black Sharpie(TM) marker or black paint to paint the eyes, nose, mouth on the jack-o-lantern
- Patience and a sense of humour!
Step 1: Build the Circuit
Wire up the circuit as per the diagram. It's recommended that you use a 5 volt, 1 amp power supply to provide enough current to drive the servo.
Ultimately, you will need to use wires of sufficient length to reach all the components once they're installed inside the jack-o-lantern.
Step 2: Modify the Jack-o-lantern
I found my jack-o-lantern at a second hand store. It's made of light injection molded foam so it was easy to cut and drill. You can use any jack-o-lantern that fits your parts.
1. Dry fit your parts.
2. Cut an access panel into the jack-o-lantern so you can install the parts.
3. Using a small drill, make some perforations where the speaker will be so that the sound can get out. Install the speaker with hot-glue or another suitable adhesive.
4. Drill or carefully cut the hole for your pushbutton. Install the pushbutton.
5. Cut a hole in the mouth for the exit of the trough that dispenses the candies.
6. Cut or drill holes underneath the mouth for the SR-04 distance sensor.
Step 3: Build the Candy Dispenser
This is the most complex part of the build and it's totally optional. You may want to delete the code for the SR04 detector and the servo and modify the main display message if you're not going to dispense candies.
As I cannot take apart the jack-o-lantern to disassemble the dispenser, I'll try to describe the principles here.
The main operating mechanism is a swing arm (here made of 3/16" plexiglas) mounted to the servo with a hole that is the diameter of the candy to be dispensed. The thickness of the swing arm is as close to that of the candy as you can reasonably get.
A dispensing trough (here it's a small piece of vinyl eaves trough that was cut and bent to shape) is mounted on the base (here some scrap wood of appropriate height to mount the servo and to have sufficient slope that the candy will slide down the slope and out of the mouth. You'll need to do some planning here.
A piece of plastic conduit (here 3/4") is the reservoir for the candies, is mounted above the swing arm so that candies fall into the hole in the swing arm.
As the swing arm sweeps, it will push a candy into the trough and the back side of the swingarm keeps more candies from dispensing. When the swing arm returns to it's waiting position, the next candy falls into the hole, ready to be dispensed.
Your design may vary based on the size of your jack-o-lantern and the kind of candy you want to dispense.
Once you've tested your dispenser to your satisfaction, install it in the jack-o-lantern.
Step 4: Mount the Parts Inside the Jack-o-lantern
Mount the display, button, speaker, SR-04 and dispenser inside the case. I used hot glue.
You may wish to use small male-female terminal connectors to allow the different components to be connected/disconnected as needed. It may make installation easier as was my experience.
Step 5: Upload the Arduino Sketch
Open and save the jokeOLantern.ino file as a fresh project. Put the pitches.h file in the same project folder. It provides the pitches for the tunes played by the project.
Inside the sketch, you'll find a large character array that is the jokes and answers for the display. Add/delete/change as you like. You'll notice lots of blank lines. That's so the jokes are nicely spaced out in the display. There are 4 lines for the joke and 4 lines for the punchline. Make sure you keep the relationship of 4 and 4 if you want the array to work correctly. As provided, there are 12 jokes in the array. If you add/remove jokes, you'll need to change,
int msgNum = (int) random(12); to a different value to match the number of jokes.
Compile/upload the sketch. Load up your candy dispenser and start having Hallowe'en fun!
Participated in the
Halloween Contest 2019