Introduction: Animated Pumpkin With Motion Sensor

We all know what happens when the Itsy Bitsy Spider bites a human.... Right?

For those who don't, this guy makes lots of movies and he always wins the girl.... e.g., Superman ;-)

What we don't know is what happens to a poor pumpkin sitting in the field under the sun waiting for Halloween to get carved...

...and the story begins. Enjoy!

You will need:

Supplies

    Tools:

    • 3D Printer
    • Solder iron & Soldering
    • Digital Multi-meter
    • Power Drill & Drill Bits
    • Razor Blade
    • Fine Tip Phillips Screwdriver
    • Fine Tip Flat Screwdriver
    • Long Nose Pliers
    • Craft Hot Glue Gun & Glue Sticks
    • Candle/Regular Lighter

    Step 1: The Boring 1st Step - 3D Print All Parts

    Inside the zip files that I have attached, you will find (hopefully) all the STL files for the parts and a text file with recommended settings & quantities for your 3D Slicer Software.

    I have printed all my parts with PLA, but if you are planning to let your cute pumpkin alone outside in direct sunlight or hot weather for a long time, then maybe you have to use ABS or other material instead, to avoid deformation because of heat.

    Step 2: You Have the Parts Ready.... Now What?!

    First begin by removing excessive material from the parts that have built-up during the printing process. Next, make sure the parts properly fit together (where applicable) and check for any imperfections, especially in vital components such as gears and joint levers.

    Everything looks good?....

    Great, lets start!

    !!!! ALL SERVOS MUST BE IN MIDDLE POSITION WHILE ASSEMBLING THE PARTS !!!!

    Step 2.1:The 6 non-mechanical legs

    Preparation

    Cut in half the 3ft green plant stakes (In this step we are going to use 6 of those 1,5ft rods).

    Supplies and tools

    • 6 1,5ft rods
    • 6 Non-mechanical joints
    • 6 #16 x 1-1/4 in. Stainless Wire Brads
    • Long nose pliers
    • Power drill & drill bits

    Assembly instructions

    Step 2.2: The mechanical joints for both front legs and fangs

    Preparation

    Warm-up the tubes/spacers for the fangs at 1/3 of the length and bend it ~45°

    Supplies and tools

    • 2 1,5ft rods
    • 2 Fang spacers
    • 2 Fangs
    • 4 Servo motors
    • 4 Mechanical joint sets (see parts in joint assembly video)
    • 4 #16 x 1-1/4 in. Stainless Wire Brads
    • 4 Small rubber bands
    • Self-Adhering elastic bandage
    • PVC & Super glue
    • Fine tip screwdriver
    • Long nose pliers
    • Razor blade
    • Lighter
    • Power drill & drill bits

    Assembly instructions - Joint / Front legs

    Assembly instructions - Fangs

    Step 2.3: Eyes mechanism

    Preparation

    Use the centering tool provided in the STL files to find and mark the center/radius point of the 4 plastic balls.

    Supplies and tools

    • 4 Plastic balls
    • 4 Servos
    • 4 Servo mount holder
    • 4 Eye main body
    • 4 PulleysFishing line
    • PVC & Super glue
    • Fine tip screwdriver
    • Long nose pliers
    • Razor blade
    • Lighter
    • Power drill & drill bits

    Assembly instructions

    Step 3: Attach Body Parts to Your Pumpkin

    Draw with pencil even vertical and horizontal lines to the pumpkin, this will help you to choose and mark the positions for body parts.

    Cut a big hole at the bottom and remove the excessive foam material, keep shell thickness to 4-5 cm.

    Bend the legs/rods with pliers to create the joints (see pictures)

    Make smaller in diameter holes than parts diameter and attach body parts (Make sure there is enough space between fangs for the mouth)

    Use PVC glue and attach the servo motor assembly from inside for both fangs and front legs.

    Step 4: Looks Cute! ....but Not for Long! - the MOUTH!

    Place the mouth between the fangs and warm up the plastic to follow the curve of the pumpkin. A good way to do that is to attach the upper part and work your way down to get a flush fit.

    Draw with pencil the outline of the mouth, remove the mouth and carved the excessive material about 2-3 cm deep.

    Make one small hole at the bottom for the LED's and paint the rest black

    Attach the mouth and paint the teeth and the lips (I used light beige for teeth and red for the lips)

    Paint the fangs green or any color you like

    Make the hole for the motion sensor but don't attach it yet. (I placed mine above the mouth)

    How it looks now?...

    How about to put some red inside the mouth, on the teeth and on the tip of the fangs?... make it look like blood..

    Step 5: From Now on You Working Alone... Everybody Think That Something Is Wrong With You! (especially Your Wife)

    Lets prepare the circuit.

    For this step you need:

      • 2 Male 40 Pin Header Connectors
      • 1 XL4015 Voltage Regulator Step Down
      • 1 Arduino Pro Micro
      • 1 SPST Snap-in ON-Off 2 pin round switch
      • 7 Breadboard female/female wires
      • 4 LED's (2 Yellow, 1 Red, 1 Blue)
      • 1 HC-SR501 PIR Infrared Sensor
      • 2 T Type 9V Battery Connector
      • 2 Alkaline 9V Batteries
      • WiresSolder iron & Soldering
      • Craft Hot Glue Gun & Glue Sticks
      • Soldering iron & Solder

      Step 5.1: Keep notes of everything*

      Grab a piece of paper and keep notes for the colors of the wires and what they are for.

      Step 5.2: Prepare the header connectors

      Cut in half the two 40 pin header connectors so you can get four 20 pin headers rows.

      Solder wires on two of those pin headers, one for +5V and the other for ground/negative (Pic.1 & 2).

      On the 3rd row attach 8 wires for the servos, 3 for the LED's (you need only 3 because the 2 yellow LED's are connected in parallel) and 1 for the motion sensor. Try group wires together by leaving space in between (Pic. 3).

      (As you can see in that picture I'm using more wires. I did that because I want to have more input/outputs available for future upgrades like having illuminated eyes, controlling relays for switching my front yard lights ON/OFF while motion is detected so I can make things more interesting... ;-) )

      Have the three headers side by side, THE +5V ROW IN THE MIDDLE, try keep them align and use the glue gun to glue everything together (Pic.4 & 5).

      Step 5.2: Test your soldering skills

      Solder the wires to the arduino on the following pins:

      8 Servo wires - 2,3,4,5,6,7,8,15

      3 LED wires - 9,10,16

      Motion sensor - A3

      Step 5.3: Power adjustment

      Attach both black wires from your T Type battery connectors to the Voltage regulator at "IN-".

      Next, both red wires to one of the pins of the on-off switch and from the other pin use a wire and go to "IN+" of your Voltage regulator

      Connect both batteries and turn on the switch, with your digital multi-meter connected to the output (OUT+, OUT-) adjust the blue potentiometer knob and monitor the output voltage to reach the required voltage (5.0 VDC).

      Turn off the switch and solder 2 new wires to pins VCC & GND of your Arduino.

      Connect the VCC wire from the Arduino and the +5V wire from the header connectors to the OUT+ of the voltage regulator.

      Do the same with GND wire and Ground/Negative to the OUT- Turn on the switch and follow the instructions bellow:

      Red light on Arduino = Move to the next step

      Red light only on voltage regulator = Check wires VCC and GND for correct polarity

      No lights, only smoke = Go to step 1 and order new parts

      Step 5.4: PIR Motion Sensor Adjustments

      Provide power to your PIR motion sensor by connecting it to +5V and Ground/Negative on header connectors with breadboard female/female wires (see picture with circuit diagram). With you digital multi-meter lids connected to Ground and on the output of the Sensor(middle pin) and adjust the time potentiometer so the output stays in high state (3.x V) for approximately 25 seconds after motion detection.

      (I know... a third hand some times is priceless).

      Set sensitivity potensiometer in the middle and attach the output of your sensor to pin A3 of the Arduino with one breadboard female/female wire.

      Step 5.5: The LED's

      LED = Light Emitting Diodes. That means they have polarity, so pay attention on that. The short terminal or the flat edge of the led is the negative.

      Follow the Circuit Diagram to connect all LED's together and don't forget the resistors.

      With glue gun, glue the LED's together side by side, keep the yellow's in the middle and attach 4 breadboard wires. 1 for common ground/negative and 3 for each color.

      Follow the circuit diagram and connect all wires with the Arduino.

      Step 6: Let's Find Your Limits..

      In this step we are going to find the motion limits for all the mechanical parts.

      Step 6.1: Arduino IDE & Motion Limits

      Download and install the Arduino IDE. Once you're ready, download the attached file "Servo Limits.ino" and open it with your Arduino IDE.

      Connect the Arduino board with your computer and attach one of the servos to pin 2. Be very careful with polarity, the brown cable from the servo goes to ground/negative header connectors row.

      (Since is only one servo connected you can make it work with your USB power, but it will be better to work with batteries too.)

      After choosing the correct board and serial port under "Tools" upload the sketch to your Arduino. Open the serial monitor "Tools -> Serial Monitor" and type in values from 10 to 170.

      Keep notes on what position the movement stops and the direction of that. (e.g. The motion range for the front left leg on mine is 65 up and 140 down)

      Follow the same procedure for all the servos one by one (keep in mind, connect servos only on pin 2 one by one and always power cycle the board after changing servo).



      Step 7: Bring It to Life...

      Go to https://github.com/netlabtoolkit/VarSpeedServo and download the VarSpeedServo library by clicking the green button "Clone or download" and then "Download ZIP".

      From your Arduino IDE go to, Sketch -> Include Library -> Include .ZIP Library, and select the VarSpeedServo-master.zip file.

      Download the attached sketch/code "Halloween Animated Pumpkin.ino" and open it with your Arduino IDE.

      I tried to keep the code as simple as possible so everybody can understand and modify based to their preferences.

      Step 7.1: Familiarize yourself with the code.

      The code is divided in 8 sections, in each section you will find instructions for most important functions.

      Section 1, here you can find which servo goes where on your Arduino board. Also on what pin to connect the LED's and the PIR Motion sensor.

      Section 2, everything in here executed only once every time you powering up the Arduino.

      Section 3, The "loop". As described by the name, things in here executed for "ever". here you can change the intervals between the "Stand-by actions". By default the interval time is set to 5 min (1500 x 200ms = 5') unless motion is detected. Every 200ms The code checks for motion detection. If motion is detected a random set of actions executed from Section 4. After 5 min without motion detection a random set of actions executed from Section 5.

      Section 4, 3 sets of actions that executed randomly only when motion is detected. Please check if servo's values are within your motion limits.

      Section 5, 6 sets of actions that executed randomly every 5 minutes if no motion is detected. Please check if servo's values are withing your motion limits.

      Section 6, Every time you call this function it creates a flame effect inside the mouth

      Section 7, Every time you call this function it creates a police lights effect inside the mouth

      Section 8, Moves all servos to initial position and detach them, in order to increase battery life.

      Step 7.2: Attach all servo's and upload sketch

      Based on the circuit diagram, connect all servo's with your Arduino. Pay attention for correct polarity

      Double check your code and upload it to your Arduino board.

      It's alive!!!

      You created a monster!!!

      Step 7.3: Secure everything in place

      Use the 3D printed "Mounting bracket" to secure Arduino and Batteries inside the pumpkin.

      I could do a better job with that, but hey... give me some credit here!

      I spent too much time on that project and I'm trying to save my marriage now!... :-)

      Step 8: Decorate Your Little Monster!

      Inside the STL files you can find the small and big leaf .stl. Print as many you like and use a lighter to warm up the plastic. Wrap it around the legs or the fangs and let it cool down.

      Now you can paint and decorate your pumpkin that way you like it...

      Step 9: No Matter Where Your Thump Is Pointing...

      ...I would like to read all your thoughts and suggestions about my project. Feel free to edit or even create your own Arduino sketch and please share it with us...

      Enjoy your creation and don't fall into temptation to put a bowl with treats on front of it. ;)

      The End.

      Thank you!

      Halloween Contest 2019

      Second Prize in the
      Halloween Contest 2019