Author Topic: Sharp GP2Y0D810Z0F Digital Distance Sensor 10cm  (Read 5883 times)

0 Members and 1 Guest are viewing this topic.

Offline arigidTopic starter

  • Jr. Member
  • **
  • Posts: 22
  • Helpful? 0
Sharp GP2Y0D810Z0F Digital Distance Sensor 10cm
« on: May 01, 2013, 05:25:24 PM »
Has anyone worked with these before?

http://www.pololu.com/catalog/product/1134

I have the one with the Carrier board, Connections seem to be simple.
I have the OUT to the Arduino Digital Pin, GND to GND, and the Vin to 5 V.

The Problem is that i never see a light on the back of the sensor.However when i connect the 3.3V to the Vin, it lights up, but the light never goes off, even when there is no obstacle in front of it.

Has anyone who has used these before, offer some advice.
Also, the datasheet says it might be good to have a Capacitor in between the GND and the Power, which i am yet to test, Why would that solve the problem?
I thought it would just make the power supply stable.

Thanks for any help!

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,345
  • Helpful? 82
Re: Sharp GP2Y0D810Z0F Digital Distance Sensor 10cm
« Reply #1 on: May 01, 2013, 10:55:06 PM »
I used them for obstacle avoidance for a Zumo, and they worked just as advertised.
Is it possible you damaged it when soldering the headers onto it?
If not, then it's likely a bad board. That's not common, but it can happen.
The capacitor is needed if your power supply is not low impedance -- if you use a weak regulator, poor filtering, small batteries, or long connection wires. It makes the sensor see a stable voltage source; an unstable voltage source may confuse the sensor in undocumented ways.

paulstreats

  • Guest
Re: Sharp GP2Y0D810Z0F Digital Distance Sensor 10cm
« Reply #2 on: May 02, 2013, 04:51:37 PM »
You start by saying that you connect 5v to the Vin then in the next paragraph say that you connect 3.3v to the Vin? Are you saying it works fine under 5v but not under 3.3v?

 Also do you have capacitors on your power line, sometimes the power draw that happens when the sharp sensor start lighting up their IR can be enough to cause a significant drop that causes faulty operation not only to itself but also anything else (such as your microcontroller) that is relying on that power.

Offline arigidTopic starter

  • Jr. Member
  • **
  • Posts: 22
  • Helpful? 0
Re: Sharp GP2Y0D810Z0F Digital Distance Sensor 10cm
« Reply #3 on: May 02, 2013, 05:01:13 PM »
Surprisingly, it worked after trying another time.

paulstreats

  • Guest
Re: Sharp GP2Y0D810Z0F Digital Distance Sensor 10cm
« Reply #4 on: May 03, 2013, 06:30:49 AM »
Are you happy with the digital output? Ive just this morning finished fiddling with resistor values etc to get a good range and analog output from a plain IR LED an IR phototransistor and 2 resistors. total cost being less than $0.50. Its output ranges from 0.5V at just beyond 30cm to 4.75V at 1 cm (not linear). In dim light. In normal room lighting its around 1.15V at just beyond 30cm.

Im doing some tests next week on the same pair using lower value resistors but including an extra transistor along with the phototransistor to make a Photodarlington to see how far i can push the distance but for what i want it for, im more than happy with 30cm.

 I can post a quick schematic with values and part numbers late tonite if you like? You might not be able to get the exact IR LED and phototransistor I used but they are pretty standard so like for like versions should be easy enough to find.

 After Im finished playing with (oops... testing) the photodarlington pair, i'll probably do a tutorial somewhere on making a slightly more advanced IR detector

Offline arigidTopic starter

  • Jr. Member
  • **
  • Posts: 22
  • Helpful? 0
Re: Sharp GP2Y0D810Z0F Digital Distance Sensor 10cm
« Reply #5 on: May 03, 2013, 03:57:55 PM »
I always prefer buying sensors if the application is something important.
Homemade sensors always have problems of reliability and accuracy.

The one i got from Pololu were with the board, and it is quite stable, however as the minimum range is pretty large, i didnt find use for these,But these are definitely good for the particular range applications.
I would love to see the schematic.

Thanks a lot!

paulstreats

  • Guest
Re: Sharp GP2Y0D810Z0F Digital Distance Sensor 10cm
« Reply #6 on: May 03, 2013, 05:21:44 PM »
Heres the schematic with part numbers and values for a simple IR emitter/ detector.

