Professional Documents
Culture Documents
by alexoort
As Halloween is right around the corner but coronavirus cases are rising throughout the world, I thought that it
would be useful to make a Jack-o'-lantern that drops candy whenever you get close to it, to avoid the usual human
contact during trick or treating.
To do this, I used an Arduino Nano, an ultrasonic sensor, a servo motor, and a 3D printed pumpkin!
Supplies:
Electronics:
Arduino Nano
Ultrasonic sensor
Servo motor
Jumper wires
3D printer & lament
Soldering iron
Spray paint
Hot glue gun
String/shoelace (optional)
Sandpaper
Drill with a wire brush (optional)
Cotton swab/toothpick
Instead of using an actual pumpkin, I decided to 3D There's also small rings at the top which will allow us
print one, as this would allow for the moving to hang it.
mechanism necessary for dropping the candy.
If you would like to modify the design, please go
I designed the Jack-o'-lantern using Tinkercad, and I ahead; however, keep in mind that the eyes have to be
have attached the STL les below. The Jack-o'-lantern 1cm apart and have a diameter of 1.6, or else the
consists of eyes, a nose, a mouth, as well as a lid at the ultrasonic sensor will not t. Also, make sure that the
top (to put in the candy) and a hinge at the bottom hinge mechanism will work in real life.
that should open whenever someone approaches.
https://www.instructables.com/ORIG/FW5/TCOE/KGXP40EV/FW5TCOEKGXP40EV.stl
View in 3D Download
https://www.instructables.com/ORIG/FOM/VSVL/KGXP40LZ/FOMVSVLKGXP40LZ.stl
View in 3D Download
https://www.instructables.com/ORIG/F73/Q19D/KGXP48FU/F73Q19DKGXP48FU.stl
For the 3D printing, I used the Ultimaker 2 from my also important to check whether you have enough
school, but you can use whichever printer you have lament on your spool, as each part of the pumpkin
available. However, make sure to adjust the slicer requires roughly 100 grams.
settings and enable support (this allows the printing
of overhangs), or else the print will fall apart while Once the printing has nished, you will have to
printing. I would also recommend printing the sides remove the support material. To do this, I used some
of the pumpkin as shown in the picture above, or else pliers, a knife and a screwdriver. Some support
the lament will not properly stick to the print bed. material could not be removed using this method, so I
used some sandpaper and a drill wire brush to
I decided to print the pumpkin in two parts, as this remove most of what was left. However, it's ne if your
would require less support material, and also make it pumpkin is not completely smooth since real
easier to attach the electronics inside. pumpkins aren't perfect either.
For my lament, I simply used grey PLA that I had Also, if you accidentally break the hinge on the
bought from Amazon. If you'd like though, you could pumpkin, do not worry at all; simply add some hot
also use orange lament so that you don't have to glue and stick it on again.
paint the parts later on. Before starting the print it is
In the loop, the trig (ping) pin is set to LOW, and Now you will want to upload the code to your
quickly after it is set to HIGH. The Arduino then Arduino. If you are using a Nano and you are having
measures the time it takes for the echo pin to receive problems uploading, go to Tools > Processor and
the ultrasonic wave, and stores this value in the select 328P (Old bootloader) on the Arduino IDE.
duration variable.
Download
https://www.instructables.com/ORIG/FIA/LNGI/KGXP3YLR/FIALNGIKGXP3YLR.ino
Step 6: Assembly
We're almost there! Now it's time to put everything Now that all of the necessary components are inside,
together. you can close o the pumpkin. Add hot glue to the
edge of one side of the pumpkin and then bring the
First, upload the code to the Arduino. Then, using hot two sides together until the glue has solidi ed. You
glue, stick the Arduino to the left side of the pumpkin will now want to place the small 'door' between the
(the one that has two teeth), and make sure that you three hinges on the pumpkin. Then, cut o the ends
don't cover the hole for the Servo motor cables. Pass of a cotton swab and insert it through the holes on
the USB cable for the Arduino through the square the hinges. Cut o the parts that stick out and then
hole (on the other side of the pumpkin) and connect it glue the ends of the swab to the hinge on the
to the Arduino. pumpkin, so that the door can still move freely.
Next, insert the ultrasonic sensor through one of the Glue the servo motor to the bottom of the pumpkin,
eyes on the pumpkin, so that they stick out on the so that the Servo horn (the 'pointer' on the Servo
outside, as shown in the picture above. Now connect motor) is aligned with the 'door' (as shown in the
the ultrasonic sensor to the Arduino. pictures above). To improve the opening-and-closing
mechanism, I added a resistor (you could use
Next, connect the repurposed USB cable to the Servo something else if you like) to the end of the horn and
motor's + and - pins. Now connect the ground (-) of then glued the resistor to the 'door', as shown.
the servo motor to the Arduino's ground. Finally,
connect the signal pin on the Servo motor to digital If you power up the servo motor and the Arduino, it
pin 9 (Make sure that you pass these cables through should work!
the small hole at the back of the pumpkin).
Woohoo! The Jack-O-Lantern itself is nished. Now In terms of candy, I used wrapped chewing gum, but
you just have to set it up. you could of course use other kinds of treats as well.
Before you buy a lot of candy though, make sure that
I decided to hang it from the beams on my porch, but it will t through the opening at the bottom of the
feel free to get creative. I powered both the Servo and pumpkin.
the Arduino with power banks, but you can also
power them from the wall, or your laptop. Alright, that should be it! Good luck!
https://youtu.be/bqFVJQitPzI