Sharp_GP2Y0A02YK_IR_ranger_sensor__150cm___SKU_SEN0013_-DFRobot

Introduction

This SHARP infrared distance sensor takes a continuous distance reading and returns a corresponding analog voltage with a range of 20cm (8") to 150cm (60").It can be usually applied as obstacle avoidance and path planning sensor.

Specifications

Connection Diagram

sharpir.png

Sample code

/*
  description:
  The sample code is used to measure distance by GP2Y0A02YK IR ranger sensor.
  VCC -- VCC
  GND -- GND
  Signal -- Analog 1
*/

int IRpin = 1;                                    // analog pin for reading the IR sensor

void setup() {
  Serial.begin(9600);                             // start the serial port
}

void loop() {
  float volts = analogRead(IRpin)*0.0048828125;   // value from sensor * (5/1024) - if running 3.3.volts then change 5 to 3.3
  float distance = 65*pow(volts, -1.10);          // worked out from graph 65 = theretical distance / (1/Volts)
  Serial.println(distance);                       // print the distance
  delay(100);                                     // arbitary wait time.
}

Documents

GP2Y0A02YK IR ranger sensor Information

See reference of similar sharp distance sensor(100-550cm)

DFshopping_car1.png Get Sharp GP2Y0A02YK IR ranger sensor (150cm) from DFRobot Store or DFRobot Distributor.

Turn to the Top

category: Product Manual category: SEN Series category: Sensors