2
\$\begingroup\$

I am using the SHARP GP2Y0A21YK0F IR distance sensor. According to the datasheet, the output voltage to distance graph should look as follows:

enter image description here

I attached the sensor to a power source straight from Arduino 5V output, so the power source is relatively steady. The sensor's analog output is attached to a multimeter to check the output voltage for the varying distances of a white sheet in front of the sensor.

Until approximately 45cm distance of the white sheet from the sensor, the sensor works fine. The multimeter reads are consistent with the graph's curve (except the 0cm reading). But after 45cm, the voltage goes up instead of decreasing further, until it reaches 1.57V, when there is no object in front of the sensor.

My readings of the multimeter are as follows:

    Distance[cm]      Voltage[V]   


    0                 1.7   
    5                 3.10  
    10                2.45   
    15                1.9   
    20                1.36   
    25                1.17  
    30                1.05   
    35                1.02   
    40                1.00  
    45                1.01   
    50                1.03   
    55                1.06   
    60                1.10 
    65                1.12 
    70                1.16   
    75                1.21  
    80                1.25  
    infinity          1.57   

I understand that for distances greater than 45cm the readings can be off because of effects caused by the surroundings (even though my testing environment is a closed clean room, but still maybe something causes faulty readings). What bothers me most is the voltage readings when no objects are in range. The sensor outputs 1.57V which is the same as 15-20cm range voltage, which can be problematic for my project as I intend to measure distances in the 10-40cm range.

What could be wrong?

\$\endgroup\$
7
  • \$\begingroup\$ Try turning the lights off in the room. \$\endgroup\$ – Andy aka Sep 9 '19 at 11:16
  • \$\begingroup\$ What kind of surface do you use to measure the distance to? \$\endgroup\$ – MatsK Sep 9 '19 at 11:33
  • \$\begingroup\$ @Andyaka Tried it in a dark room, same result. \$\endgroup\$ – Alexey Kiryushkin Sep 9 '19 at 12:07
  • 1
    \$\begingroup\$ Some of these sensors draw considerable pulse current from the DC supply during a measurement. Data sheet cautions to add a large capacitor to its DC supply terminals - have you done this? \$\endgroup\$ – glen_geek Sep 9 '19 at 12:44
  • 1
    \$\begingroup\$ Have you got bypass caps near the IR module? I once had the luxury of working with a sister model of these modules in a design. I bet Arduino 5V is not clean any more after connecting one of these modules - the 10uF bypass suggestion is no joke. The average consumption might be the rated 30mA, but it drives the IR LED with low-duty high current pulses. \$\endgroup\$ – Justme Sep 9 '19 at 14:56
2
\$\begingroup\$

Seems the issue was power spikes after all. I added a 100uF capacitor across the Vcc and GND connections on the sensor and it solved the issue.

Datasheet recommends 10uF which I tried first but 100uF did the trick.

Thank you very much for your answers

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.