This project came about when Andy was chatting with his friend Andrew about Halloween. He wanted to know how easy it was to trigger effects from the motion of people passing by. He mentioned that he'd been experimenting with radar-based human presence detection modules. In this episode, Andy embarks on a Halloween-inspired engineering adventure. Smoke machines are a staple when it comes to setting up a spooky atmosphere, so why not reverse-engineer one? However, before delving into the circuitry, Andy emphasizes the importance of safety when dealing with smoke machines, highlighting the risks associated with their heaters and mains voltages.
The effect to trigger was a smoke machine. Smoke machines are inexpensive and because he's going to be taking it apart, it made sense to get a new one rather than break Andrew’s only one. One thing that stood out in the manual was the warning that the remote control button had mains level voltages, 240v AC in the UK. He thought it was a bit strange and knew it could add challenges to the project, particularly around safety.
After ensuring the machine is safely powered down, Andy carefully dissects it, revealing its inner components. He uncovers a simple control box with LEDs and a button, which seem to be a system for disabling the button when the machine is not properly warmed up. The machine itself houses a pump, heating element, and temperature sensor, which he reverse-engineers in order to devise a method for automating the process. The goal is to trigger the smoke machine automatically when it detects a human presence via motion sensor.
To replace the remote control, Andy designs a custom control circuit, which includes added protection measures. He incorporates components like a relay, opto-isolator, RC snubber, and MOV varistor to ensure reliable operation and prevent interference. The inclusion of TVS diodes and a PTC fuse on the input side enhances safety.
When he took it apart to see the electronics, the main thing he noticed was that there were hardly any components. The control box consisted of a PCB with two LEDs and one button. Three wires headed back to the unit. The LEDs turn on when the heater is up to temperature. He's seen this kind of thing with welders where it is called "Duty Cycle"; you can only run the system for a period of time before you need to let it take a break. In this case, he suspected the smoke cools the heater and it needs time to warm up again.
In the smoke machine were small devices that appeared to be a pump, heating element, and some kind of temperature sensor. The rest of the box was empty, apart from a space for the bottle of smoke liquid. The temperature sensor turned out to be a simple bimetallic strip, which opened a switch when it reached the desired temperature.
The thing he's found with these really simple designs is that they can often be tuned to the components they have; this is an important factor when swapping in automation circuitry.
For the switch, he installed a relay contact, and for the LED, he used an opto-coupler. He had initially used an opto-coupler to drive the relay, but when testing, he found that needed quite a bit of current to activate. He swapped it for a TIP31C transistor, which worked reliably. It required a bit of reworking of the board, but conveniently the transistor fit in the holes left by the opto-coupler.
To prevent radio interference when the relay was activated, I added an "RC snubber", a component that resembles a large capacitor, but also contains a small resistance. This stops clicks and pops in the radio or mobile when the contacts make or break. It is important to get a device that is rated for 240V. On top of this, I added an MOV (or varistor), which suppresses spikes and prevents the relay contacts from welding shut if there is a high current due to an inductive load such as a motor, or in this case, a pump.
On the input side, He decided to add protection too. He added some TVS diodes to ensure that the voltage across the LEDs does not get too high. Next, he added a PTC fuse; this ensures that the current through the opto-coupler is restricted.
To control the system, he decided on a Pi Pico as they are inexpensive. In addition, the MicroPython coding is straightforward, making it easier to modify, if necessary. Pi Picos are easy to power from batteries.
The human presence sensor provides a logic level output, which goes high when a person is detected. he realized, however, that this is a 5V signal, and the Pi runs at 3.3V. To keep things simple, he decided on a 5V boost regulator to provide the power for the sensor and a simple resistive potential divider to set the logic level back to 3.3V.
The opto-coupler connected to "heater ready" signal is pulsed at 50Hz. But because this is an AC signal, the diode will only be conducting on half the cycle. In order to detect this, the number of pulses are counted each second. If this is above a limit (approximately 20), it would signal that the heater was ready and smoke could be triggered.
Testing
The circuit is best tested with low level signals before the mains voltages are applied.
Before populating the Pi Pico, he tries driving the opto-coupler using a wire from the battery to the input pin and listen for the relay’s click on. Adding an LED and resistor to form a circuit on the high side will test that the relay circuit is working, although he mostly tested that by listening for the click when the coil was energized.
For the input side, you can apply a low voltage across the photo transistor either by using a simple AC transformer or a signal generator.
Before he soldered the Pi Pico in place he tested the other components and realized that he had also wired the inbound optocoupler to the battery VSys rather than the V3.3. So another little adjustment was needed for the board. Finally, he realized rather late that the LEDs in the remote also had a tiny resistor, hiding under the board. He reproduced that in his circuit by breaking the track and soldering across the pins of the related components.
Code
The code for the project was written in MicroPython. Andy's friend is a professional .NET software developer, but he doesn’t have a lot of experience with C. However, Andy thought he’d be quite capable of maintaining a Python program. He considered the Meadow board series, but those are quite expensive, and the Pi Pico seemed a better choice. The main challenge was detecting pulses. That was accomplished using an interrupt to look for the change of state on an I/O pin and simply counting them. A timer then checks to see how many pulses have been detected.
A second interrupt checks to see if the motion sensor has changed states, and when both conditions are met, the code utilizes some randomization to generate the effect without being too predictable.
Full code is available at: https://github.com/Workshopshed/Spiders
Bonus Content:
Bill of Material:
Product Name | Manufacturer | Quantity | Buy Kit |
---|---|---|---|
EQUINOX Fog Machine with On/Off Remote, 400W | EQUINOX | 1 | Buy Now |
SCHRACK - TE CONNECTIVITY Power Relay, SPST-NO, 5 VDC, 8 A, V23061, Through Hole, Non Latching | SCHRACK - TE CONNECTIVITY | 2 | Buy Now |
Plastic Enclosure, Multipurpose, Polypropylene (PP), 80 mm, 200 mm, 160 mm, IP65 | ETERNA | 2 | Buy Now |
LED, RED, 10MM | VCC (VISUAL COMMUNICATIONS COMPANY) | 10 | Buy Now |
RASPBERRY-PI SBC, Raspberry Pi Pico, RP2040, ARM Cortex-M0+, 264kB RAM, 2MB Flash, Micro-USB | RASPBERRY-PI | 2 | Buy Now |
WAGO Wire-To-Board Terminal Block, Black, 1 Ways, 20 AWG, 16 AWG, 1.5 mm², Push In | WAGO | 3 | Buy Now |
MULTICOMP PRO Rocker Switch, IP65, On-None-Off, DPST, Non Illuminated, Panel Mount, Black | MULTICOMP PRO | 2 | Buy Now |
PULSE Medium Fog Fluid, 5 Litre | PULSE | 1 | Buy Now |
TEXAS INSTRUMENTS TRANSISTOR ARRAY, NPN, 2003, DIP16 | TEXAS INSTRUMENTS | 1 | Buy Now |
ONSEMI Optocoupler, Transistor Output, 1 Channel, DIP, 6 Pins, 60 mA, 7.5 kV, 100 % | ONSEMI | 2 | Buy Now |
DFROBOT Add-On Board, Microwave Sensor, Gravity Series, Arduino, Digital Interface | DFROBOT | 2 | Buy Now |
LED, RED, 3MM | MULTICOMP PRO | 30 | Buy Now |
TVS Varistor, 275 V, 350 V, 14D Series, 710 V, Disc 14mm, Metal Oxide Varistor (MOV) | YAGEO | 1 | Buy Now |
PTC Fuse | LITTELFUSE | 1 | Buy Now |
TVS Diode 5v | LITTELFUSE | 2 | Buy Now |
1N5817 1A 20V Schottky Rectifier Diode | STMICROELECTRONICS | 2 | Buy Now |
Additional Parts:
Adafruit MiniBoost 5V @ 100mA Charge Pump AP3602A |
Spiders (1 large, 4 small) |
Resistors (various) |
Battery Holder, 3 x C Type |