Shop OBEX P1 Docs P2 Docs Learn Events
Sharp GP2D12 IR Sensor — Parallax Forums

Sharp GP2D12 IR Sensor

stevepstevep Posts: 2
edited 2010-02-03 05:44 in Accessories
I am new to this forum/concept so I hope I am doing it correct. I have a Sharp GP2D12 IR Sensor, a bs2, and a bot board 2. Question: I am trying to initiate autonomous/avoidance behavior with said sensor. It is working except for the fact that the distance is off. It will only read a certain distance, ~7 inches, which would be fine, but with the 10 lb robot, when it goes into its stop routine it crashes into the obstacle due to its momentum. I seem to have done all that I can with the motor routines, so how can I adjust the distance that the sensor reads and adjust for that? I know that I am missing something here, but I just don't know what. Thank you very much for your help.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2010-02-03 05:44
    The Sharp GP2D12 IR Sensor has an analog output that's proportional to the distance detected (from 10cm to 80cm). If you're directly connecting the analog output to a BS2 I/O pin, you're relying on the Stamp's input logic threshold to set the detection threshold. This input threshold is roughly 2V (set by the Vih characteristic of the PIC16F57 used on the BS2 module) and is not adjustable. You can either use an external ADC like the ADC0831 or you can use the RCTIME statement to measure the input voltage as described under RCTIME here: www.emesystems.com/BS2index.htm#misc
Sign In or Register to comment.