Halloween is my favorite time of the year and what better way to spend it than creating animatronics with a Raspberry Pi to scare trick or treaters. This year I’m building a series of smart devices for my porch on Halloween. I’ve always wanted to build a zombie arm that jumps out as people walk by - and we’ll show you how to do it with a bit of pneumatics, a relay, and a Raspberry Pi.
What You’ll Need For This Project
- Raspberry Pi
- Pneumatic Air Cylinder (opens in new tab)
- 4 Way 12 V pneumatic control valve (opens in new tab)
- Two push-to-connect fittings compatible with your air cylinder (opens in new tab)
- Two push-to-connect fittings compatible with your control valve (opens in new tab)
- 12 volt power supply (opens in new tab)
- A relay module compatible with the Raspberry Pi (opens in new tab)
- At least 4 jumper cables
- 2 wire nuts or WAGO connectors (opens in new tab)
- A few feet of extra wiring suitable for a 12v circuit
- Air compressor and hose (or another source of compressed air)
- 1 male quick-connect pneumatic adapter (opens in new tab)
- A roll of PTFE tape (opens in new tab)
- A tool box with some basic tools, a drill, a hot glue gun
- A Halloween zombie arm or skeleton arm (I picked mine up from the dollar store)
- Wyze Cam V2 / V3 or Raspberry Pi camera
- Polyethylene tubing (opens in new tab)
How To Build a Zombie Arm for Halloween with a Raspberry Pi
1. Set up your Raspberry Pi. If you don’t know how to do this, check out our story on how to set up your Raspberry Pi for the first time or how to set up a headless Raspberry Pi (without monitor or keyboard).
2. Install git as necessary, and clone the repository to your Raspberry Pi.
cd ~/ sudo apt-get update && sudo apt-get -y install git git clone https://github.com/rydercalmdown/zombie_arm.git
3. Descend into the cloned repository and run the installation command to install all lower-level and python-based requirements for the project to work.
cd ~/zombie_arm make install
4. Attach your pneumatic control valve to a small piece of wood. This is entirely optional, but I like to have everything secure in one place.
5. Attach your relay module to a small piece of wood. Once again, this is entirely optional.
6. Wire the negative end of your 12v power supply together with two small strands of wire using a wire nut or WAGO connector.
7. Attach the two negative wires coming from the wire nut / WAGO connector to the left-most ports of channels 4 and 3 or your relay.
8. Attach a few inches of wire to each terminal of your pneumatic control valve; each end should have a positive and negative wire coming from it.
9. Attach the positive ends of both wires coming from the pneumatic control valve together with the positive end of the 12v power supply. You can use wire nuts or a WAGO connector to do this.
10. Attach the negative ends of the wires coming from the pneumatic control valve to the middle port of channels 4 and 3 of the relay.
11. Wire the 12v and ground pins from your relay to GPIO pins 4 and 6 on the Raspberry Pi.
12. Wire channels 4 and 3 from the relay to GPIO pins 8 and 10 on the Pi.
13. Attach 3 quick connect adapters to the ports on your pneumatic control valve, and 2 to the ports on your pneumatic cylinder.
14. Attach two polyethylene tubes from your pneumatic control valve to each end of your pneumatic cylinder.
15. Attach a source of compressed air to the input of your pneumatic control valve.
16. Test your system by using the manual push valves on the pneumatic control valve; the cylinder should actuate.
17. Drill a hole in your halloween zombie arm and hot glue it to the end of the cylinder.
18. Set up the Wyze camera or Raspberry Pi camera. For this project you can substitute a simple motion sensor, but I wanted to make use of person recognition to trigger the hand, so I’m using a Wyze Cam V2 (V3 also works) to handle the detection.
19. Flash the custom RTSP firmware to your Wyze camera using this tutorial (opens in new tab). Installing RTSP support allows us to connect to the camera and grab frames directly with Python.
20. Get the RTSP URL value from your Wyze application, and edit the RTSP_URL variable in the Makefile to point the Raspberry Pi to your camera. You can find the RTSP URL in the “Advanced Settings” section of your Wyze application on your phone.
nano Makefile # Edit the file with your RTSP URL from your camera RTSP_URL=rtsp://your_username:your_password@your_camera_ip/live
21. Plug in your 12 volt power supply.
22. Test the system by running the make run command. It should boot up and move the arm as a test to start, then only activate the arm when a person is detected. If your movements are backwards, reverse the two hoses going to the cylinder.
23. Mount your system in a place where it can scare friends and family.
The majority of these components are not waterproof, so mount them in a way that they’ll stay dry. In addition, a pneumatic cylinder can be a dangerous component depending on how much pressure it’s given. To stay safe, set your regulator to the smallest amount of pressure required to move the arm, and make sure the arm has plenty of room away from people. Happy Halloween!