Unable to make 80cm Infrared Proximity Sensor work


#1

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?

Thanks,
Carlos


#2

Anyone from Dexter Industries support???


#3

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!


#4

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?

Thanks


#5

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

ie:

import grovepi
print(grovepi.analogReadPin(0))

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:
https://www.dexterindustries.com/GrovePi/engineering/port-description/