SENSOR:
Sensor is an electronic device which converts physical quantity(temperature,object....)into electrical quantity(voltage or current).
Okay...Now we are going to see how to detect the obstacle using arduino hardware.
Hardware Required:
Sensor is an electronic device which converts physical quantity(temperature,object....)into electrical quantity(voltage or current).
Okay...Now we are going to see how to detect the obstacle using arduino hardware.
Hardware Required:
- Arduino uno
- IR sensor
- Light Emitting Diode(LED)
- Bread board
- Connecting wires
- Connect Arduino 5v pin to IR sensor Vcc.
- Connect Arduino GND pin to IR sensor GND.
- Connect Output pin of sensor to arduino pin 7.
- Connect Anode(+) of LED with pin 13 and Cathode(-) with arduino GND pin.
An Infrared sensor is an electronic device,that emits in order to sense some aspects of the surroundings.An ir sensor can measure the heat of an object as well as detects the motion.
Working Principle:
A transmitter is transmits the infrared light signal ,when object is presented a transmitting signal is reflected then a receiver receive the reflected signal.Then it convert physical quantity into electrical quantity.
IR sensor interfaced with arduino.
Arduino IDE serial monitor
Arduino code ↓↓
Prototyping Model
When IR sensor is detect the obstacle the led will glow.
Turn ON your device
Working....
IR sensor interfaced with arduino.
Arduino IDE serial monitor
Arduino code ↓↓
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int LED = 13; // Use the onboard Uno LED | |
int obstaclePin = 7; // This is our input pin | |
int hasObstacle = HIGH; // HIGH MEANS NO OBSTACLE | |
void setup() { | |
pinMode(LED, OUTPUT); | |
pinMode(obstaclePin, INPUT); | |
Serial.begin(9600); | |
} | |
void loop() { | |
hasObstacle = digitalRead(obstaclePin); //Reads the output of the obstacle sensor from the 7th PIN of the Digital section of the arduino | |
if (hasObstacle == LOW) //LOW means something is ahead, so illuminates the 13th Port connected LED | |
{ | |
Serial.println("Stop something is ahead!!"); | |
digitalWrite(LED, HIGH);//Illuminates the 13th Port LED | |
} | |
else | |
{ | |
Serial.println("Path is clear"); | |
digitalWrite(LED, LOW); | |
} | |
delay(200); | |
} |
Prototyping Model
When IR sensor is detect the obstacle the led will glow.
No comments:
Post a Comment