Problems with sharp distance sensor with zumo shield

Hi, I’ve just assembled my arduino zumo and connected my sharp GP2Y0D805Z0F distance sensor. The sensor seems to work as it should when the shield is turned off and its only powered by usb, but when i turn on the shield it keeps reading low (obsticle) even when there is nothing in front of it. It’s not constantly low but reads low and high inconsistently and always low when nothing is in front of it on a long distance. I don’t know what’s wrong and why this only happens when the shield is turned on. I’ve connected the output to digital I/O pin 2 in the front expansion area via the pololu sharp sensor carrier.


What Arduino board are you using and what sketch are you running?

Digital pin 2 has a couple different optional uses that could be conflicting with your readings, depending on how the hardware is set up and what your code is doing. For example, if you are using an Arduino Uno (or older Arduino) and have the LEDON jumper in place on the reflectance sensor array, pin 2 is used to enable dynamic control of the IR emitters. Additionally, if you are using an Arduino Leonardo (or one of our A-Star 32U4 Prime boards), pins 2 and 3 are duplicates of the I2C (SCL and SDA) pins, so using the I2C sensors (e.g. compass/gyro) on the Zumo would interfere with your readings.


Hi, I’m using an Arduino Uno and i’ve tried disconnecting the reflectance array but that yields the same result. I’ve also tried using pin 11 but it acts the same.


Since the sensor keeps reading low i tried connecting it to the Vin pin on the shield instead of the 5v pin which I was using, since Vin supplies a higher voltage of 7,45 V. With the new voltage the sensor seems to work correctly! But I am confused. Firstly because the product page for the sensor states that it has a opperating voltage of 2,7-6,2 V and secondly because now the red led on the carrier is always lit (but shines brighter when it reads low). Is the sensor intended to be used with the Vin pin?

Thanks for the additional information.

Powering that sensor with a voltage higher than the maximum operating votlage could damage it, so you should not be powering it directly from your Zumo’s VIN pin. Additionally, the output of the sensor when it is high is around VCC, so you shouldn’t use more than 5V since you are reading it from your Arduino.

I suspect when you were powering the sensor from the Arduino, it was drawing too much current from the Arduino’s 5V regulator, causing it to cut out. While the average current draw of that sensor is low, it draws current in quick bursts, so the instantaneous draw can be deceptively high. You might try placing a capacitor across the power and ground pins (close to the sensor) as we mention on the sensor’s product page to see if that gives you more stable operation. 10 µF is probably a good starting point.

By the way, pin 11 also is used by the front sensor array. Since you are using an Arduino Uno, pin 6 should be available.


Hi, the 10uF capacitor wasn’t quite enough but I added a 100uF instead and now it works just as it should! Thank you. :slight_smile: