Connecting a Sharp GP2Y0D810Z0F Digital Distance Sensor with a Raspberry Pi 3

Hello there,

I have to connect the distance sensor to a Raspberry Pi for a project, but I have little experience and I am not very familiar with it.
I connected the distance sensor to the Raspberry Pi as I found it in the description:

  • Ground to GND
  • VIN to 3,3V
  • OUT to GPIO 24

I also wrote a code on my Raspberry Pi that outputs “interrupt” if the sensor detects something.

import time
import RPi.GPIO as GPIO


GPIO.setup(24, GPIO.IN)

while True:
i = GPIO.input(24)
if i == 0:
print (‘interrupt’,i)
elif i == 1:
print (‘no interrupt’,i)

My problem is that the LED on the sensor lights up all the time even though the description says that it should only light up if the output is low, indicating that the sensor is detecting something and If I execute the code, the sensor does not recognize anything.
Unfortunately I don’t know enough about this topic to find a solution.



I’m sorry you are having issues with your distance sensor. If the LED on the sensor is not giving the behavior you expect, we should start by troubleshooting that without the RPi for now. Could you remove the connection to GPIO 24 and see if that changes the LED behavior? Could you post the product number of the distance sensor you are using? Could you also post pictures or video of how you are testing the sensor?


Hello Claire
Thank you for your response. We found a solution to the problem. We made a mistake with the wiring after we fixed it the sensor works perfectly.

I’m glad you got it working. Thanks for letting us know what the issue was.