Simple IR proximity sensor with Arduino Uno
I made an IR proximity sensor with Arduino. It’s quite simple and precise.
I hope you’ll enjoy it.
To build this you are going to need:
- Arduino
- 1 IR LED receiver (photodiode with 2 pins, not the phototransistor with 3 pins)
- IR LED emitters (as much as you can get, but at least 2)
- 100K resistor (brown black yellow)
- Jumper wires
- Breadboard
- LED or Buzzer(optional)
Getting Ready:
Buy everything you’re gonna need and if you don’t know where to buy them from i would suggest the following websites if trust.
If you live in India you can get these here:
Thingbits.net is an online store to buy electronics kits, spare parts, development boards like Arduino, Raspberry Pi…www.thingbits.net
And if you live elsewhere you can probably get them here:
www.adafruit.com or www.sparkfun.com
Now that you have everything you need. You should get on it now.
The Code:
You can reference code from the link below:
http://www.instructables.com/id/Simple-IR-proximity-sensor-with-Arduino/step3/Code-time/
Connecting the Circuit:
Before connecting the circuit don’t forget to unplug power from your Arduino. Be safe!
- Connect anode of the IR receiver with 100k resistor and the other end of the resistor with the power. Also connect this anode to the analog pin A0 of the Arduino.
- Now Connect the anodes of the IR emitters with the digital pin 2 of the Arduino.
- Connect all the cathodes to the ground.
- Lastly connect the buzzer to the digital pin 11(pwm) and other end of the buzzer to the ground
Upload the code to Arduino and plug in the battery. And Start having fun with it!