Infrared obstacle / Avoidance Sensor is an ambient light sensor adaptable can be place on your wheeled robots for obstacle avoidance or distance sensor. This sensor has a high precision components paired of infrared transmitter and receiver. The transmitter tubes emit a certain frequency of infrared when detecting a direction or obstacle or a reflector the infrared receiver tube receive a reflected signal came from the obstacle then the indicator output will turn to HIGH as you can see at the board there are two type of trimmer or potentiometer knob to adjust the distance from 2 to 40 cm. running at 3.3v or 5v dc.
Required Components
UNO / MEGA / NANO / PRO / DUE / RPI / ESP8266 / STM
Obstacle Avoidance Sensor Board
Solder Less Bread Board
Jumper Wires / DuPont Wires
Wiring Guide
Source Code / Sketch Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
/* 14CORE Test Code for: Obstacle Avoidance Sensor .:+osysso++:` `+yhs/-` `-+s+` `:/+++++++++` .:/++ooo++/-` .ooooooooooo+: :///////////- `odh/` `:y+` /ddhsooooooo+ /hddhsooooydddh sdddoooooosdddy` `////////////` -hds` `sy. +ddy` .ddd: sddy.dddo +ddd- .-----------` `hds :sssss/ -ossssso-yy` `hdd: oddy `ddd/oddd:......+dddo .++++++++++++ +dd` :sdddh` :ydddddddo +y/ .ddd+........ `hddy:.....:yddy.hdddddddddddy+. ```````````` ydy .hddd/+hdddhydddh/.+yo /hdddddddddd. :shddddddddhs/`+ddd:````-yddy- :ooooooooooo+ odh` sdddooyyyyyhddddyy.sy+ ` `......... ``.... ....` ```...` ` `` `` ` -dd+`::::` .:::- /yy. -oos+:-oos+--oos+: /o `+y o/: o:+/ h:`yos /+-`/+/+ s:y/y. /dd/ `+yy: +//+ +/:+ +/:+ -. `/ -:o.:/:`//+- + +:- :`-+:`://: +`o`+. -yds. `/yys- .`-.. .``` ```` .`` ` ` ``` ``-..` ` :ydy/.`````.-/oyhs: `+++oo+oo+:.+-++/-/ooo+o +:o/oo///:+/ .:oyhhhhhhhso:` `. ``` */ int LedOutput = 12;// Define as LED Output Pin 12 you can change this to 13 if you don't use pin 12 as output indicator int SensorPin = 2; // Define as Sensor Pin Input int Value;// Define as variable void setup() { pinMode(LedOutput,OUTPUT);//Set as LED output pinMode(SensorPin,INPUT);//Set as photo interrupter sensor output interface } void loop() { Value=digitalRead(SensorPin);// Set as sensor read SensorPin if(Value==HIGH) //If value is equal to HIGH estate then turn LED output = high { digitalWrite(LedOutput,HIGH); // Set LedOutPut to HIGH or ON } else { digitalWrite(LedOutput,LOW); // Set LedOutPut to LOW or OFF } } |