Picture of Motion Triggered Fog Machine
Fog machines can be unruly beasts. Especially the non-professional models you buy for halloween. With low duty cycles, causing massive amounts of fog when you don't need it, and no fog when you do. Wouldn't it be nice to have fog only when people come up to your house? Yeah, I thought so too. Here we are going to make a motion triggered fog machine that will turn on when ever someone comes up to your door.
Remove these adsRemove these ads by Signing Up

Step 1: The Parts

Picture of The Parts
Here is what you are going to need to complete this Instructable.
Everything linked here is the exact same part I used but you can always substitute comparable parts.

*A Relay
I used a 12vDC/125vAC relay from RadioShack. (I'm sure you can find a similar one somewhere else for cheaper) You can use what ever you like as long as the reed switch is rated for current up to 120vAC. Although this one says the coil requires 12vdc you should be able to get away with using a 9v battery. (This one should work exactly the same) (Your 9v batteries probably wont last long in the 12v relay so you may want to try a 6v one)

*A Distance Sensor
This is the HC-SR04 Distance Sensor. We will use it as a digital tripwire. This one is cheaper than the "Ping" sensor and just as easy to use. I will provide the appropriate libraries later on so you don't unnecessarily rip out your hair.

*A Transistor
You are going to need something to control the 9v power supply. If you decide to use a 5v relay you should still use a transistor to protect your Arduino from the relay.

*A Diode
The diode is to keep you from ruining your transistor. Admittedly I didn't use a diode for my first version of this and it worked fine but after reading more it started looking like a better idea.

*A Resistor
The resistor is for a little added protection for your Arduino from the 9v battery and the relay. I used a 220OHM resistor.

*A Battery Connector
($2.99 for 5)
You need to connect to your battery some how dont you?

*A Project Box
I used a 2x3'' project box from radio shack but you should probably look elsewhere to get a better price.

*Shrink Tubing
You want your wires to stay neat and tidy dont you?

*Copper Clad PerfBoard
To put your project on. I cut mine to about 1 1/2'' x 1 3/4''

*Stranded Hookup wire
You need stranded wire to go from the remote to the project box. Use stranded wire for this because it can handle the constant movement this wire will endure. It also must be able to handle the AC current.

*Solid Core Hookup Wire
This wire is used for hooking up your circuitry and for connecting to the Arduino.

*A Fog Machine WITH A REMOTE!
(I paid $30 for mine but you may find them at better prices depending what time of year it is)
You need to make sure you get a fog machine with a corded remote with a switch or else trying to follow this intractable could get tricky. (if you like tricky then go ahead and get one with a different style remote) We are going to modify the remote so the whole fog machine will not be turned off completely and it will not need to heat up again every time you want fog.
(This is the one I bought but they are sold out for now so I have another one listed aswell)


*Soldering Iron
Do I really need to go into why you need this?

To Check continuity and for shorts.

*A Dremel
You are going to use it to cut holes in your project box

And I suppose thats it.

Oh and an Arduino!

Step 3: The Relay

Our relay is a little different than the one used in the schematic. Our coil pins are right next to each other.
Check the data sheet for your specific relay to make sure you are connecting to the right pins.

Tack down one pin of the relay then you can continue to solder on the other components.

Step 4: Solder the Components

Because we are using a copper clad perfboard you are going to want to intentionally bridge the connections between several components and wires. (Which turns out to be harder than you may think)

Step 5: Wire the Components

Here is where you will use the solid core hookup wire. I only had one color wire so look very carefully to see which wire goes where.

Step 7: Arduino Connectors

Now would be a good time to attach the Arduino signal jumper to the resistor attached to the base pin, and the Arduino ground jumper to the other ground connections.

You should mark your ground wire some how. I put a piece of tape around mine.

Step 8: The Remote

Almost there now!

Its time to connect to the remote. First we need to open it up with the two screws and make a small hole in it.

Next we need to find out which wires are controlled by the switch. Cut away a small amount of the heat shrink tubing and get out your multimeter. There should be two wires that have continuity when the switch is on and loose it when the switch is off. Those are what we need. In my case it was the white and green wires. Solder the long wires from the relay to these two spots. It doesn't matter which one goes where. You may want to use some hot glue for more insulation if you are worried about shorts.

You can close up the remote now, you are done with this part.

Step 9: Box It Up!

Now its time to box it up! Cut holes in the top and bottom of your project box where you want the three groups of wires to come out. Put your board in and seal that sucker up!

Step 10: The Distance Sensor

Picture of The Distance Sensor
This sensor is different from the Standard Ping sensor in that it has both a Trigger pin and an Echo pin. With the right library this isn't a problem at all.

You can either plug it into a bread board and connect that to the Arduino. Or solder wires directly onto the sensor. I chose to use a breadboard.

For this sketch the Trigger pin is connected to pin 12 on the Arduino, and Echo is connected to pin 13.

Once you download the Ultrasonic Library drag it into your library folder.

Step 11: The Sketch

Picture of The Sketch
There you have it! You are all done!!

Now you are ready to spookify your walk way even more.

Below is a sketch I made to get you started.
Simply position the remote and sensor near a walkway or door and when the sensor's path is obstructed closer than 6ft the fog machine will turn on for 20 seconds.

Note: The switch on the remote must be in the OFF position for this mod to work.

tried it, failed ! lol maybe next year

scratch that, got it working but it just goes off every 20 seconds

djones483 months ago

Hi there all,

This is a truly amazing gadget, especially with Halloween looming. Ive tried the sketch and compile it and I keep reaching the same stumbling block

Serial.printIn((ultrasonic.Ranging(CM));//This is the distance in Centimeters

No matter what I do, just cant get it to go further. Im no expert with Arduino, just dabbled so if anyone can help, that would be great.

artaex6 months ago

I recommend buying the distance sensor off Ebay. It's only $1.40 here:

tripleh49789 months ago
the transistor referenced is no longer available. can someone suggest a replacement?
monkeysinacan (author)  tripleh49787 months ago

Any NPN transistor with similar specs should work.

kco17 months ago

I'm building a project with a fog machine and this instructable is perfect, except the sketch seems to be lost on this tutorial.

Does anyone have it and if so, could you post it on the comments section?

Thanks a million!

monkeysinacan (author)  kco17 months ago

Hi kco1! The sketch is attached to step 11.

brobinson162 years ago
I've tried doing this and as soon as I attach the battery the relay switches on and will not turn off. Is this down to some poor wiring on mu part?

monkeysinacan (author)  brobinson162 years ago
Glad to hear you are trying this. It could be a few different things. Hopefully its just a case of accidentally connecting to the "Normaly Closed" (or NC) relay pin.

Double check with this picture from the packaging.

If you post a picture of the top and botom of your circuit board I could probably help you better.
wirenut19803 years ago
Great idea! I will be adding this to both fog machines next Halloween.
spikec3 years ago
Nice job! Just added this to my list of things to do!
That is awesome, and I've got the exact Ultrasonic Sensor that you have, I so have to attempt this.
mikeasaurus3 years ago
awesome hack!