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.

1-40 of 46Next »
ronit116 hours ago


aki951 month ago
Can you give more information about the potentiometer
DIY Hacks and How Tos (author)  aki951 month ago

The potentiometer in step 5 is just a regular 10 kohm potentiometer. It measures 10 kohms across the two side terminals and the resistance to the middle terminal changes based on how you have the knob turned. On end is connected to the ground. The other end is connected to 5V. The center terminal is connected to the OP AMP.

Michalsky3 months ago


muss the wavelength of the IR Phototransistor and IR LED match by 100% or is it enough to consider only the range of both?

I have been using following:


but it is not working properly I have changed the 33 Ohm resistor too, but the LED is either on or off and sometimes it looks like having interference Im not sure whats going wrong.


DIY Hacks and How Tos (author)  Michalsky3 months ago

Most IR LEDs and phototransistors should work. Check the polarity and look for shorts.

Louis-AeronT3 months ago

Typo! Is there any set petentiometer we should use? Thanks!

No. You will probably need use some trial and error
Louis-AeronT3 months ago

Hi. Cool circuit; I am trying to make with the op amp, but having trouble getting it to work. For the potentiometer, is there are set ratings?

fadecomic5 months ago

I built this circuit, but my 33 ohm resistor is getting extremely hot. (5-1.3V)/33 = 112 mA, and P = I^2 R = 0.414 W, which is much more than the 0.25 W an off-the-shelf resistor is rated for. Did you experience the same?

DIY Hacks and How Tos (author)  fadecomic4 months ago

That is a good point and I need to make that more clear in the instructions. Here are some solutions.

1. Use a larger resistor value and bring down the current to below 0.25 W.

2. Use multiple IR LEDs. Using three LEDs in series will have a combined voltage of 3.9V. So the voltage across the resistor would only be 1.1V. At 150mA that is only 0.165W on the resistor.

3. Use two 68 ohm resistors in parallel. This effectively gives double the wattage capacity.

rpd163495 months ago

what is the maximum distance that can be detected by the sensor..

thank you

DIY Hacks and How Tos (author)  rpd163495 months ago
That depends mostly on how much interference there is from the surroundings. It will work best in the dark. But a few feet is the best that you could ever expect.

Is it possible to make a more advanced version of this? Instead of a light, it sends a message to another device wirelessly?

It is absolutely possible but that setup would be a lot more complicated.
hrayhan8 months ago

can i use regular phototransistor?

DIY Hacks and How Tos (author)  hrayhan8 months ago
It can work but it will get some interference from other light in the room

thank you for your answer!

one more question, could connect your ir proximity (op-amp) in this schematic

DIY Hacks and How Tos (author)  hrayhan8 months ago

Maybe. I am not familiar with the chips used in that circuit. So I can't say for sure.

S0uraV_DAS9 months ago

Thanks for sharing! I am using it for my robot!

Lama_John10 months ago

Hey there...

Thanks for the share but I have a problem with my circuit...

When I turn on my circuit, my LED remains on no matter what (OP-Amp), and when I adjust the 10K resistance, it just turns off at a point, has no effect whether the IR led is On or OFF or even Absent. Means the LED is operating independently.....

I really need your help on this one....

Thanks in advance....

DIY Hacks and How Tos (author)  Lama_John10 months ago

It is possible that the light in the room is saturating the receiver transistor. Try it in a darker room.

I did sir, I completely covered the transistor with tape and even then couldn't get it to calibrate... I even tried inverting the output from high to low as you suggested (by swapping pins of op-amp) but still no result.....

If you don't mind, I can send you my E-mail ID and then on that media post you pictures of my bread board attempt so you can figure out what's wrong with it. Because for the life of me I can't.....

esnho1 year ago
I like that you write for an alternative to Arduino. BRAVO!
agis681 year 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)  agis681 year ago
You would probably be better off basing your project on a beam interrupt sensor. Here is one kind of example:
manishrkp1 year 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.
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. 
sabre11361 year 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?
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.
Edgar1 year ago
Neat. Simple and useful, voted, good luck.
A description of this, with the link, went to my Blog:
manishrkp1 year ago
Hi, Can this sensor be used for detecting water level/tank full indicator?
so, favorite button, we meet again.
TSJWang1 year 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...
1-40 of 46Next »