Pololu/Sharp 10 cm sensor help


I recently purchased one of the Pololu Carrier with Sharp GP2Y0D810Z0F sensor boards and I am trying to hook it up to my PIC controller on a bread board. I have the controller and everything running and I have the board wired to the GND and 5V and the led on the back lights up fine. But when I wire the output in the board to the input on my PIC, the Pololu board does not respond (the led does not turn on and off) and when I test the voltage between GND and OUT I get ~5v when nothing is in front and ~4.3 when something is in front. Also I figure I do not need a pull up/down resistor because its on the board already, I would just like to verify that.

Thank you Very Much


There are no extra pull-up or pull-down resistors required. Since the LED was turning on before you connected it to the PIC, the sensor must have been driving the line low. It sounds your program is attempting to use the sensor line as an output, preventing the sensor from driving it low. Can you check or post your PIC code to make sure that it isn’t outputting a voltage on that line? Another thing you can do is remove the sensor and measure the voltage on that PIC pin.


EDIT: I figured it out, thanks for the help. In my code below I have TRISD = 1; which would only set one of the pins as an output. I got it now thanks

To make sure it was outputting properly I replaced the sensor with just a button and it worked fine with that.

#include <p18f4550.h>

void main(void)

	//Set PORTB and PORTC as outputs
	TRISB = 0;
	TRISC = 0;

	//Set PORTD as outputs
	//TRISD = 1;
	TRISD = 0xFF;
	//Turn off all the LEDs
	PORTC = 0;

	//Set as status LED
	PORTB = 0xFF;

			PORTC = 0xFF;
			PORTC = 0;

(all the configuration bits are set though MPLAB)

I removed the sensor and the voltage between the PIC input and GND is 5v and between PIC Input and 5V is 0

As soon as plug the input to the out on the sensor the light on the sensor will turn off (if it was on)

Great, I’m glad you got it working! Good luck with your project and please let us know if you have more questions.