Electronics

IR Distance Sensor GP2Y0A21YK0F With Cables

AED 68.25

Low stock
1

Description

The IR GP2Y0A21YK0F distance sensors are a popular choice for many projects that require accurate distance measurements. This IR sensor is more economical than sonar rangefinders, yet it provides much better performance than other IR alternatives. Interfacing with most MCU's is straightforward, the single analog output can be connected to an ADC for taking distance measurements, or the output can be connected to a comparator for threshold detection like any operational amplifier like LM741. The detection range of this version is approximately 10 cm to 80 cm


Description:

  • Operating voltage: 4.5 V to 5.5 V
  • Average current consumption: 30 mA (typical)
  • Distance measuring range: 10 cm to 80 cm (4" to 32")
  • Output type: analog voltage
  • Output voltage differential over distance range: 1.9 V (typical)
  • Response time: 38 ± 10 ms
  • Package size: 29.5×13.0×13.5 mm (1.16×0.5×0.53")
  • Weight: 3.5 g (0.12 oz)


Advice for the optics :

The lens of this device needs to be kept clean. There are cases that dust, water, or oil, and so on deteriorate the characteristics of this device. Please consider in actual application. • Please don't wash. Washing may deteriorate the characteristics of the optical system and so on. Please confirm resistance to chemicals under the actual usage since this product has not been designed against washing. 


How to connect GP2Y0A21YK0F the with Arduino:


GP2Y0A21YK0F SENSOR

ARDUINO

1. Vout

A0

2. GND

GND

3. Vcc

5V

 

 

 

 

 

 

 


 

IR-Distance-Gp2y0a21yk0f-Sensor-Connections-with-Arduino



Arduino code for IR GP2Y0A21YK0F distance sensors:


void  setup ( )  { 
  // // 
  Serial communication at 9600 baud Serial . begin ( 9600 ) ; 
}


void  loop ( )  { 
  // We read the average of the analog input 0 
  int  ADC_SHARP = ADC0_average ( 20 ) ;
 
  Serial . println ( ADC_SHARP ) ; 
  delay ( 10 ) ; 
}

int  ADC0_average ( int  n ) 
{ 
  long  sum = 0 ; 
  for ( int  i = 0 ; i < n ; i ++ ) 
  { 
    sum = sum + analogRead ( A0 ) ; 
  }   
  return ( sum / n ) ; 
}


you can open the serial plotter and see the output in stream


IR-Sensor-ADC-Output-on-serial-plotter