Automated Singing Pumpkins

673

9

21

This year's automated singing Pumpkin display.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Introduction

This halloween prop is a motion activated projection of three singing pumpkins. When triggered a talking pirate skull is activated with a fog machine giving 20 second blast of fog! Then the projection starts. There are two alternating songs - Monster Mash and Thriller. After the the song has finished there is another blast of fog. If the sensor has not been activated in a about 15 minutes the fog machine will give a blast.

To make the prop I used an off the shelf pirate skull that no longer activates at night. It works in really bright light but not at night when you want it too. Luckily it has a test switch. I wired this to a relay which is driven by my Python script on a Raspberry Pi. I also connect the fog machine to another relay on the Pi. The video output from the Pi is sent to a small video projector. It projects the singing pumpkins on to three actual pumpkins. I used plastic ones this year as I wanted to give the illusion that they were floating. Regular pumpkins are bit too heavy, so I used the cheap plastic store bought ones. The are held in place by using bent coat hangers glued into a 2x4 niche base and sprayed black. All the electronics and projector and speakers are hidden behind a grave stone I created out of MDF and sprayed with primer and a stone textured finish. The PIR is placed in the top of the carving like a jewel.

Step 2: Parts -Electronics

For this project I used a Raspberry Pi Zero W, a PIR, and 2 relay modules. Examples of the parts are listed below:

Relay: https://www.amazon.com/Tolako-Arduino-Indicator-C...

I used two, but you can buy double, triple, quad etc., relay boards .

Raspberry Pi Zero W: https://www.adafruit.com/product/3400

I chose the Zero Pi W because it's small enough and has wifi built in. You will need keyboard, monitor and power supply to get up and running. You could use the projector as the monitor if you can read the text etc.. One thing I like about the wifi connection is that I can stop and start it remotely from a terminal program on my phone or iPad.

PIR: https://www.amazon.com/DIYmall-HC-SR501-Motion-Se...

Yes I know they sell 5, but that's the same price as one everywhere else I looked. Plus sometimes these can be broken, so by having 5 some should work. All mine worked. You have to let them get stabilized before using them. If you try to use one out of the packet you will get that it is always on. Wait 5 minutes before testing. That worked for me.

Projector: I bought this from Woot many years ago, but there are all sorts of projectors for sale ranging from $50 and up... As my projector is old I needed an HDMI to VGA adapter (https://www.adafruit.com/product/3048 ) . The modern projectors have HDMI in. Also make sure you know what size HDMI cable you need from the Pi. The Pi zero uses the mini HDMI. You can by a mini to regular HDMI connector. which is recommended for use with a Pi Zero.

Step 3: Parts - Non-electronic

Fog Machine with a remote control:The remote control on mine is not very sophisticated, there is one button that calls for fog. Depending on your fog machine you need to be able put a wires on the "call for fog" button. These wires got to the N/O contacts of the relay. Then when the relay activates it as though you pressed the button. My remote has high ( AC ) voltage in it. SO BE CAREFUL HOW YOU WIRE YOUR FOG SWITCH. Some of the new ones may be low voltage. If in doubt get help or don't do wire it up! I'm not supplying a diagram as your machine may vary. A ground fogger might be better if you have one. I passed the fogger output through a polystyrene cooler filled with ice. This did chill the fog a bit, but not as much as I'd have liked. Next year dry ice!

Pirate Skull: I bought this from a Halloween pop up store one year and I'm sure they are still available. Any prop will do that has a demo or test button. This prop is battery powered so wiring across the switch to the relay should not be a problem. But once again if doubt ask.

Grave stone: There are plenty of the polystyrene ones on sale at the stores. However, I wanted a more robust one so I could hide the electronics and have the sensor in the headstone. But you can be creative. You could embed the sensor in another pumpkin.

Coat hangers and scrap wood: To create a stand so the pumpkins look to be suspended above the ground. Also a glue gun, tape and assorted screws. I spray painted the wood and coat hangers matte black to hide them at night.

Pumpkins: Real or store bought as long as you can focus an image on them. You don't have to carve the real ones!

Animated Singing Pumpkins: There are many available on the web and Youtube but I bought the Thriller one from here:

http://www.themightymicroscope.com/windowcreeps/

You have also to buy the audio track and edit them together, but that is for another instructable...

Case for electronics: I 3D printed one from here:

https://www.thingiverse.com/thing:1167846

Power cords: Here's the list of my power connections:

  1. Wall wart for the Pi
  2. Projector
  3. Powered Speakers
  4. Fog machine

I used an extension cord from the garage and then a multi-output extension.

Software: The Raspberry Pi will need an operating system and there are plenty of instructables and assistance on setting up a Pi. https://www.raspberrypi.org

I wrote this Python code after reading other projects on the web who had created similar set ups, The main routine waits for the sensor to activate, then switches on the pirate, the fog machine and then the projected animation. At the end of the song, more fog and then wait for the sensor again. I had two animations so the code switches between them. I also logged the songs played to a file so I could check on activity if I wasn't there. I posted two versions of the code 1) It just plays videos - no relay control

2) Plays video, has relay control (4) and an optional parameter "-r". (Software technical note: This is for relay boards that use a GPIO 0 to turn on instead of a 1). If you connect your relay board and run the program and all the relays turn on, then stop the program and retype with the -r option to the command:

