Instructables

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:

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

Tools:
Soldering Iron 




Step 2: How an Infrared Proximity Sensor Works

Picture of How an Infrared Proximity Sensor Works
Img_6732b.jpg
vlcsnap-2013-10-10-13h16m23s139.png
vlcsnap-2013-10-10-13h16m41s54.png
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.

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.
hrayhan2 months ago

can i use regular phototransistor?

DIY Hacks and How Tos (author)  hrayhan2 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

CD-OF-OAR.jpg
DIY Hacks and How Tos (author)  hrayhan2 months ago

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

S0uraV_DAS3 months ago

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

Lama_John4 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_John4 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.....

esnho9 months ago
I like that you write for an alternative to Arduino. BRAVO!
agis689 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)  agis689 months ago
You would probably be better off basing your project on a beam interrupt sensor. Here is one kind of example: http://www.instructables.com/id/Laser-Tripwire-Alarm/
manishrkp11 months ago
Hi, Can this sensor be used for detecting water level/tank full indicator?
This might be better for you: http://www.instructables.com/id/Water-Level-Indicator-with-Alarm/
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)  manishrkp11 months ago
In theory it could. But a conductive sensor is typically much easier and more reliable.

http://www.instructables.com/tag/type-id/?sort=none&q=water+level+sensor
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. 
Thanks.
sabre113611 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)  sabre113611 months ago
You would probably be better off with either ultrasonic transmitter/receivers or using radio.
Here is an example by Ben Heck:
http://www.youtube.com/watch?feature=player_detailpage&v=tAyWrJoVUbs#t=1182
Ok, thank you very much.
Edgar11 months ago
Neat. Simple and useful, voted, good luck.
A description of this, with the link, went to my Blog:
http://faz-voce-mesmo.blogspot.pt/2013/10/inventor-brasileiro-vence-e-um-livro.html
manishrkp11 months ago
Hi, Can this sensor be used for detecting water level/tank full indicator?
NanoRobotGeek11 months ago
so, favorite button, we meet again.
TSJWang11 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)  TSJWang11 months ago
Well, this just got posted:
http://www.instructables.com/id/Reliable-and-low-cost-IR-Proximity-sensor/
That's perfect!
Thanks
carlos66ba11 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)  carlos66ba11 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.