Unable to make 80cm Infrared Proximity Sensor work

Hi all,

I purchased a bunch of “80cm Infrared Proximity Sensor” devices and I’m unable to make them work as expected.

Once connected to D4, as per the sample instructions, when I run the “grove_infrared_distance_interrupt.py” sample (with and without sudo), I always get “found something” result. No matter that there’s nothing in front of the sensor for way more than 80cm.

Is there anything special that must be done to make it work?


1 Like

Anyone from Dexter Industries support???

1 Like

Hi @ccasares,

Can you give us a link to the sensor you have bought?

Also, I think you may be running the wrong script. This is, I guess, the one you need to run:

Thank you!

1 Like

Hi Robert,

Sorry for my late response. You’re right. I now recall I also tried that script (grove_80cm_infrared_proximity_sensor.py). When I run it, using sudo and making sure I connect the sensor to the A0 port, I always get the following responses ranges, no matter I place my hand in front of the sensor (1cm) or leaving no object in front of it:

sensor_value: min=350 max=374
voltage: min=1.71 max=1.83

I’m not sure whether the sensor is really working or not, but I see no real difference when I place my hand or not at all.

I purchased 7 devices and tried all of them. Same result with all. BTW, this is the sensor: https://www.seeedstudio.com/Grove-80cm-Infrared-Proximity-Sensor-p-788.html

Any idea?


1 Like

You should be able to read the analog value from this sensor with the python function analogRead(pin)


import grovepi

The value should change as you move an object in the detection range of the sensor (10cm to 80cm).

Ideally you’ll probably want to loop and average several readings, but this should get you started.

Info. about analogRead(pin) and GrovePi port descriptions here:

1 Like

All these years later I’ve exactly the same issue as OP and I’m wondering how he managed to solve it. Because no matter what I put in front of it I always get the same read out no matter if it’s 10 cm or 80 cm. I switched pins, switched read outs switched everything I can possibly switch but it’s always ~10cm. Code I’m using:

import time
import grovepi

class ProxySensor:
    def __init__(self, sensor):
        self.sensor = sensor # an integer
        grovepi.pinMode(sensor, "INPUT")
        time.sleep(1) # this is a hardware thingy

    def read(self):
        adc_ref = 5
        total = 0
        for i in range(20):
            sensor_value = grovepi.analogRead(self.sensor)
            total += sensor_value

        total_value = total / 20

        return (
            round((float)(total_value) * adc_ref / 1024, 2)

def main():
    proxy_sensor = ProxySensor(1)
    while True:

if __name__ == '__main__':
1 Like