Again, this works reliably well ranging from 0.5V at 30cm to 4.75V at 1cm distance in a dim ambient light. In normal room light conditions it starts at just over 1V up to 4.75V



The IR emittor in this example is always on, the datasheet suggests it can be used with a smaller resistor (works out at 40ohm) for short bursts, 22ms if i remember right, but im going to test it as an always on LED with an 80ohm resistor too to make it brighter and increasing the overall range.

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,345
  • Helpful? 82
Re: Sharp GP2Y0D810Z0F Digital Distance Sensor 10cm
« Reply #7 on: May 03, 2013, 11:59:09 PM »
I predict that sunlight would disable this sensor.
In fact, I predict that certain floodlights would disable it too.
You could probably also point a remote control at it and confuse it.
The sensors you pay for (like the Sharp ones) use better modulation than simple "flood it with light" to get a little better sensitivity. Not that they are great, but they get rid of the first order of problems.

Not to knock your circuit at all -- if it actually solves the problem you have, then a cheap solution is great engineering! Just be aware of what problems it /doesn't/ solve, before you try to rely on it and something has an accident...

paulstreats

  • Guest
Re: Sharp GP2Y0D810Z0F Digital Distance Sensor 10cm
« Reply #8 on: May 04, 2013, 02:38:38 AM »
Im going to be a bit pedantic here, not to be argumentative but so people who are interested in making their own sensors arent put off trying them...

 First of all, yes sunlight does disable this sensor somewhat just the same as it affects Sharp sensors (they also suffer oversaturation, just like the eyes in your head become oversaturated in bright sunlight) Thats the reason Im doing tests with different resistor values and also intend to repeat the tests with the detector in a photodarlington setup so I can minimize oversaturation while maximizing the light I want.

 Sure floodlights also produce oversaturation issues, but the phototransistor is sensitive to light around the 850nm range, so floodlighting would have to include light of this range to make a significant difference. Floodlighting at the right range would also provide oversaturation on Sharp sensors.

 TV remotes can interfere, but this can be solved if needed by modulating the light which would be a software based solution (one which I intend to use if i need to in a way that i can switch modulation on or off if its needed to conserve runtime when its not). Just as tv remotes interfere with sensors, firing modulated light at the right frequency towards a Sharp sensor will also provide false feedback.. Thats why you should be careful when using more than one sharp sensor at once since they interfere with their own modulation. Making them yourself you can decide if you need to give each sensor its own independant modulation or not removing this problem entirely.

 I also plan on running software based high pass spike filters on multiple samples to further increase reliability.

 Sharp sensors also suffer from random spikes (there are many examples of them being connected to oscilloscopes to demonstrate it) for this reason I would suggest that people using them learn how to make software based high pass spike filters in order to be safe against them.

 Im not slating Sharp sensors, in fact i recommend their use and also have 2 of them in use at the minute, but they are tailored towards a generic audience and solve most light sensor issues in a generic way, but that means if you want to use them for something more specific then you are limited to the output they provide.

 There are problems that affect all sensors, which a premade device like a Sharp sensor can solve to provide an easy to use sensor with a degree of reliability, but you can also do the same for yourself and make something that is just as if not more reliable for your application - it is important to understand what those issues are in order to be able to address them. Making them yourself can allow you to do more in software too, such as background light cancelling and the such by being able to independantly control the emitter. Build in reliability algo's so you can decide whether that particular sensor input is reliable or not and do something else if not..

 Im going to be using 8 sensors of this type - Sharp sensors would no doubt interfere with each other rendering them unreliable and an over expensive solution as well as getting the satisfaction of knowing that I made em myself. :D

Offline Duane Degn

  • Jr. Member
  • **
  • Posts: 40
  • Helpful? 0
Re: Sharp GP2Y0D810Z0F Digital Distance Sensor 10cm
« Reply #9 on: May 04, 2013, 11:39:07 AM »
paulstreats, I'm betting you've seen this before, but I thought I'd post a link just in case you or someone else hadn't.

https://www.sparkfun.com/products/9542

They are little smt IR source and detector in one package. I believe they are commonly used in line following circuits.

SparkFun sells a couple of breakout boards for the sensor.

The Sharp sensors sure seem like overkill for a line follower. I'd think they'd be better used for object or drop off detection.

paulstreats

  • Guest
