Automated Fog Machine
Welcome to a spooktacular engineering journey where we will build the best and most over-engineered fog machine together. Whether your goal is to beat that one annoying neighbor or create the scariest haunted house on the block, this project is an absolute necessity. By integrating ESP32 development boards running off of the ESP-NOW protocol, this system will allow for seamless wireless control, external sensor integration to trigger on factors like motion or light, and automated timed loops. With just a few modifications, this easily integrated design will allow almost any basic fog machine to out perform any other fog machine on the market. In this instructable I will show you how to modify a fog machine's existing wireless controller to accept signals from an ESP32 and single channel relay. On top of that, I will also make and test a few wireless trigger mechanisms to inspire your creativity. So stick along for the journey as we embark on a quest to make the most over-engineered fog machine you have ever seen.
Supplies
Supplies/Parts:
DC-DC boost module - https://tinyurl.com/bdsus83t
Rocker switch - https://tinyurl.com/tfacx86j
5v relay - https://tinyurl.com/57dpbmn8
TP4056 charge protector - https://tinyurl.com/y9a7sbf9
AM312 PIR sensor - https://tinyurl.com/5n85rw32
ESP32 Dev Kit - https://tinyurl.com/y36ucsym
XIAO ESP32 C6 - https://tinyurl.com/mryth223
1s LIPO batteries - https://tinyurl.com/5hdpyn5b
Jst PH battery connectors - https://tinyurl.com/3497mcaw
Fog Machine - https://tinyurl.com/mr7adx87
Fog Juice - https://tinyurl.com/yuk7be3p
M3 and M2 heat set inserts - https://tinyurl.com/2zdr9epd
M3 and M2 bolts - https://tinyurl.com/4duf6pba
18 awg wire (stranded)
24 awg wire (stranded)
Tools:
Soldering Iron
Heat set insert tool + tips
Solder
Wire Strippers
Helping hands (optional but very helpful)
Computer
3d Printer
3d Print Parts
Our first step is going to be 3d printing our housings. We will have the main controller housing and then a motion sensor housing. For all of the prints, I printed them in PETG, if you don't have PETG any other filament you have on hand is fine. I just chose PETG because its a bit stronger than PLA but still relatively easy to print with.
Print settings:
Layer height - 0.2mm
Wall count - 3
Infill - 10%
Support - Tree Hybrid
Prep
Okay before we start wiring and assembling our controller and motion sensor, we will need to make sure we have done a few things. Firstly, open the back cover of our fog machine remote by removing the 4 screws holding the cover on. Pictures 1 and 2. Next, get two 18awg wires screwed into our relays COM and NO ports. Picture 3. These two wires will attach to the two pads on the circuit board circled in picture 2. Once our parts are done printing, we can take them off the printer and install some heat set inserts. M3 inserts will be in the 4 posts on the right wall in picture 4 and M2 inserts will be in the two posts on the base of the housing in picture 4. For our motion sensor housing we will just have two M2 inserts in the two posts on the base of the housing as seen in picture 5.
Wiring
Next we can go ahead and start wiring. Key note however when you reach the step for soldering your boost converter to your ESP32 on both the fog machine controller and motion sensor, make sure you set the converters to an output of 5v. If you don't do this, you risk frying your board. My apologies for picture 3, I forgot to add in a switch to shut off the circuit so when you are wiring up the fog machine controller just add a switch where the red line is in the picture. Pictures 1 and 2 are correctly drawn, so use those as a guide. The other pictures are simply for visual reference. For both your fog machine controller and motion sensor, mount your switch inside of the housing first and then solder on your wires to the switch. If you don't do it in this order, you will NOT be able to mount your switches. Same will go for the PIR sensors, only wire them up when they are mounted to the housing. So for now where the switches and PIR sensor would go, just leave the wires unconnected. I have also included drawings of both circuits above with additional pictures of the process for reference. If you have any other questions please feel free to leave a comment and I will try to respond in a timely manner. Picture 3 and 4 are good stopping point to go ahead and connect the LIPO battery and trim the boost converter to 5v with a multimeter. Once the boost converters are trimmed to the correct voltage you can go ahead and start wiring the entire circuit together. Then picture 5 is what the fog machine controller will look like when done. Note, once again the circuit is missing the switch so on yours just ensure you have the gap in the negative wire between the charge protector and boost converter. Picture 6 is what the motion sensor circuit will look like once fully wired up. Excluding the PIR sensor and rocker switch.
Assembly
We will first assemble the fog machine controller and then the motion sensor. To begin, thread the wires coming from the COM and NO ports of the relay through the bottom of the housing and solder the wires to the fog machine controller as shown in picture 1. Once those wires have been soldered you can go ahead and take the 4 screws we unscrewed from the back cover and bolt down the main housing through the 4 holes in each corner of the housing. Now that our housing is secured we can bolt in our components. The relay bolts onto the 4 posts on the wall using M3 bolts, the charge protecter and Xiao ESP32 will both drop into their respective spots in the base. After the two boards have been placed in their little cutouts, place the fog machine controller board brace over the two boards and secure it using two M2 bolts on both sides of the brace. Once all assembled, the wiring should look similar to picture 2 and the battery will drop into the slot on the wall at the bottom of the picture. Lastly, when the motion sensor is fully assembled, it should look similar to picture 3.
Coding
Okay we have reached the last step. We now have our fully assembled system. If the pin numbering was followed for both of the ESP32s then there is only a few things that will need to be changed in the code. If pin numbers were not followed then make sure to change each pin number in the code too. When you open the code in Arduino IDE or chosen software, you will need to change your FOG PASSWORD, OTA PASSWORD, and SSIS of the WIFI network if desired. If you want to keep the generic name "Fog Machine" you do not need to change the SSID. This will go for both pieces of code, the Motion sensor and Fog Control. However, make sure that the FOG PASSWORD and SSID on both pieces of code are identical. There are also notes in the code that can help guide you in the event you get confused. Above is the code that will need to be changed.
Downloads
Conclusion
Well there you have it! A working motion activated fog machine. As sad as it is that our spooktacular engineering journey together is coming to an end, your journey doesn't have to. You can keep tinkering with this machine and that’s exactly how I designed it to be. You can go ahead and play around with different types of sensors to trigger the fog and have an amazing fog machine! Before you leave, let’s just talk about some of the features of this machine. Firstly, you can control it straight from your phone. The ESP32 creates its own WIFI network that you are able to sign onto and open up the control dashboard. On this dash board you can do a few things, directly control on/off and 3sec/10sec bursts. You can set it on a timer so for example, I want it to run once every 5 minutes for 3 hours and then stop that cycle for 2 hours and then start that cycle again after 2 hours passes. Lastly, you are also able to Arm and Disarm the motion sensor if you decide you want the sensor to work or not. That concludes this amazing journey. Till next time you spooktacular engineer! Keep building!