SHARP GP2Y0E03 Infrared Distance Sensor 4~50cm
Original price was: Rp115.000.Rp110.400Current price is: Rp110.400.
SHARP Sensor Jarak Inframerah Infrared 4~50cm GP2Y0E03 (Analog & I2C) #KR08220
21 in stock
Description
Sensor infrared ini dapat digunakan untuk mendeteksi objek, mengukur jarak robot dengan objek, membaca garis (cerah/ gelap, line follower), dan juga untuk navigasi robot.
Berikut ini keterangan pin daripada sensor Sharp GP2Y0E03 :
Kelebihan sensor tipe GP2Y0E03 ini adalah mampu mengeluarkan data analog dan digital (I2C), ada family lain daripada sensor ini antara lain GP2Y0E02A (output data analog) dan GP2Y0E02B (output data digital I2C). Perhatikan tabel perbandingan produk dibawah ini :
Sensor | Output | Voltage | X | Y | Z |
---|---|---|---|---|---|
GP2Y0E02A | Analog | 2.7-3.3V | 18.9 | 8.0 | 5.2 |
GP2Y0E02B | Digital (I2C) | 2.7-3.3V | 18.9 | 8.0 | 5.2 |
GP2Y0E03 | Analog + Digital | 2.7-5.5V | 11.0 | 16.7 | 5.2 |
GP2Y0E03 is a distance measuring sensor unit, composed of an integrated combination of CMOS image sensor and IR-LED. The variety of the reflectivity of the object, the environmental temperature and the operating duration are not influenced easily to the distance detection because of adopting the triangulation method. This device outputs the voltage corresponding to the detection distance and digital(I C) data. So this sensor can also be used as a proximity sensor.
Karena terdapat 2 pilihan koneksi data output (analog dan digital) maka dari itu kita bisa menghubungkan output data dari sensor ke controller (disini kita gunakan Arduino) sebagai berikut :
Vout – adalah koneksi output dari data analog sensor, jika kita mau menggunakan output analog dari sensor Sharp GP2Y0E03.
SDA & SCL – adalah koneksi output dari data digital sensor, jika kita mau menggunakan output digita;=l dari sensor Sharp GP2Y0E03.
Contoh script untuk pemrograman menggunakan Arduino dan Sharp GP2Y0E03 :
a. Koneksi Analog
const int sensorPin = A0;
void setup()
{
Serial.begin(9600);
pinMode(sensorPin, INPUT);
}
void loop()
{
auto raw = analogRead(sensorPin);
Serial.println(raw);
delay(100);
}
b. Koneksi Digital
#include <Wire.h>
// 7 highest bits
#define ADDRESS (0x80 >> 1)
#define SHIFT_ADDR 0x35
#define DISTANCE_ADDR 0x5E
#define RIGHT_EDGE_ADDR 0xF8 // C
#define LEFT_EDGE_ADDR 0xF9 // A
#define PEAK_EDGE_ADDR 0xFA // B
uint8_t distance_raw[2] = { 0 };
uint8_t shift = 0;
uint8_t distance_cm = 0;
char buf[100];
void setup()
{
Wire.begin();
Serial.begin(9600);
delay(2000);
Serial.println("Initializing");
Wire.beginTransmission(ADDRESS);
Wire.write(byte(SHIFT_ADDR));
Wire.endTransmission();
Wire.requestFrom(ADDRESS, 1);
if (1 <= Wire.available())
{
shift = Wire.read();
}
Serial.print("Read shift bit: ");
Serial.println(shift, HEX);
}
void loop()
{
// Read basic measurement
Wire.beginTransmission(ADDRESS);
Wire.write(byte(DISTANCE_ADDR));
Wire.endTransmission();
Wire.requestFrom(ADDRESS, 2);
if (2 <= Wire.available())
{
distance_raw[0] = Wire.read();
distance_raw[1] = Wire.read();
// Print distance in cm
distance_cm = (distance_raw[0] * 16 + distance_raw[1]) / 16 / (int)pow(2, shift);
sprintf(buf, "Distance %u cm", distance_cm);
Serial.println(buf);
}
else
{
Serial.println("Read error");
}
delay(1000);
}
Additional information
Weight | 0,001 kg |
---|---|
Skill Programming | Level 3 |
Skill Elektrikal | Level 3 |
Skill Robotika | Level 1 |
Skill DIY - Do it yourself | Level 1 |
Skill Soldering | Level 3 |