Re: Sharp GP2Y0D810Z0F Digital Distance Sensor 10cm
« Reply #10 on: May 04, 2013, 04:12:09 PM »
Yep, theyre the surface mount version of the QRD sensors, sometimes they can be driven with a longer range then they were designed for but they have unreliable and differing ranges they can be pushed and a very limited lifespan when you do, theyre typical range is less yhan 2.5cm so a bit small for my application,  which is a shame with them being in such a neat little package

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,345
  • Helpful? 82
Re: Sharp GP2Y0D810Z0F Digital Distance Sensor 10cm
« Reply #11 on: May 05, 2013, 09:27:23 PM »
First of all, yes sunlight does disable this sensor somewhat just the same as it affects Sharp sensors (they also suffer oversaturation, just like the eyes in your head become oversaturated in bright sunlight) Thats the reason Im doing tests with different resistor values and also intend to repeat the tests with the detector in a photodarlington setup so I can minimize oversaturation while maximizing the light I want.

But that's not the point here. Light with content within the IR spectrum shining into your detector will tell the detector there's something there, no matter whether it is or not. The reason for that is that it's basically just a "light detector" coupled with a "lamp" for a particular "color."

The reason I made my comment was that you seem to claim that this simple "flood" sensor is all that's needed for a robust sensor, and from what I know, that simply isn't so except in the most simplistic of cases.

Sensors that are more robust, modulate the output light at a certain frequency, and filter the input signal for that frequency of baseband. Note that this is a modulation frequency, like 38 kHz, rather than the bazillion-hertz-range light frequency I'm talking about :-) Thus, the analog receiver stage can de-modulate by looking for the presence of a 38 kHz signal within the general, flooded, IR input signal. As long as you don't saturate the sensor entirely (which can largely be prevented with an automatic gain control -- AGC circuit) then the carrier-modulator mechanism is more robust than the circuit you are showing. It is my understanding that the Sharp sensors use this mechanism. This is similar to how IR remote controls modulate the light signal with a carrier frequency (which is then also modulated with an actual bit pattern!)

So, that's what I'm getting at: Your detector does nothing to make sure that the light it detects comes from the light it's intended to read. The light emitter does nothing to make sure its signal is discernible from any other light signal in the same spectrum. Your sensor would take a significant step up in robustness if you modulated the output LED, and filtered the input signal for that frequency (or, at a minimum, filtered out DC from the input signal.) The simplest possible change to your circuit would be to drive the LED from a digital out pin on your microcontroller, and set it to PWM, and then add an RC filter to high-pass the output of the phototransistor (and then re-buffer it with an opamp or whatever.)

Here's an example of what I mean:



Pin change interrupts would be a great way of reading that sensor! (And it's a sketch; you'd probably have to tweak the component values some)

Try it! Run 10 kHz or better PWM, as that's the time constant of the RC filter. You'll likely find that it's a lot better at discrimination than the simple circuit you posted. It can be made a lot better still, for example with a much narrower filter around the modulating (PWM) frequency. Right now, it will detect a change of input light as a "change" no matter what, so you have to look for presence over some amount of time. You could also filter the post-opamp

Another good link if you want robust detector designs is this analog devices website and photo detector design tool: http://designtools.analog.com/dt/photodiode/photodiode.html
« Last Edit: May 05, 2013, 09:46:41 PM by jwatte »

paulstreats

  • Guest
Re: Sharp GP2Y0D810Z0F Digital Distance Sensor 10cm
« Reply #12 on: May 06, 2013, 05:46:47 AM »
Im sure i mentioned that setting frequency can be done in code... the idea right now is just to get it working and find the constraints. Really that kind of thing is common sense. Plus you can use light cancelling as a much simpler way if you require. Take a reading without the the LED's on, then switch on and take another reading. The first should be the background light, and the second should be a combination of the background light plus the light reflected from the LED's. So takes the first reading from the second reading and i'll be left with only the reflected light values. quick and easy as long as the sensor doesnt oversaturate (the reason im developing it in solid state to start with).

 My program will likely have direct read, background cancellation and frequency modulation built in but only use the second 2 when it becomes needed to save code and make a smart program that can decide whether to trust the sensors or to read them in a more advanced way when it needs to. Saving runtime etc...

 I do understand your concerns but somebody thats building something rather than using a generic off the shelf product is probably going to put time and effort into finding problems and trouble shooting and resolving them.

 The circuit diagram i posted was the setup right now and to demonstrate the basic principle, once i incorporate them into my robot, the leds wont be connected direct to the power supply but connected to the microcontroller via a mosfet or transistor to allow pulsing, and other things like PWM to conserve power in lower light conditions and of course switch them off during standby and the such.

 Im am spending a while on developing these, not just the hardware side but also the software side too, in order to develope a reliable and resilient detector that i can trust, I have faith in my ability so I believe that by the time im finished, my sensors will be as reliable as the off the shelf generic ones, only tailored to my needs. Im not saying they'll be suitable for all applications (I will be using 3 sharp sensors too and potentially the big 3 metre one ive got - currently set up as the head on my bug, it looks amazing! just the right size and the lenses big enough to look like eyes!!) and im not pushing them onto other people, just allowing them to decide whether to try and make their own and giving them a starting point.

