The IR Proximity Sensor
The IR Proximity sensor is one of the most commonly used sensors. You will find these in automatic taps, automatic door opening, etc. This sensor works on the principle of IR reflectance. There is an IR LED (white / light blue in color) that is constantly emitting IR light. The light when reflected back falls on the IR Receiver LED / Photodiode (the black / dark blue color led). This received signal is then processed by an Op-Amp and the Op-Amp gives a HIGH signal. So the sensor module will give a HIGH signal if there is an object in front of the LED's. The range of sensing can be varied by adjusting the potentiometer on the sensor module. The maximum range of this module is only a few cms, so don't expect to use this as a distance sensor ;). The module will not work when pointed at black objects as black color tends to absorb the IR light.
Note: The IR Sensor and its 3-pin cable will not come attached. You need to fix the Cable on to the Sensor. There is only 1 way the cable will fit on the sensor module, so, we presume you can't go wrong about it ;)
Lets program to trigger the Buzzer everytime the sensor gives a HIGH signal. Try the following program. [ULN_Buzzer_IR.ino]
The IR Proximity sensor is one of the most commonly used sensors. You will find these in automatic taps, automatic door opening, etc. This sensor works on the principle of IR reflectance. There is an IR LED (white / light blue in color) that is constantly emitting IR light. The light when reflected back falls on the IR Receiver LED / Photodiode (the black / dark blue color led). This received signal is then processed by an Op-Amp and the Op-Amp gives a HIGH signal. So the sensor module will give a HIGH signal if there is an object in front of the LED's. The range of sensing can be varied by adjusting the potentiometer on the sensor module. The maximum range of this module is only a few cms, so don't expect to use this as a distance sensor ;). The module will not work when pointed at black objects as black color tends to absorb the IR light.
Note: The IR Sensor and its 3-pin cable will not come attached. You need to fix the Cable on to the Sensor. There is only 1 way the cable will fit on the sensor module, so, we presume you can't go wrong about it ;)
The IR Sensor. Look at the Wires and Their Mappings. We will connect these accordingly |
Connect the Red Wire of the IR sensor to the '+'ve Terminal & the Black Wire of the IR sensor to the '-'ve Terminal |
Connect the Brown wire of the IR sensor to the 8th pin of the Arduino |
This is how your final setup should look like |
Lets program to trigger the Buzzer everytime the sensor gives a HIGH signal. Try the following program. [ULN_Buzzer_IR.ino]
/* ULN2003- Buzzer This program drives a Buzzer using ULN2003 */ void setup() { pinMode(7,OUTPUT); } void loop() { digitalWrite(7,HIGH); delay(2000); digitalWrite(7,LOW); delay(3000); }
This looks like a buzzer blink.
ReplyDeleteWhere are you using the values from IR sensor in the program?
This could be an appropriate program...
ReplyDeletevoid setup()
{
pinMode(7,OUTPUT);
pinMode(8,INPUT);
}
void loop()
{
if(digitalRead(8)==0)
{
digitalWrite(7,LOW);}
else
{ digitalWrite(7,HIGH);
}
}
somehow my sensor is not working!! When I used it first time it was working properly.. but today when I used it the green light was on for all the time. It should be on when it detects something right ?? So what can i do to resolve this ?? would changing IC work ??
ReplyDeletethe sensor is sensitive to natural light which has ir in it... so that should be the issue... not to worry...
DeleteIs there a way to increase sensitivity of sensor ,mine detects obstacles from 1 inch distance only , is the pot given on sensor does that ?
ReplyDeletenope... these are proximity sensors... rotating the pot might increase it to perhaps 2 inches but not more than that...
DeleteThe buzzer sounds directly by providing power supply,
ReplyDeletewhy are you using ULN 2003 ??????????
Good
ReplyDelete