Cheap Obstacle Sensor With Arduino
Cheap Obstacle Sensor With Arduino
Table of Contents
Step 1: Parts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
Related Instructables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
http://www.instructables.com/id/Cheap-obstacle-sensor-with-Arduino/
Intro: Cheap obstacle sensor - with Arduino!
When I started with arduino, and electronics, I always wanted to do things the cheap way.
Step 1: Parts
You will need:
- Infrared LED
- Infrared photodiode
- Arduino
- Wires of some sort
- Electrical tape, duct tape, even hot glue!
- Heat shrink
- Perhaps a breadboard for testing
http://www.instructables.com/id/Cheap-obstacle-sensor-with-Arduino/
Step 2: Constructing the sensor 1, soldering
First off the sensor will be soldered together.
As you can see in the pictures, both the LED and the photodiode have a long and a short leg. The short legs should be connected to eachother like you can see in the
picture. Any questions?
Cut off a section of heat shrink a bit longer the black blob on your photodiode. Put it on and heat it! Easy, right?
Connect the long pin of the LED with +5v, the short pins to GND and the long photodiode lead to a pin on your Arduino. Preferably an analog pin. Set it as INPUT and
write it HIGH to activate the internal pullup resistor. The lower the value analogRead() gives, the closer something is.
an example code, you can upload this to your arduino board. The LED will light as soon as the obstacle comes close. Increasy the integer sensitivity to increase the
distance to activate. Watch out though! Too much and you won't be able to sense because of ambient light!
void setup()
{
pinMode(LED, OUTPUT);
pinMode(sensor, INPUT);
digitalWrite(sensor, HIGH);
Serial.begin(9600);
}
void loop()
{
distance = analogRead(sensor);
if (distance < sensitivity)
{
digitalWrite(LED, HIGH);}
else
{
http://www.instructables.com/id/Cheap-obstacle-sensor-with-Arduino/
digitalWrite(LED,LOW);
}
Serial.println(distance);
Related Instructables
Arduino motor Ultrasonic Arduino-based Ultrasonic Arduino reverse Ard-e: The robot
drives cheap Batgoggles by robot with IR Parking Sensor obstacle sensor with an Arduino
toy car (Photos) suneth radar by (Photos) by for cars by liudr as a brain by
by techbitar techbitar atatistcheff imadami
http://www.instructables.com/id/Cheap-obstacle-sensor-with-Arduino/