Infra-Red Proximity Sensor (I

)
Using an IR LED as a sensors

Overview
Based on a simple basic Idea, this proximity sensor, is easy to build, easy to calibrate and still, it provides a detection range of 35 cm (range can change depending on the ambient light intensity).
This sensor can be used for most indoor applications where no important ambient light is present. For simplicity, this sensor doesn't provide ambient light immunity, but a more complicated, ambient light ignoring sensor should be discussed in a coming article. However, this sensor can be used to measure the speed of object moving at a very high speed, like in industry or in tachometers. In such applications, ambient light ignoring sensor, which rely on sending 40 Khz pulsed signals cannot be used because there are time gaps between the pulses where the sensor is 'blind'...

The solution proposed doesn't contain any special components, like photo-diodes, photo-transistors, or IR receiver ICs, only a couple if IR leds, an Op amp, a transistor and a couple of resistors. In need, as the title says, a standard IR led is used for the purpose of detection. Due to that fact, the circuit is extremely simple, and any novice electronics hobbyist can easily understand and build it.

Object Detection using IR light
It is the same principle in ALL Infra-Red proximity sensors. The basic idea is to send infra red light through IR-LEDs, which is then reflected by any object in front of the sensor.

the +ve input. Always ON detected using an Op-Amp (operational Amplifier LM358).000 rpm or much more. So the output will be High when IR light is detected. we are going to use a very original technique: we are going to use another IR-LED. in this design.6 Volt.in any way . that may be of the order of 15. depending on the ambient light conditions. the 2 resistors R5 and R6 form a voltage divider which provides 2. This voltage drop can be Design 1: Low range.) R8 so the the voltage at the positive input of the Op-Amp (pin No. The electronic Circuit Two different designs are proposed. this led will be used as a sensor). but with much lower output current.6. Note: Both the sender and the receiver are constructed on the same board. It can barely be detected. that's why as you will notice in the schematic. you will notice that the output will go High when the volt at the cathode of D1 drops under 1.5V at the anode of the IR LED (here. If the +ve input's . to detect the IR light that was emitted from another led of the exact same type! This is an electrical property of Light Emitting Diodes (LEDs) which is the fact that a led Produce a voltage difference across its leads when it is subjected to light. You will have to adjust the variable resistor (POT. They are separated in the schematics for simplification.used to generate electrical power from light. range can be from 1 to 10 cm.5 mA. this design of the circuit is suitable for counting objects. In other words. depending on the light intensity. As the name implies. When IR light falls on the LED (D1). which is the purpose of the receiver. yielding a forward current of 7. However this design is more power consuming and is not optimized for high ranges.4V or more. As if it was a photo-cell. each one of them is more suitable for different applications. if you understand the functioning of Op-Amps. meaning that the IR led is constantly emitting light. In case you're not familiar with op-amps. what you need to know to understand how this sensor functions: The op-amp has 2 input. here is shortly and in a very simplified manner. the cathode's voltage of D1 may go as low as 1. the voltage generated by the leds can't be .Then all you have to do is to pick-up the reflected IR light. the voltage drop increases. we are going to use a Op-Amp (operational Amplifier) to accurately detect very small voltage changes. or counting revolutions of a rotating object. The receiver part of the circuit is exactly the same in both designs. As you can see the schematic is divided into 2 parts the sender and the receiver. The sender is composed of an IR LED (D2) in series with a 470 Ohm resistor. The receiver part is more complicated. The main difference between the 2 designs is the way infra-red (IR) light is sent on the object. and the -ve input. For detecting the reflected IR light. 5) would be somewhere near 1. the sensor is always ON.

the Total period.The duty cycle of the pulses turning the LED ON and OFF have to be calculated with precision. given that the object has a reflective stripe glued on it. Contact-Less tachometer This is a tachometer.. depending on ambient light conditions. this kind of encapsulation was totally sufficient to overcome all noise due to ambient light for indoor applications. otherwise. the output goes High (5v. Some applications of the 'low range Always ON' Design: Notice how in both devices.0001 volts difference will be detected. which is oriented to obstacle detection in robots. and the average current.voltage is higher than the -ve input's voltage. Again a microcontroller will have to be used to 'understand' the data provided by the sensor and display it. The range of the sensor is extended by increasing the current flowing in the led. given the supply voltage in the schematic). as we need to send pulses of IR instead of constant IR emission. then the output of the Op-Amp goes to Low (0V). and the mathematical relations between the ON time. Wheel Encoder This is a simple wheel encoder based on the idea that white stripes will reflect IR light.. Pulsed IR . It is now clear that this kind of sensor has to be Always ON.] In this design. from 25 to 35 cm. The duty cycle is the ratio between the ON duration of the pulse and the total period. that are sold for more than $200 rely on this simple idea! [Build your own one for less than $20 in this article. if the +ve input's voltage is lower than the -ve input's voltage. Those 2 graphs shows the meaning of the duty cycle. that counts the revolutions per minute of a rotating object. A low duty cycle will enable us to inject in the LED high instantaneous currents while shutting it OFF for enough time to cool down from the previous cycle. Many commercial contact-less tachometers. so that the average current flowing into the LED never exceeds the LED's maximum DC current (or 10mA as a standard safe value). It doesn't matter how big is the difference between the +ve and -ve inputs. to achieve accurate results. giving a pulse per revolution. providing the microcontroller with precious information that can be used to calculate displacement. and the the output will swing to 0v or 5v according to which input has a higher voltage. Design 2: High range. while black ones will absorb it. This is a delicate task. the IR leds are encapsulated to protect them from ambient light. our primary target is to reach high ranges. that will pass in front of the IR sensor for each and every revolution. this will result in a series of electrical pulses as the wheel is rotating. velocity or even acceleration. even a 0. to detect every single white stripe passing in front of it.

this is why we have to send low duty cycle pulses. Average and Instantaneous current. would cause a current of approximately 250 mA to flow through the LED. 'ALLWAYS ON' design for a detailed description. stands for Control. thus on how much current you need on the base to drive the required collector current. The CTRL input in the figure. Now. Duty cycle. When the sensor is controlled by a microcontroller to generate the low duty cycle pulses. The receiver part of this schematic functions in the exact same way as in the first design. you can benefit from the High and Low pulses to be able to detect any false readings due to ambient light. but real calculations would yield a much smaller average current. one of them during the ON pulse (the sensor is emitting infra red light) and the other during the . hands on the circuit that will put all this theory into practice. and this pin should be connected to the source of the low duty cycle pulses discussed above. A current this high. would destroy the LED if applied for a long period of time (some dozens of seconds). Software based ambient light detection. to enable any kind of device to control the sensor. the average current in blue is exaggerated to be visible. The calculations yielded that a 10 ohm resistor is series with the LED D2. whether it is a microcontroller or an LM555 timer that generates the pulses. Pulsed IR. refer to the first. The first Op-amp will provide voltage buffer. This is done by recording 2 different outputs of the sensor. The calculation of the the base resistor R3 depends on the type of transistor you use. also.In the second graph. it will provide the 30mA base current required to drive the base of the transistor.

As you can see. where the sensor is put in a high ambient light environment. delay(98).1 IR output pin coming from the sensor while(1){ P2_0 = 1. But study the second period of the graph. The following table show the possible outcomes of this method. and is giving "1" whether there is an obstacle or not. there is something wrong with the 0 1 sensor. bit ir1. // Sensor is saturated by ambient light }else{ ir = 0. P2_0 = 0. meaning that an object reflected the emitted IR Light. ir2 = P2_1. there is low ambient noise. and then the microcontroller records a "0" meaning that during the OFF time.ir2. it didn't receive anything. and compare the results. // The way is clear in front of the sensor. // Pin 3 of PORT 2 will go HIGH turning ON a LED.} } void main(){ //P2. the the microcontroller records "1" in both conditions (OFF or ON). This means that we can't be sure whether the sensor reception was caused by an object that reflected the sent IR light. which is logic because the emitter LED was OFF. the way is 0 0 clear This reading is un logical.i<y. Output recorded during: Software based deduction On pluse Off time 1 0 There is definitely an Obstacle in front of the sensor The sensor is saturated by ambient light.h> unsigned char ir. Example C Code for 8051 microcontrollers #include <REGX51.0 IR control pin going to the sensor //P2. thus we can't know if 1 1 there is an obstacle There is definitely Nothing in front of the sensor. delay(20). delay(y){ unsigned int i.i++){. if ((ir1 == 1)&(ir2 == 1)){ ir = 2. } .OFF time. or it is simply receiving too much ambient light. // Obstacle detected P2_3 = 1.h> #include <math. The Idea is enlightened by this graph. so the microcontroller records a "1" during the on cycle. ir1 = P2_1. where in the first period. //send IR //stop IR // to store the final result // the 2 recording point required for our algorithm // simple delay function } if ((ir1 == 1)&(ir2 == 0)){ ir = 1. for(i=0.

the receiver LED with regard to each other and to the Op-Amp can also increase the performance of the sensor. the length of wires or PCB tracks before an amplifier should be reduced. this way. is the distance between the receiver LED and the Op-Amp. in such a way they are as near as possible to each others . you can notice that the receiver LED is positioned under the PCB. the amplifier will amplify . You can download here the project folder containing the schematic. there wont be ambient light falling directly on it. It is also clear that this way of positioning the LEDs prevent the emitted IR light to be detected before hitting an eventual obstacle.} Components positioning: The correct positioning of the sender LED.a lot of noise picked up form the electromagnetic waves traveling the surrounding. The easiest way to do that is to put the sender(s) LED(s) from one side of the PCB. The green plate is the PCB holding the electronic components of the sensor. First. An example PCB construction Here is an example construction of the PCB for the High Range. and the receiver LED from the other side. as near to each others as possible. I start by placing the receiver LED and the OpAmp. Pulsed IR proximity sensor. we need to adjust the position of the sender LED with respect to the receiver LED. Actually. Generally speaking. and an example code for 8051 microcontroller to send the low duty cycle pulses. it can be up to 35mm without causing serious problems. This 3D model shows the position of the LEDs. Another important issue about components positioning. as shown in the 3D model below. but trying to reduce this distance will Always give you better results. as ambient light usually comes from the top. .along with the original signal . Sure this distance is not as critical as you may think. then continue the rest of the design. otherwise. the PCB design. which should be as small as possible. Here is an example PCB where the distance between the LED and the Op-Amp is shown. while preventing any IR light to be picked up by the receiver LED before it hit and object and returns back. when I design the PCB.

there is probably something wrong. as explained . The POT is the potentiometer used to adjust sensitivity. Then. To do this. you can start testing the range of the sensor. the LM358 Op-Amp is mounded on the copper side. On the other hand. then everything is alright.In this design. at a frequency of 3Khz. As explained before. and experiment it in different ambient light conditions. If its not hot. if the LED is getting hot. loaded with a program to generate pulses with a duty cycle of approximately 1. so you don't have to worry about the response time. or increase the series resistor. Testing the High range Pulsed IR sensor The last step. let the sensor running for a minute.6. In the example C code above. but the potentiometer may have to be adjusted carefully. to cope with ambient light. the sender and receiver LEDs are on both sides of the PCB. in order to decrease the average current flowing into the LED. you should then try to decrease the duty cycle. I connected the sensor to a 89S52 microcontroller. to an extent that you can feel it. the final output of the sensor appears on the pin P2_3 of the microcontroller. to save some space. is to test the performance of the pulsed IR proximity sensor. and check with your fingers the temperature of the IR sender LED. To make sure your duty cycle calculations are correct. LEDs are deigned to operate at very high frequencies.

Schematic and Example 8051 C51 code. Acoustic.) Preview of the last 15 messages discussing this page..com Bottom of Form Discussion (Last 15 posts preview. Messages are sorted from the newest to the oldest. Follow this discussion in the Full-featured forum Posted by: kaviyar asu on: 04 Nov 2009 Infra-Red proximity sensors PART 1 i want clear detail for this project pls send ['Quote ] Posted by: pratik2 Infra-Red proximity sensors PART 1 ['Quote ] . Related Tutorials Ambient light ignoring infra-Red proximity sensor. using 40Khz IR receiver IC Proximity sensors at BEAM circuits. containing the PCB.an overview about IR (InfraRed). Join the Mailing List Let us get in touch with you when we upload new interesting content. Capacitive and Inductive procimity sensors.before. Top of Form Name: Email: 2181283854 Subscribe 1 Unsubscribe GO Get your Free Mailing List by Bravenet. [note: i use ExpressPCB(FREEWARE) to design the schematics and the PCB] Download the zip file for the High range sensor..

. Is it advisable to use IR proximity sensors for this? I checked the line tracking sensors at http://www.trossenrobotics. 4. but how good? i dont know.pololu. The distance from which it can sense the line needs to be approximately 3-5 cm (height of chassis from the ground).aspx).will it make any difference?? 3.how can we measure the voltage. I'm building a robot now and I would like to use line-tracking sensor which can detect white reflective tape on a black background. will there be any changes in the circuit??(Because photo diode is connected in reverse bias) ikalogic on: 02 Oct 2009 thanks again.... y r u using such higher values as 470 ohm in sender circuit and 3k8 ohms in receiver circuit. can i use this same circuit(design 1) for a line follower 2. The speed at which it detects is important and hence I think IR proximity sensor is better than LED and LDRs. can i use any lower value in place of these two values such as 100 ohms as a value of R7. Posted by: Re: Infra-Red proximity sensors PART 1 ['Quote ] Quoting jaydu1904: thank you Sir.com/tut_line_sens_algo. how we have to set tht 10K Pot. I know it will work. ensor... You have to try different configurations.... if I want to use a photo detector diode in the Receiver part of the circuit(instead of IR LED). Can you please advice which one will be better for me to use? And is it possible to get a detailed description of "IR proximity sensor used for line-tracking" as it's mentioned for LED and LDR sensor? Thank you very much.. I am not quite sure of the result..by a multimeter i guess?? 5. will the circuit work properly or not?? Also I have another doubt. Most of the Line tracking sensors I found online have a very low sensing distance of 1-12 mm (like this one http://www.0990 on: 19 Oct 2009 i have some doubts1.ikalogic. i am using lm324 in place of lm358 and rest everything same. bt if I use those blue/black IR LEDs that i am getting here.com/p/I2C-Li ..php.. .com/catalog/product/1134 Posted by: svignes h90 Infra-Red proximity sensors PART 1 ['Quote ] on: 12 Oct 2009 Sir. if i use an ir receiver diode in place of ir led in receiver circuit will it make any difference?? **pls rply its really urgent** Posted by: svignes h90 Infra-Red proximity sensors PART 1 ['Quote ] on: 12 Oct 2009 Can I use this sensor for line-tracking? And is it possible to get these kind of sensors as 8-cell arrays (similar to LED and LDRs) ? http://www..

. thanking you. bt if I use those blue/black IR LEDs that i am getting here... Posted by: Re: Infra-Red proximity sensors PART 1 ['Quote ] Quoting jaydu1904: hello Sir... ikalogic on: 02 Oct 2009 it is not a foolish question at all! on the contrary. . will there be any changes in the circuit??(Because photo diode is connected in reverse bias) thanks again.. when i was testing my IR sensors. if I want to use a photo detector diode in the Receiver part of the circuit(instead of IR LED). Are the same or will it make some difference?? I know it sounds a fullish kind of quetion bt still please let me know.. I am however unable to give you a certain reason for that! Posted by: jaydu1 904 on: 02 Oct 2009 Infra-Red proximity sensors PART 1 hello Sir. ['Quote ] How an IR LED looks like??? Bcoz one that is shown in images here is transperant. thanking you. i always got much better results with transparent IR leds than with opaque ones. How an IR LED looks like??? Bcoz one that is shown in images here is transperant. whereas one i've got here is bluish black in colour.. will the circuit work properly or not?? Also I have another doubt. Are the same or will it make some difference?? I know it sounds a fullish kind of quetion bt still please let me know...Posted by: jaydu1 904 on: 02 Oct 2009 Re: Infra-Red proximity sensors PART 1 ['Quote ] thank you Sir. whereas one i've got here is bluish black in colour.

so do u need to add program with ir sensor zip file to microcontroller.php Posted by: rafrus sel on: 02 May 2009 Infra-Red proximity sensors PART 1 ['Quote ] hello. as when u connect sensor the o/p isnt changing on display..com/ir_prox_sensors_40khz.ikalogic.thankyou for you time ikalogic on: 02 May 2009 That same circuit will work with any µC.. i have finished making the ir sensor. ['Quote ] .? reply immediately.could some one help me: I need a circuit of a sensor and their components using PIC16f84..ikalogic. ['Quote ] Posted by: sukr ut on: 12 Apr 2009 Infra-Red proximity sensors PART 1 hi.. including PIC.thankyou for you time Posted by: sukr ut on: 15 Apr 2009 Infra-Red proximity sensors PART 1 hello sir.Posted by: Re: Infra-Red proximity sensors PART 1 ['Quote ] Quoting Rafrussel: hello.do we have to burn program given for ir sensor in microcontroller along with the code for the digital tachometer.could some one help me: I need a circuit of a sensor and their components using PIC16f84.. http://www.php http://www..com/ir_prox_sensors.

omissions.i. Forgot your password? Unless mentioned. but what's the amp rating for the different 5v inputs? also. because apparently i use those method for my sumo robot. i think is hard to do but if u use ranger or sonar sensor u could do that. . copying is prohibited and unethical Home | Forums | contact | Check mail | About Ibrahim KAMAL All content on this site is provided as is and without any guarantee of any kind.e.. Top of Form . all content is written and designed by Ibrahim Kamal. so the ranger will send signal and receive the signal back after that it will calculate it for u then i use adc to convert to digital as my input function.e. I'm interested in having an IR Proximity detector circuit that gives an analog output and not digital. We cannot be held responsible for any errors. What changes would you suggest in your above circuit that would make this possible? Thank you since op amp output will swing from 0 to 5v if it sense something.i. I want to know exactly how far is the bot from an obstacle. or damages arising out of use of information available on this web site. is the on/off "switch" between the output label and ground? on: 02 Apr 2009 ['Quote ] Poste d by: mak sa on: 02 Mar 2009 Re: Infra-Red proximity sensors PART 1 ['Quote ] Quoting sumanfiem: Quoting sumanfiem: Sir. I'm interested in having an IR Proximity detector circuit that gives an analog output and not digital...Poste d by: Infra-Red proximity sensors PART 1 the jud ge this is probably a noob question. I want to know exactly how far is the bot from an obstacle. What changes would you suggest in your above circuit that would make this possible? Thank you You have to be a member to post replies.. Posted by: sumanf iem on: 28 Feb 2009 Re: Infra-Red proximity sensors PART 1 ['Quote ] Quoting sumanfiem: Sir../ir_prox_sensor Login Username: Password: Bottom of Form Remember me Register now! it only takes an instant.

.0 United States License.IMPORTANT COPYRIGHT NOTE: Electronics and Robotics Articles by Ibrahim KAMAL are licensed under a Creative Commons Attribution-Noncommercial-No Derivative Works 3.

Sign up to vote on this title
UsefulNot useful