Author Topic: elector article: sharp rangefinder  (Read 3649 times)

0 Members and 1 Guest are viewing this topic.

paulstreats

  • Guest
elector article: sharp rangefinder
« on: February 05, 2009, 04:33:25 PM »
This months edition of Elektor magazine has an article on the sharp rangefinder along with a few tips listed below:

 They are using the GP2Y0A02YK0F (20cm - 150cm).

Whenever the rangefinder blinks its IR LED it emits very short powerful pulses, this creates a high peak load on the power supply. They recommend connecting an electrolytic capacitor (10uf - 100uf) between the +5v and GND as close to the rangefinder as possible. (in their article they solder a smd capacitor directly to the exposed circuit board on the rangefinder; they also mention they cant understand why Sharp never added this improvement themselves before selling them). Once the ripples in the power supply are gone, it stops interfering with the signal wire resulting in a smoother output.

 The ccd array has around 100pixels which gives the rangefinder a resolution of 20mv changes. Apparently, a small ripple voltage is superimposed on the output signal of the same amplitude so they recommend using a low pass filter. They also use a voltage divider in conjunction with the low pass filter. This means the output voltage is 2.4v rather than the usual 2.7v at 20cm (because of the resolution of the sensor it doesnt really matter, and the benefit is a much more stable signal with less spikey bits on the sillyscope ;D)



Vin = signal from rangefinder
R1 = 6.8K resistor (6K8)
R2 = 4.7K resistor (4K7)
C   = 1uf (electrolytic judging by the pictures)
Vout = to microcontroller adc pin
GND = GND

Those are the main hardware tips.

On the software side, they recommend using a look up table for for speed but for anybody wanting to do the math here is their recommended equation:

For sampling using the voltage divider circuit above:
Distance = (0.008271 + 909.6 x Us) / (1 - 3.398 x Us + 17.339 x Us x Us)

or sampling the signal without any additions:
Distance = (0.008271 +939.6 x Us) / (1 - 3.398 x Us +17.339 x Us x Us)

**where Us is the input voltage.

so for a 10bit adc:      input voltage = (5 / 1023) * ADC reading

The mention the reason the voltage output isnt linear is because its based on the trig functions in the rangefinder.

Just thought Id share this with everone


Offline pomprocker

  • Supreme Robot
  • *****
  • Posts: 1,431
  • Helpful? 16
  • Sorry miss, I was giving myself an oil-job.
    • Nerdcore - Programming, Electronics, Mechanics
Re: elector article: sharp rangefinder
« Reply #1 on: February 05, 2009, 06:35:04 PM »

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: elector article: sharp rangefinder
« Reply #2 on: February 05, 2009, 07:13:58 PM »
@Paulstreats
Also part of the reason for the R1/R2 divider is that they are using a 'non 5v' refererence voltage for the ADC. So the divider brings the volatage into the required range. The addition of 'C' also helps to filter out any spurious pulses.
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

paulstreats

  • Guest
Re: elector article: sharp rangefinder
« Reply #3 on: February 06, 2009, 04:59:20 AM »
The capacitor built into the divider acts as a low pass filter so it removes any of the ghost ripples that are superimposed (they dont explain where these come from). Since we get a few posts about unstable signals then maybe this is a solution. After all, by reducing the voltage by the amount in the circuit above you arent actually losing any resolution from the sensor.

You can also create a similar low pass filter without dividing the voltage.

They do bring the reference voltage down (to 1.1v) but the voltage range of the sensor still goes to 2.4v, presumably its so their program switches on at around 50% distance on the sensor. I never really looked at the code but the application is to turn a lamp on when somebody moves close to a desk.

Quote
How does this work with this:

http://www.acroname.com/robotics/info/articles/irlinear/irlinear.html

The link above shows ways of calculating the distance by using int's alone, whereas the sum provided by elektor assumes the use of floats. I would think the elektor sum is likely to be more accurate but the link you provided would be faster for the microcontroller to work out. Its the usual case of playing off speed and accuracy depending on which is the most important for the application.

If you wanted to use the voltage divider circuit with the method from the link above then you would just follow the same instructions but replot the chart yourself by taking measurements with a multimeter.

Offline Soeren

  • Supreme Robot
  • *****
  • Posts: 4,672
  • Helpful? 227
  • Mind Reading: 0.0
Re: elector article: sharp rangefinder
« Reply #4 on: February 06, 2009, 06:27:25 AM »
Hi,

You can also create a similar low pass filter without dividing the voltage.
All passive R/C filter reduces the signal going through it and hence "divides" it.
Regards,
Søren

A rather fast and fairly heavy robot with quite large wheels needs what? A lot of power?
Please remember...
Engineering is based on numbers - not adjectives

paulstreats

  • Guest
Re: elector article: sharp rangefinder
« Reply #5 on: February 06, 2009, 06:43:42 AM »
Yeah,

 Ive just realised that without a voltage divider, theres no point in a low pass filter anyway ::) since the low pass wouldnt smooth the spikes from the voltage level only remove those fluctuations that are a greater frequency that the filter was designed for....

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,704
  • Helpful? 173
    • Society of Robots
Re: elector article: sharp rangefinder
« Reply #6 on: February 15, 2009, 04:42:15 AM »
paulstreats, these pretty much match the conclusions on SoR:
http://www.societyofrobots.com/robotforum/index.php?topic=2712.0

 

SMF spam blocked by CleanTalk