How To Build A Smart Fog Machine with a Raspberry Pi
Make a Raspberry-Pi powered, person detecting fog machine
Halloween is upon us, and this year I'm building a series of smart Halloween decorations that are also Raspberry Pi projects. So far, I’ve created a Raspberry Pi-powered zombie arm that slaps guests and a person-following creepy head.
However, one of my all time favourite decorations is a fog machine. The only unfortunate thing about them is that they're analog. Now, with a bit of hacking, we're going to be connecting a fog machine to a Raspberry Pi, and activating it with person detection. This way, we only use fog juice when there are people close by. Here's how to get started.
What You’ll Need For This Project
- Raspberry Pi 4
- A relay module compatible with the Raspberry Pi
- At least 6 jumper cables
- A soldering iron and solder
- A fog machine with a remote control (I picked mine up from walmart)
- Wyze Cam V2 / V3 or Raspberry Pi camera
How To Build a Smart Fog Machine 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/smart_fog_machine.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 ~/smart_fog_machine
make install
4. Test your fog machine. Pressing the button once should cause the fog machine to turn on, pressing it again should cause it to turn off. Holding the button on my particular machine results in the same behavior as pressing it.
5. Remove the screws from the back of your remote and open up the back panel.
Stay On the Cutting Edge: Get the Tom's Hardware Newsletter
Get Tom's Hardware's best news and in-depth reviews, straight to your inbox.
6. Put the batteries in your remote if they are missing, and locate the solder points that are connected to the fog button.
7. Using a jumper cable, short the pins until you find the ones that cause the LED on the front of the remote to flash. In my case, that was the top right and bottom left pins when the remote is on its back and the IR LED is pointed upwards. If your remote doesn’t have a status LED on the front, you can view the activity of the IR LED with the front-facing camera on your phone.
8. Once the pins are found that activate the LED, solder two jumper wires onto them.
9. Create a hole for the jumper wires to exit the back of the case. I used my soldering iron to burn a small divot in the side of my remote.
10. Close up your remote and test it. The status LED should blink upon push of the button, as well as shorting the two jumper wires coming out from the case.
11. Connect the VCC pin of your relay to the BOARD pin #4 on your Raspberry Pi.
12. Connect the Ground pin to Raspberry Pi BOARD pin #6.
13. Connect the channel 4 pin of your relay to the Raspberry Pi BOARD pin #5.
14. Connect the two jumper wires coming from the remote to the common, and normally open ports of channel 4 of your relay. On my relay, these are the leftmost ports. You should not see your LED flash at this time.
15. Flash the custom RTSP firmware to your Wyze camera using this tutorial. Installing RTSP support allows us to connect to the camera and grab frames directly with Python.
16. 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
17. Test your system with the make run command. The LED should flash on your remote briefly as the system starts up and tests itself. It should also flash when a person is detected by the camera.
make run
18. Position the remote so it has a clear line of sight to your fog machine.
19. Plug in your fog machine, use the make run command, aim the camera at a person, and the fog machine in your desired direction, and enjoy!
make run
If you’re looking for more of a challenge, I’d recommend cloning the IR code with an IR receiver compatible with the Raspberry Pi, and retransmitting it with an IR LED. This was my original plan, but I unfortunately wasn’t able to get things functional on time - but there’s always next year! Happy Halloween!
Ryder Damer is a Freelance Writer for Tom's Hardware US covering Raspberry Pi projects and tutorials.
-
vinay2070 This fogger machine on its own would definitely be useful to see how air is circulting in a closed cabinet with glass panel and configure the front/rare/top fan speed individually so there are no hot spots.Reply -
anscarlett Seems a bit convoluted, why not mount the pi directly in the fog machine and bypass the remote part?Reply -
anscarlett
It's likely that having multiple fans would be causing hot spots, just remove all but one plane of fans and leave the opposite end ventedvinay2070 said:This fogger machine on its own would definitely be useful to see how air is circulting in a closed cabinet with glass panel and configure the front/rare/top fan speed individually so there are no hot spots. -
anscarlett
I bought some ultrasonic atomisers from aliexpress, they create a mist from plain water and can be powered from usb power banks.Admin said:Waste no more fog juice and use a Raspberry Pi to activate your fog machine when people are detected.
How To Build A Smart Fog Machine with a Raspberry Pi : Read more -
wittrup Recently did similar stuff, modifying my fog machine to be controlled by an Arduino.Reply
Still have not quite figured out the PEM7D IR photoelectric beam sensor, but working on it.