sudo python Halloween_Control.py -r

Please read the READ.ME file on the code download page. It can be downloaded from here:

Basic code is here, just click!

Step 4: Set Up

The two main steps are setting up the Raspberry pi and the script and setting up the prop. There is more information on the GitHub page on wiring up the props. I have enclosed a Fritzing diagram of my two relay set up that matches the Python code. However, if you're familiar with the Pi and coding you can change pin connections, add more relays etc...

The next step is installing it in the garden or wherever you want to scare, sorry impress the trick-or-treaters. I chose the space between our garage and house. I had another projector screening floating phantoms as a back drop. This also made wiring everything up easier and making sure no trick-or-reater would not trip over anything.

Once everything is in place and wired I remotely log into the Raspberry Pi and start of the code. I did create an auto running one for a friend as he wanted it totally autonomous. I wanted more control. Plus I could tweak any timings etc.. For example this year I didn't have the pumpkins lined up so both animations played squarely on the surface. So I changed the code just to play the Thriller video this year. (Since edited the Monster Mash video so the pumpkins heads line up with the Thriller heads.)

Step 5: Summary

Only down side this year was that we had only one trick or treater and we forgot to take a video of the set up! Now's a good time to check out the sales at these pop up Halloween stores. You might snag something that can be used next year! For me it's make a still of the videos so I can line up the pumpkins better than having to play the video during set up. Work on the ground fogger and see what else I can add via another relay connected to the Pi!

Halloween Contest 2017

Participated in the
Halloween Contest 2017

