Halloween Pop-Up Prop
This was my first animated Halloween prop. I found this witch at the local hardware store. It was meant to hang up by a cord and if someone came close to it, an infrared sensor would trigger the prop. The prop has LED eyes that would light up and it would trigger a voice tract that also moved the jaw. I thought it would be cool to mount it to a pneumatic cylinder and make it pop up from hidden location, giving the kiddo's a scare!
Off to my prop hack!
Supplies
Hardware:
- Halloween Prop (1) - See notes
- Pneumatic Cylinder, MAL20X600 (1) 20X600mm Double Acting , 20mm Bore, 600mm Stroke
- Zinc-plated slotted Angle bar (4) 1-3/8" x 18" Everbuilt, 1/16" thick
- Zinc-plated punched flat bar (1) 1-3/8" x 29" Everbuilt, 1/16" thick
- Zinc-plated square slotted tube (1) 1x1" x 18", Everbuilt, 1/16" thick
- Hex Bolts (AR) 1/4"
- Washers (AR) 1/4"
- Nuts (AR) 1/4"
- witch_bracket1 (1) 3-D printed part
- witch_bracket2 (1) 3-D printed part
- halloween bracket (1) 3-D printed part
- 4-strand wire (AR) 5VDC, GND, Switch1, Switch2
Electronics:
- Sainsmart 8-Relay board (1)
- Arduino Nano Every (1)
- Solenoid Switch (1)
- 1/4" pneumatic hose (AR)
- Particle Photon (1)
- 5VDC power Supply (1) 10 A (or AR) Used for all electronics and remote devices
- 12VDC power supply (1) 1A (or AR) Used for the solenoid drive
Prop Hack!
First thing is to make up the frame to hold the pneumatic cylinder. I went to the local hardware store and got some perforated angle iron so I could cut to size and bolt together.
I used some 1-1/2 in. Zinc-Plated Slotted Angle stock cut to approximately 18 inches long. I overlapped the edges and bolted together to make the base. I then had a square tube for the pneumatic mount, bolted through the center of the square base. Using a square brace would be a bit more solid and stiffer for the cylinder.
I then bolted my pneumatic piston just forward to the center of the square tube. I needed a way to stabilize the top of the piston, so I made up a 3D Printed part that bolts to the top of the piston. I made a tabs at 90 deg. One tab attached to a cross brace to hold the piston vertical. The second one was for additional support. I did find, that only one brace worked just fine. You might see how I slanted the piston a bit forward. This worked better when he prop jumped out of the window well, it actually lets the prop jump a bit forward toward the kids and leans slightly over the edge of the window well. The cylinder piston rotates freely and by having it slanted slightly allows gravity to keep the prop facing forward. Experiment with this and adjust as you go.
Mount the Prop to the Piston Shaft
I needed a method to mount the prop to the piston. The piston has a threaded end and I found a wing nut so that I could easily disassemble the prop for storage. The Witch head had two circular tabs that extended down from the electronics box that is attached below the head. I designed up a part to fit over the tabs and a plate to go over the threaded end of the piston and tightened down with the wing nut. I went back to my trusty 3D printer and printed it up! Dang I love that thing.
Downloads
PIR Sensor
I use a simple PIR sensor (HC-SR501). This is a very cheap sensor that is widely used. Lots of on-line information on how to use this and how to use with an Arduino. The field of view is very wide. One could adjust the sensitivities but I needed something that would have a very narrow field of view so that it would only trigger when someone passes directly in path of it. You can experiment with the sensitivity so that it works as you like. The output timing is how long the output pulse lasts. I kept it pretty short, long enough for my micro controller and code loop to detect an event. It is a pretty long length of wire, but it seems to work OK.
So I came up with a sensor assembly that I can mass produce and use for all my Halloween props.
PIR Sensor Assembly
The assembled cap is placed on the end of a 6” length of 2” black PVC pipe so that the PIR has a very narrow field of view. The end of the cap also has a hole in the back for the +5VDC, GND and PIR Detect cable. I made up my own connector where one end plugs into the PIR 3-pin header and the other end is a JST-SM type 3-pin connector (no reason, I just had a few of those hanging around).
Finished Sensor
I also 3D printed a clamp and legs so I can set the sensor in the best location. I used wing nuts to quickly adjust the legs and clamp as needed.
The sensor is positioned in such a way that when the trick or treaters approach it kicks off the animations just at the right time automatically. The PIR Sensor is connected through a long-shielded cable to the master controller, which I hide in my garage along with my air compressor.
Schematics and the Circuits
Now that you have your personal touches added, you need a way to make it come to life!
As I mentioned previously, I have several other animated props other than this one. I won't go over all the the others, but here is the link:
The Knight Halloween Instructable goes into much more detail on the overall master controller, how I distribute power out to each prop as well. I will focus mainly on the microcontroller and code for this prop.
The picture here is the primary schematic for the controller for this prop. The schematics on power distribution, switches and the Particle Photon control is in the main Halloween page.
In this example, you need a smart device to run some code, like an Arduino. In this implementation I used a Arduino Nano Every. Not shown in this schematic I have a Particle Photon I use for remote control of all my props. The Particle Photon has an Arduino compatible microcontroller and also includes a Wi-Fi transceiver so you can control the whole thing anywhere using my phone, pad or PC. I also used a relay board to control the prop on/off as well as activating the pneumatic piston.
The prop out of the box has several ways to start the animation. One is a push button "Try Me" for display demos (you see that in the store displays). It also has a jack for a remote pad switch. The last is an IR sensor built into the prop that will trigger if someone comes close.
The electronics box has a switch: OFF or Try Me/Pad, On (runs all the time) and AUTO. Off is off (duh) or only starts if the switch is closed. ON cycles through the animation continuously. AUTO uses the IR sensor installed onto the prop. I removed the try-me switch and Sensor. I use the switch in the the OFF or Try Me/Pad selection. I fed that long two-wire cable I made earlier out to my controller so that I can remotely start the prop. By shorting those wires through a relay, it acts as a switch and the animation starts.
Schematic Walk Through
Back to the schematic......
For this prop I used two relays. One to start the animation (switch) and another for the pneumatic solenoid to drive the piston.
My solenoid requires12 VDC to drive the coil which I run that through the relay board. When not driven the solenoid is in the Port A position (piston retracted). When I close the relay 12VDC drives the solenoid and it switches to port B. I must keep this activated until the animation sequence completes. My Knights Halloween page has a pneumatics overview on how all that works.
The Arduino controller has three inputs. There is an Enable input, which is connected to a switch and used to enable or disable the prop locally. Another input is Witch_Start. This is a signal from the Particle Proton. Another input is a Passive Infrared (PIR) sensor (PIR A). The PIR sensor detects when someone comes close to the prop. I have a bit more on my sensor later.
The Nano is programmed to first check if the prop is enabled (the local switch), if not it returns to the start loop and will continue looping until I enable it. If enabled, it then checks to see if it is being remotely commanded to start (Witch_Start) from the Photon. If so, it initiates the animation cycle, if not it continues and then checks to see if the PIR sensor (PIR A) detected someone. If not, it returns to the loop and continues until something happens. I'll go through this in the code walk-through. The Nano has two outputs, one triggers a relay to enable a solenoid connected to a compressor. The solenoid is connected to the pneumatic cylinder that pops up to make the prop jump out from a window well (that I also fill with fog). The other output is a signal that is transmitted to the prop to start its animation cycle.
I have lots of schematics, might be hard to go back and forth - but don't worry, I have the entire set later on for download, so bear with me.
Code Walk-Through
The attached is the full code for controlling this prop using all the devices described on my main page.
As I mentioned I have a master controller, along with the pneumatic solenoids and air compressor located in my garage that controls the whole thing. I'm going to mainly focus on the code for this prop.
The Arduino Nano code starts off defining the digital pins followed by defined variables. Not only do I define the variables I preset them to initial values so animation doesn’t start once the loop begins.
The next section sets up and defines the digital pins as inputs or outputs and whether they need pull-up.
Downloads
Define Pins
Here I define the pins and inputs or outputs.
Loop() Function
The first thing I do is digitally read the enablePin, sensePin and manualStart inputs and place those values into the variables enableOn, sensed and popup. The first thing I check is if the prop is enabled (enableOn == HIGH). If not, continue to loop until it’s enabled. If enabled, the next check is if the sensePin is enabled (stored in the variable sensed). This external signal is from the PIR sensor to detect if someone approaches the prop. If a person is detected it calls the animate() function which starts the prop animation. If it is not detected, we lastly check if there is a manual start coming from the Proton through the BLYNK app on my iPhone or Tablet. If actived, we again initiate the animate() function.
The BLYNK app allows me to manually start the props from where ever I am. In the house, across the country - doesn't matter. This app is WAY simple so I did not have to attempt any iPhone coding or GUI - this app has it all and has a simple GUI. I made up a bunch of GUI buttons for each prop. I might also say it's free, for small projects and private use. Lets walk through the animate() function.
Animate() Function
The animate() function first turns on the on board LED on the Arduino Nano to let me know when the animation sequence has started.
Once I turned on the Arduino on-board LED, I set the output to enable the Relay board to close (relayPin1, LOW) which enables the solenoid which initiates the scissor pneumatic cylinder and the prop jumps out! The next step is a fixed delay constant (delay) that is pre-set to allow the pop-up to initiate before I start the animation. I wanted delay the prop from lighting and up and starting is voice track until it is just starting to rise up. You can tweak this constant to get the right effect. The next step is setting the output to enable the second relay board to close (relayPin2, LOW) which enables the prop animation. I put a short delay (100mS) which is just a short pulse so that the prop only initiates one animation sequence. I then immediately set the output to the relay board to close (relayPin2, HIGH). We then hit another constant delay (event_done). This constant is adjusted to last as long as the longest prop animation. Some of these things have random sayings, so run through them all and time it so they all finish before restarting the code cycle. Once that delay is complete, the whole thing is done and time to reset and get ready for the next event. Once event_done times out, I set the output to the relay board to close (relayPin2, HIGH). Hmmm... Probably don't need that line since I already set it previously, doesn't hurt anything (Rev B on it's way!). I then set the output to disable the Relay board to open (relayPin1, HIGH). That now switches the solenoid to the other position which now retracts the scissor. I also turn off the Arduino on-board LED. The code now returns to the main loop and waits for the next event.
Part and Files
Here are some of the 3-D printed parts. I also included the entire schematic of my Halloween Master Controller and schematics for some of my props. For this project focus on page ! the Witch Pop Up.