Jump to content

Distance sensor (like "D-Beam" controler)


Recommended Posts

Posted

Hi all,

In my midibox project I use that distance sensor SHARP GP2D120; its datasheet is available here :

http://document.sharpsma.com/files/GP2D120_SS_final.pdf

If I connect directly the sensor on the J5, instead of reading 0 when in IDLE (nothing in front of my sensor) I read a flow of 0 and 1 that alternates very fast, as if it hesitates between the two values. Now if I put something (that does not move) in front of the sensor, I read for instance 34 35 34 35 34 35 34 35 etc. The digit 3 is displayed constantly while the LCD oscillates between 4 and 5.  >:(

I know that the PIC waits for a voltage range of 0 - 5 while that sensor gives 0.3 - 3. I suppose that's the reason of flickering values ...

Any idea to use that sensor correctly ?  ???

Thanx guys & gals,

Olivier

Posted

Hi Oliver,

according to the datasheet, the output voltage is up to Vcc+0.3V (but it can be assumed: Vcc == 5V). So, it could be that there is a problem with the connections.

If you still notice the flickering values, you have to reduce the resolution of the AIN driver. The easiest way is to increase the value which is passed to MIOS_AIN_DeadbandSet (7 means: 7bit resolution, 15 means: 6bit resolution)

Best Regards, Thorsten.

  • 4 weeks later...
Posted

Waw an answer from the boss himself !  :D

I'll get my hands on it tonight (after a period of holidays) so ... thank you for your advice, I had already had tested this function but didn't know what was the different values possible  ::)

Thanks again and (forget if I repeat) Midibox is really a very very nice electro-open-source project !! Keep up the good job, your mother might be proud of you !  ;D (and forgive my bad english)

Seeya

Olivier "top 10 of your greatest fans" Goule  8)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...