Offline jwatte

  • Supreme Robot
  • *****
  • Posts: 1,345
  • Helpful? 82
Re: Sharp GP2Y0D810Z0F Digital Distance Sensor 10cm
« Reply #13 on: May 06, 2013, 12:10:34 PM »
Quote
I do understand your concerns but somebody thats building something rather than using a generic off the shelf product is probably going to put time and effort into finding problems and trouble shooting and resolving them.

Agreed! And they may find this thread when searching for information. And I think it would be great if this thread actually contained an illustration of a robust way of doing it.
Note that the schematic you posted does not support any of the features you mention in your later reply, as it just feeds the LED from +5V and has no de-coupling or filtering of the input signal.

Doing "cancellation" by reading twice is less robust than a proper high-pass filter, because it relies on the ADC being very precise AND covering your entire sensor working area. Typical AVR ADC implementations are actually pretty noisy in the last two bits, and thus give you perhaps 8 bits of resolution, which means about 48 dB of sensitivity from "absolute lowest" to "absolute highest." Yet, the difference between "full sunlight" and "starlight" is about 120 dB. (Even "full sunlight" to "twilight" is about 80 dB)

I'm not saying you're doing anything wrong, except you seemed to be saying that the very simplistic diagram you posted is as good as industrial sensors, which I think is untrue, and would confuse others who find this post and want to replicate your progress, that's all!

Offline calinezul

  • Jr. Member
  • **
  • Posts: 8
  • Helpful? 0
Re: Sharp GP2Y0D810Z0F Digital Distance Sensor 10cm
« Reply #14 on: May 09, 2013, 01:23:12 AM »
There are some features of the sensor http://letsmakerobots.com/node/5385 and more help about connection mode can be found in this article http://www.pololu.com/catalog/product/1134
I write articles not just for science or just skill involved, there is also passion for robotics that is present throughout my articles about robots and how they works on www.intorobotics.com

Offline johnwarfin

  • Full Member
  • ***
  • Posts: 120
  • Helpful? 3
Re: Sharp GP2Y0D810Z0F Digital Distance Sensor 10cm
« Reply #15 on: May 10, 2013, 05:42:33 AM »
light sensing  strikes me as one of the more interesting and important aspects of robot design. ive had some experience with couple dozen different photosensor setups and settled on 3 types: basic led/phototransistor, modulated emitter/receiver, and photo resistor.

ir leds are cheap and can be run from dc. for basic short range sensing matching phototransistors like tops030 can use a digital input. this is good  if mcu pins are scarce and close proximity (1-2cm). for example dohyo edge sensing. adc inputs can also be used for limited distance sensing because the phototransistors have analog output. not really long range though.  these are somewhat low cost averaging around a dime ea.

for longer range hooking that led up to a pwm port bit and using ir demodulators like TSOP4838 can provide much longer range. orders of magnitude in some cases. 10cm in direct sunlight to 10-20 meteres in dim. the output is digital so even though frequency is fixed around 38khz tricks like pulse width modulation of the led can be used for distance info. properly collimated good for object detection. power rail filtering mandatory. sensors a little more expensive at 50 cents but same cheap ir led as previous.

photoresistors (ldr) are much slower but very cheap (5 cents) and regular red or green leds can be used. they make good photo interrupters and edge sensors but because of the wide spectrum and lack of lens not so good for object/distance. however i found this last characteristic, when coupled with a red & green led, useful for color detection which the other types fail miserably at. almost as good as a camera video system for my m&m sorter but about 1% the cost.

with all the above methods cf or black paper tube shroud is very helpful to minimize saturation and increase directionalty. typically order of magnitude improvement in useable distance. a little dab of black fingernail polish also helpful to fine tune for ambient light conditions. i do tend to prefer diy approach using discrete  components rather than integrated off the shelf to keep cost down. im sure others have their own favorite devices and circuits but these work for me.

 


Get Your Ad Here

data_list