Introduction
IR Proximity Sensor:
- The IR Proximity sensor is to perceiver the occurrence of any object without beginning in contact with with-it.
- It senses the accurate distance of a particular object.
- It will emit electromagnetic radiation.
Figure1: IR sensor
IR LED Emitter:
- It will also emit light.
- When the object occurs it will produce light
Figure 2: IR Emitter
Parts Of List:
- Arduino UNO
- IR Led Receiver
- IR Emitter
- Bread Board
- Hookup Wires
- Buzzer
Connection
Step 1: Fix the IR Receiver on the breadboard.
Step 2: Fix the IR Emitter 4 on the breadboard.
Connection Of Bread Board To Arduino:
Step 1: Take the IR Receiver Gnd pin to the Analog pin A0, then Vcc to the Digital pin 02.
Step 2: Take the IR Emitter to connect the Gnd pins commonly then Vcc pins commonly.
Step 3: Connect to the Arduino UNO board.
Step 4: Fix the buzzer in the Arduino board.
Program:
- int IRpin = A0;
- int IRemitter = 2;
- int ambientIR;
- int obstacleIR;
- int value[10];
- int distance;
- void setup()
- {
- Serial.begin(9600);
- pinMode(IRemitter, OUTPUT);
- digitalWrite(IRemitter, LOW);
- pinMode(11, OUTPUT);
- }
- void loop()
- {
- distance = readIR(5);
- Serial.println(distance);
-
- }
- int readIR(int times)
- {
- for (int x = 0; x < times; x++)
- {
- digitalWrite(IRemitter, LOW);
- delay(1);
- ambientIR = analogRead(IRpin);
- digitalWrite(IRemitter, HIGH);
- delay(1);
- obstacleIR = analogRead(IRpin);
- value[x] = ambientIR - obstacleIR;
- }
- for (int x = 0; x < times; x++) {
- distance += value[x];
- }
- return (distance / times);
- }
- void buzzer()
- {
- if (distance > 1)
- {
- if (distance > 100)
- {
- digitalWrite(11, HIGH);
- } else
- {
- digitalWrite(11, HIGH);
- delay(150 - distance);
- digitalWrite(11, LOW);
- delay(150 - distance);
- }
- } else
- {
- digitalWrite(11, LOW);
- }
- }
Explanation:
- In this article it can be used to detect the object at a particular distance.
- It can display the distance of an object in the Serial Monitor accurately.
- If they have the signal of the object it will produce the sound when it reaches the signal.
Figure 3: Output
Read more articles on Arduino:
Sr KarthigaPosted Apr 19, 2016, 7:14 AM
"thank you gowtham rajamanickam sir"
Gowtham RajamanickamPosted Apr 19, 2016, 6:42 AM
good article
Sr KarthigaPosted Feb 10, 2016, 2:38 AM
Thank you Anu Vivin sir
Anu VPosted Feb 10, 2016, 1:43 AM
Nice
Sr KarthigaPosted Feb 9, 2016, 8:48 AM
Thank you raja sir
Raja TPosted Feb 9, 2016, 8:46 AM
Nice, Thanks for sharing
Sibeesh VenuPosted Feb 8, 2016, 12:12 AM
Nice Share
Sr KarthigaPosted Feb 7, 2016, 4:32 AM
Arduino is a microcontroller based physical computing platform. Rasberry pie is microprocessor based single-board computer (SBC).
Sr KarthigaPosted Feb 7, 2016, 4:27 AM
Thank you Shubham Kumar sir
Saillesh PawarPosted Feb 7, 2016, 1:24 AM
what is the difference between Arduino and Rasberry pie?
Shubham KumarPosted Feb 6, 2016, 6:57 AM
nice
Sr KarthigaPosted Feb 5, 2016, 8:45 PM
Thank you Jaco Zwarts sir
Sr KarthigaPosted Feb 5, 2016, 8:45 PM
Thank you Pramod Thakur sir
Sr KarthigaPosted Feb 5, 2016, 8:44 PM
Thank you Mohammed sir
Sr KarthigaPosted Feb 5, 2016, 8:44 PM
Thank you santhakumar sir
Sr KarthigaPosted Feb 5, 2016, 8:42 PM
Thank you kumaresh sir
Santhakumar MunuswamyPosted Feb 5, 2016, 3:32 PM
Thanks for nice article. Keep it up
Kumaresh RajalingamPosted Feb 5, 2016, 2:19 PM
Nice share
Mohammed IbrahimPosted Feb 5, 2016, 1:12 PM
nice
Jaco ZwartsPosted Feb 5, 2016, 12:17 PM
Nice, Thank you for sharing
Pramod ThakurPosted Feb 5, 2016, 11:30 AM
thanks for sharing..