Sensor will not respond, help?
Macadaciouse
Posts: 16
I'm using the sharp GP2Y0D340K IR range sensor for an obstacle-avoiding robot.
(datasheet: http://sharp-world.com/products/device/lineup/data/pdf/datasheet/gp2y0d340k_e.pdf)
I had it working a few months ago (briefly) but then of course I was called away to other projects and forgot how I had it set up. I can't even figure out how to connect it to the breadboard without it overheating. The most logical setup seems to be
1-Vdd
3-in 15
4-Vss
This setup is used here with apparent success: http://courses.cit.cornell.edu/ee476/FinalProjects/s2007/bt48_rsr32/bt48_rsr32/sensorcrt.jpg
No matter what I do though, my board will not respond to the sensor. If everything is plugged in, I get an endless stream of 1's. If something is unplugged/loose, I get an endless stream of 0's or occasionally 1010101010 etc.
The test program I am using is as follows:
' {$STAMP BS2}
' {$PBASIC 2.5}
INPUT 15
test_routine:
DEBUG "sensor = ", BIN1 IN15, CR
GOTO test_routine
Is something not hooked up correctly? Is the programming wrong? I've had about as much as I can stand from this project, this just shouldn't be that difficult. Please, if anyone has any advice I'll give it a shot, I'm about to just pitch the sensor all together.
My end goal is a robot that will turn when it encounters a wall, the program I wrote a few months ago is as follows:
' {$STAMP BS2}
' {$PBASIC 2.5}
main:
IF IN15 = 1 THEN
GOSUB go
ELSE
GOSUB turn
ENDIF
go:
HIGH 14
HIGH 13
DEBUG "go"
GOTO main
turn:
LOW 14
LOW 13
HIGH 12
HIGH 11
DEBUG "turn"
PAUSE 500
LOW 11
PAUSE 500
LOW 12
HIGH 14
HIGH 13
GOTO main
(datasheet: http://sharp-world.com/products/device/lineup/data/pdf/datasheet/gp2y0d340k_e.pdf)
I had it working a few months ago (briefly) but then of course I was called away to other projects and forgot how I had it set up. I can't even figure out how to connect it to the breadboard without it overheating. The most logical setup seems to be
1-Vdd
3-in 15
4-Vss
This setup is used here with apparent success: http://courses.cit.cornell.edu/ee476/FinalProjects/s2007/bt48_rsr32/bt48_rsr32/sensorcrt.jpg
No matter what I do though, my board will not respond to the sensor. If everything is plugged in, I get an endless stream of 1's. If something is unplugged/loose, I get an endless stream of 0's or occasionally 1010101010 etc.
The test program I am using is as follows:
' {$STAMP BS2}
' {$PBASIC 2.5}
INPUT 15
test_routine:
DEBUG "sensor = ", BIN1 IN15, CR
GOTO test_routine
Is something not hooked up correctly? Is the programming wrong? I've had about as much as I can stand from this project, this just shouldn't be that difficult. Please, if anyone has any advice I'll give it a shot, I'm about to just pitch the sensor all together.
My end goal is a robot that will turn when it encounters a wall, the program I wrote a few months ago is as follows:
' {$STAMP BS2}
' {$PBASIC 2.5}
main:
IF IN15 = 1 THEN
GOSUB go
ELSE
GOSUB turn
ENDIF
go:
HIGH 14
HIGH 13
DEBUG "go"
GOTO main
turn:
LOW 14
LOW 13
HIGH 12
HIGH 11
DEBUG "turn"
PAUSE 500
LOW 11
PAUSE 500
LOW 12
HIGH 14
HIGH 13
GOTO main
Comments
According to the datasheet, you should get a "1" output whenever there's something in front of the sensor at any distance up to about 0.4m.