Sharp IR Sensor

Introduction


Whether you’re making an obstacle avoidance robot or a bean counter, Sharp IR sensor will prove the best to get the job done. Unlike sonar sensors, Sharp IR sensors have a much narrower sensing beam, which allows them to accurately measure distance in a small area.


 

Theory of Operation


    The sensor uses an IR emitter and an IR receiver placed at a curtain distance from the emitter. The IR emitter emits a sharp beam. When the beam hits an object it is reflected back to the IR receiver, and by knowing the fixed distance between the emitter and receiver (and some trigonometric calculations) the distance can be calculated.


Technical Details


Maximum range:    80 cm
Minimum range:    10 cm
Sampling rate:    26 Hz1

Minimum operating voltage:    4.5 V
Maximum operating voltage:    5.5 V
Supply current:    30 mA2

Output type:    analog voltage
Output voltage differential:    1.9 V
 
    

Connections




Code



#include <SharpIR.h>

// define a sensor as follows:
// SharpIR sensorNameHere(model,pin);
SharpIR myCoolSensor(GP2Y0A21YK0F, A0);

void setup()
{
  Serial.begin(9600); //Enable the serial comunication
}

void loop()
{
  // to read the sensor:
  // variableName = sensorNameHere.getDistance();
  int distance = myCoolSensor.getDistance();
 
  Serial.println(distance); //Print the value to the serial monitor
}

    



We ship to the GCC and MENA regions.

Reliable and fast shipping to your door, quality assured.

More about shipping

Find us on
Instagram

Just type @idea_link

Visit our profile