This SHARP distance sensor bounces IR off objects to determine how far away they are. It returns an analog voltage that can be used to determine how close the nearest object is. Comes with 12″ long 3-JST interface wire. These sensors are good for short-range detection. For over 1 m distance, we suggest using sonar sensors
To use, connect black wire to ground, red wire to 5V and white wire to analog input. The analog voltage out will range from 3V when an object is only 4″ (10 cm) away and 0.4V when the object is 32″ (80 cm) away.
- Operating voltage: 4.5Â V to 5.5Â V
- Average current consumption: 30 mA (note: this sensor draws current in large, short bursts, and the manufacturer recommends putting a 10 µF capacitor or larger across power and ground close to the sensor to stabilize the power supply line)
- 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)
- Update period: 38 ± 10 ms
- Size: 44.5 mm × 18.9 mm × 13.5 mm (1.75″ × 0.75″ × 0.53″)
- Weight: 3.5Â g (0.12Â oz)
Program for Module:
#define sensor A0 // Sharp IR GP2Y0A41SK0F (4-30cm, analog) void setup() { Serial.begin(9600); // start the serial port } void loop() { // 5v float volts = analogRead(sensor)*0.0048828125; // value from sensor * (5/1024) int distance = 13*pow(volts, -1); // worked out from datasheet graph delay(1000); // slow down serial port if (distance <= 30){ Serial.println(distance); // print the distance } }
Reviews
There are no reviews yet.