Use a DIY Proximity Sensor to Automate Your Haunted House

FeaturedContest Winner
Picture of Use a DIY Proximity Sensor to Automate Your Haunted House

The special effects in a haunted house need to be well timed. The best way to do this is to use sensors to detect where your guests are in the haunted house. So I am doing a series of projects that demonstrate a variety of sensors that you can use to automate your haunted house. Last week I showed how to make a simple DIY pressure plate switch.

This week, I am going to show you how to make a proximity sensor and how you can implement it to activate special effects. 
Remove these adsRemove these ads by Signing Up

Step 1: Materials

Picture of Materials
Here are the materials and tools that you will need to make a simple proximity sensor:

Infrared LED
Infrared Phototransistor
33 ohm Resistor
10 kohm Resistor
Black Heat Shrink Tubing (the same diameter as the phototransistor)
Perf Board

Soldering Iron 

Step 2: How an Infrared Proximity Sensor Works

Picture of How an Infrared Proximity Sensor Works
To make a simple proximity sensor, all you need is a light emitter and a light detector. The light emitter is constantly on. Whenever that light hits a nearby object, some of the light is reflected back to the detector. The closer the object is, the more light will be reflected. By measuring the output of the light detector, you can get a rough approximation of how close the object it.

This isn't exact because the amount of reflected light also depends on the physical properties of the reflecting surface (sometimes called its reflectivity). However, it works well enough to use to activate special effects in a haunted house.

I chose to use infrared light for this sensor because it is invisible to the human eye. So your guests won't notice it. Also it won't experience as much interference from the lighting in the room.

esnho3 months ago
I like that you write for an alternative to Arduino. BRAVO!
agis684 months ago
very nice, a question can we use the sensor reverce so to activate a relay when the beam is blocked? I wan to use it in automatic battery mini spot welder. So when i place the battery the singnal is stoped and this leads a relay to start arduino processing the welding menu on mini nokia screen with a menu of time msec times and number of spots
Also if your respond is yes can please help me with the code?

thanks in advance
DIY Hacks and How Tos (author)  agis684 months ago
You would probably be better off basing your project on a beam interrupt sensor. Here is one kind of example:
manishrkp6 months ago
Hi, Can this sensor be used for detecting water level/tank full indicator?
This might be better for you:
It will not last long as sensors used are small iron nut+bolts which will soon become rusted and won't work effectively.
Get Stainless Steel nuts and bolts.They serve the purpose and are pretty cheap too.
I actually wanted to send you a link where they had used copper wire as a sensor but I couldn't find it.
DIY Hacks and How Tos (author)  manishrkp6 months ago
In theory it could. But a conductive sensor is typically much easier and more reliable.
The question is how reflective is the surface of the water? That's not as simple as saying that water has a specific albedo, or reflectivity. If you are attempting to monitor the level of the water as the tank is being filled or emptied, you're going to have to deal with the fact that the surface of the water in the tank is not flat. As a result light from the source is going to be reflected in other directions, or absorbed.

Another option would be to use a float with a retro-reflective surface to reflect most light back to the source, even if the float is being bounced all over the place. You will want to do some sample averaging to determine whether the tank is filling or emptying. and you'll need some way to have the float stay essentially where the sensor can detect it, perhaps with a pulley at the top and bottom of the tank, and fishing line looped through those pulleys and tied off to the float so that the float essentially rides up and down in a reasonably straight line. With that you wouldn't necessarily need to use IR leds and sensors, but you would want to do some testing to see which ones work best.

An alternative to a fishing line and pulley system would be to have your float ride inside a piece of pipe that the light does not reflect back to the sensor easily off of. Perforate the pipe at the top and bottom to allow your tank contents to raise and lower the float freely. 
sabre11366 months ago
This is probably a little far fetched but I'm in the process of making a astromech droid (from star wars) but instead of controlling it, I plan on automating it for the sole purpose of carrying things for me such as tools. Do you think your sensor would be able to and be strong enough be the droid's " eyes" and allow it to follow me around?
DIY Hacks and How Tos (author)  sabre11365 months ago
You would probably be better off with either ultrasonic transmitter/receivers or using radio.
Here is an example by Ben Heck:
Ok, thank you very much.
Edgar6 months ago
Neat. Simple and useful, voted, good luck.
A description of this, with the link, went to my Blog:
manishrkp6 months ago
Hi, Can this sensor be used for detecting water level/tank full indicator?
NanoRobotGeek6 months ago
so, favorite button, we meet again.
TSJWang6 months ago
Hey there,

I like your sensor, its just what I need.
However, your image shows a sort of PWM on the IR led to the phototransistor.
The setback of having the IR constantly on is that the phototransistor can pick up ambient light. Do you know of a way to apply PWM:
The IR sends out pulses at 44KHz, for example, and the phototransistor only accepts 44KHz light pulses?
I've been trying to figure out an easy way to do this...
DIY Hacks and How Tos (author)  TSJWang6 months ago
Well, this just got posted:
That's perfect!
carlos66ba6 months ago
This is very nice, thanks for sharing. One possible improvement, which could be easily implemented in the arduino case, is to modulate the LED at a high frequency (several kHz) and then try to detect changes in the reflected intensity only at that frequency (or perhaps synchronized with the LED being on, using the LED off values as a baseline). That way you get rid of expurious light variations due to ambient.
DIY Hacks and How Tos (author)  carlos66ba6 months ago
Yeah. That is ver similar to how a lot of ultra-sonic proximity sensors work.
No. Ultrasonic measures the ping time for a very short time pulse to go and bounce back (speed of sound being about 340 m/s). Speed of light (300,000 km/s) is way to high to measure distances this way. What I am suggesting is modulation to simply reduce the noise. May or may not be necessary (likely not in most cases), but easy to implement in arduino.
Just for reference, typical IR remotes (e.g., TV remotes) operate with a carrier frequency of 38-39 kHz.

Get More Out of Instructables

Already have an Account?


PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!