Stufin
Home Quick Cart Profile

Sharp GP2Y0D810Z0F Digital Distance Sensor

Buy Now

Datasheet

Available from Sharp's official website

Application Notes

Provided by Sharp and third-party sources

Sample Code

Available for popular microcontrollers, such as Arduino and Raspberry Pi

Conclusion

The Sharp GP2Y0D810Z0F digital distance sensor is a reliable and accurate component for measuring distances in a wide range of applications. Its compact design, low power consumption, and digital output make it an ideal choice for developers and engineers working on IoT projects, robotics, and industrial automation systems.

Pin Configuration

  • Sharp GP2Y0D810Z0F Digital Distance Sensor Pinout and Connection Guide
  • The Sharp GP2Y0D810Z0F is a popular digital distance sensor commonly used in robotics, automation, and IoT applications. It has a total of 6 pins, which are explained below:
  • Pin 1: VCC (Power Supply)
  • Function: Provides power to the sensor module
  • Voltage: 4.5V to 5.5V (recommended 5V)
  • Connection: Connect to the positive terminal of a power source (e.g., a 5V pin on an Arduino board)
  • Pin 2: GND (Ground)
  • Function: Provides a ground reference for the sensor module
  • Connection: Connect to the negative terminal of a power source (e.g., a GND pin on an Arduino board)
  • Pin 3: SIG (Signal)
  • Function: Outputs a digital signal indicating the distance measurement
  • Connection: Connect to a digital input pin on a microcontroller (e.g., Arduino, Raspberry Pi, etc.)
  • Pin 4: NC (No Connection)
  • Function: Not connected internally; can be left unconnected
  • Pin 5: NC (No Connection)
  • Function: Not connected internally; can be left unconnected
  • Pin 6: NC (No Connection)
  • Function: Not connected internally; can be left unconnected
  • Connection Structure:
  • Connect the VCC pin (Pin 1) to a 5V power source.
  • Connect the GND pin (Pin 2) to a ground reference.
  • Connect the SIG pin (Pin 3) to a digital input pin on your microcontroller.
  • Leave Pins 4, 5, and 6 unconnected.
  • Example Connection Diagram:
  • Sharp GP2Y0D810Z0F Digital Distance Sensor Arduino Board
  • +---------------+
  • | VCC (Pin 1) |
  • +---------------+
  • | |
  • | Connect to |
  • | 5V pin |
  • +---------------+
  • | GND (Pin 2) |
  • +---------------+
  • | |
  • | Connect to |
  • | GND pin |
  • +---------------+
  • | SIG (Pin 3) |
  • +---------------+
  • | |
  • | Connect to |
  • | Digital Input |
  • | Pin (e.g., D2) |
  • +---------------+
  • Note: Ensure proper power supply and ground connections to avoid damage to the sensor module. Additionally, follow the recommended voltage and current ratings for the sensor to operate correctly.

Code Examples

Sharp GP2Y0D810Z0F Digital Distance Sensor Documentation
Overview
The Sharp GP2Y0D810Z0F is a digital distance sensor module that uses infrared technology to measure distances from 2 cm to 150 cm. It is a compact, low-power device suitable for various applications, including robotics, automation, and IoT projects.
Pinout
VCC: Power supply (5V)
 GND: Ground
 OUT: Digital output signal
Technical Specifications
Measuring range: 2 cm to 150 cm
 Output type: Digital (HIGH or LOW)
 Output pulse width: 10 ms to 150 ms (proportional to distance)
 Power consumption: 5 mA (typical)
 Operating voltage: 4.5 V to 5.5 V
 Operating temperature: -20C to 60C
Code Examples
### Example 1: Basic Distance Measurement using Arduino
This example demonstrates how to use the Sharp GP2Y0D810Z0F to measure distance using an Arduino board.
```c
const int sensorPin = 2;  // Connect OUT pin of sensor to digital pin 2 on Arduino
void setup() {
  Serial.begin(9600);
  pinMode(sensorPin, INPUT);
}
void loop() {
  int distance = readDistance();
  Serial.print("Distance: ");
  Serial.print(distance);
  Serial.println(" cm");
  delay(50);
}
int readDistance() {
  int pulseWidth = pulseIn(sensorPin, HIGH);
  int distance = pulseWidth / 58;  // Convert pulse width to distance (cm)
  return distance;
}
```
In this example, the `readDistance()` function uses the `pulseIn()` function to measure the pulse width of the digital output signal from the sensor. The pulse width is then converted to a distance value (in cm) using the formula: `distance = pulseWidth / 58`.
### Example 2: Object Detection using Raspberry Pi (Python)
This example demonstrates how to use the Sharp GP2Y0D810Z0F to detect objects using a Raspberry Pi and Python.
```python
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
sensor_pin = 17  # Connect OUT pin of sensor to GPIO pin 17 on Raspberry Pi
GPIO.setup(sensor_pin, GPIO.IN)
while True:
    if GPIO.input(sensor_pin):
        print("Object detected!")
    else:
        print("No object detected.")
    time.sleep(0.1)
```
In this example, the script uses the RPi.GPIO library to read the digital output signal from the sensor. When the signal is HIGH, it indicates that an object is detected, and the script prints a corresponding message.
Note: These examples are for illustrative purposes only and may require modifications to suit specific project requirements. Always consult the datasheet and documentation provided by the manufacturer for detailed information on the component's usage and limitations.