Be the First to Share

    Recommendations

    • Made with Math Contest

      Made with Math Contest
    • Cardboard Speed Challenge

      Cardboard Speed Challenge
    • Multi-Discipline Contest

      Multi-Discipline Contest

    21 Discussions

    None
    aliosullivanukrobboz4

    Reply 3 months ago

    thanks i have downloaded & followed the instruction but i keep getting this error in the raspberry pi terminal below ...
    IndentationError: unindent does not match any outer indentation level
    any ideas ? thanks

    None
    robboz4aliosullivanuk

    Reply 3 months ago

    Yes it's probably an issue with Python and mixing tabs and spaces for indenting. Not sure how you feel about fixing code, but you could try looking at the code with a text editor to display hidden characters and fix it that way. But I'll have a look myself to see what I did. It is working fine on an old installed version, but I haven't updated the Pi OS or python for a while. I had this happen to me on another project switching from Python2 to Python3 so will go back and look.
    I'm building one for a friend right now so this will be a good time to fix it.
    Do you know what version of Python you have?

    If you want you can download this script I wrote to capture all the information:

    https://gitlab.com/robboz4/PiDiag

    then send me the output.

    It might be a couple of days before I post a fix.

    Cheers

    None
    robboz4robboz4

    Reply 3 months ago

    Try this link:


    https://gitlab.com/robboz4/instructable_code/tree/...

    It turns out I had added support for an 8 Channel relay board and other functions
    to my original project, but forgot to update the instructable. The above link is the basic code described in the article. There should be no indent errors anymore. Just make sure to get the PIR and relays on the correct GPIO pins.

    Have fun!

    None
    aliosullivanukrobboz4

    Reply 3 months ago

    Hi mate thanks for the reply , I currently have a raspberry pi 4 running Raspbian Buster
    I have a 4 channel relay board & standard pir

    None
    aliosullivanukaliosullivanuk

    Reply 3 months ago

    hi
    i have this code working correctly now thanks, gpio pir is set but no relay values , do we input these ourselves ? thanks

    None
    robboz4aliosullivanuk

    Reply 3 months ago

    Oh the joys of getting old! The code I posted didn't have the relay GPIO pins in! Argh!!!
    Let me go back to the code and get the relay added. I''ll add 4 relays for you and let you know the pins. Might take a couple of days. Stay tuned.

    None
    aliosullivanukrobboz4

    Reply 2 months ago

    Hi thanks for the code , i did try this but i now keep getting the error below when going to run ..... think i have missed something lol t.

    File "/home/pi/Desktop/Halloween_Control.py", line 106
    if File_to_play == 1:
    ^
    TabError: inconsistent use of tabs and spaces in indentation
    >>>

    None
    robboz4aliosullivanuk

    Reply 2 months ago

    Ok you should be good to go now. Worked out all the spaces/ tabs issues. There could still be a slight wrinkle on the relays though. If they all come on when the program starts, use the NC output pins on the relays. I’m working on a parameter to pass in if this happens. It seems some relays want a 0 to operate and others a 1! But the NC outputs should work... thanks for the patience and extra testing! Use the previous link for the code.

    None
    aliosullivanukrobboz4

    Reply 2 months ago

    Hi thanks for the update , i think it may possibly be an issue with my pi v4 as the Mu IDE keeps giving me a syntax error when i check it & try to play it in terminal also in the Mu editor i get this error below still even when i cahge the code or delete the line of code it says is incorrect it moves the error to the next line of code. strange lol

    File "/home/pi/my_python/Halloween_Control (1).py", line 107
    if (File_to_play == 1):
    ^
    TabError: inconsistent use of tabs and spaces in indentation
    >>>

    Screen Shot 2019-07-30 at 18.25.25.pngScreen Shot 2019-07-30 at 18.26.15.png
    None
    robboz4aliosullivanuk

    Reply 2 months ago

    Totally weird as the code I was running I just uploaded to gitlab. I’ll look a the Mu editor issue as it might be I have to remove all space and put in tabs. The error could be a few lines up or an invisible character (newline or something) has got in the code and the editor is trying to parse it. Try downloading the code again, but do not open it in an editor. Just try running it on the Pi from command line. I can see I will have to invest in Pi 4 or you will have buy Pi Zero :-)

    None
    aliosullivanukrobboz4

    Reply 2 months ago

    hi mate i tried it straight into terminal & it still says the same error , ill have a play around with it tonight :) thanks .

    None
    aliosullivanukaliosullivanuk

    Reply 2 months ago

    ok so i got the code working mate , it was an issue for my python so i changed it to this & it worked (File_to_play == 1): i had taken the spaces out of this .... if File_to_play == 1: also i see what you mean the relays come on & stay on constantly , i will further test this tonight :)

    None
    robboz4aliosullivanuk

    Reply 2 months ago

    Thanks for the fix, but no idea why that fixes it as a few lines further up there is a an "if.." statement without the "()". Anyway I have uploaded a new version that actually passed Mu, and has been running on my Zero for several hours. There is also a "-r" option now that will make the relays work the normal way. Please download the latest and this time you should be good to go.

    None
    robboz4aliosullivanuk

    Reply 2 months ago

    Weird! The code is running fine and all I did was upload it. But will check tomorrow. Hopefully I’ll have you up running before Halloween!

    None
    aliosullivanukrobboz4

    Reply 2 months ago

    awesome mate thanks , will give this a go this week , thanks

    None
    Swansong

    1 year ago

    Oooh, I love this idea! I'd really love to set up some interactive pumpkins next year. :)

    1 reply