Society of Robots - Robot Forum

Electronics => Electronics => Topic started by: benji on May 07, 2008, 05:28:37 AM

Title: quick adc avr question
Post by: benji on May 07, 2008, 05:28:37 AM
just a question about the Avr adc
i have set the mode to provide internal reference voltage which is 2.56 v
do i get this voltage on the vref pin by a voltmeter?

the problem is that im attaching the sharp ir and the voltage range is from 0.7 to 2.65
which is a little higher than internal vref, whats the optimal solution for suc a case?
i thought about doubeling the sharp ir out (gain of 2 using an op-amp) and using a 5 v vref,,but i guess the problem would be the same
as 2.6 *2 is > 5

any idaes would be much appreciated

Title: Re: quick adc avr question
Post by: TrickyNekro on May 07, 2008, 05:52:25 AM
First... you can supply Vref with ~2.7V using a LM317, which is in practical after all and only good if you have a development board...

Secondly... Vref was a impatience of 2%, if I'm correct, without damaging the processor... so you don't have a problem...
For example same "problem" exist on the SKT500... despite having set target voltage to 5V0 it's always 0V1 greater with Vref at 5V0...
But I do not power my boards with Vref but Vtarget but no problem ever existed...

Thirdly... I think Vref is set by fuse bits... but I don't know more on this... I might be mistaken as well...

And it just came to me... why don't you use a light pull down resistor like 50k - 100k or so... might help...

Lefteris
Title: Re: quick adc avr question
Post by: benji on May 07, 2008, 08:05:32 AM
yea the Lm317 is helpfull here,,never came to my mind ,thanks.

Quote
And it just came to me... why don't you use a light pull down resistor like 50k - 100k or so... might help...

do you mean to pull down the sensor out? wiht ground?
Title: Re: quick adc avr question
Post by: TrickyNekro on May 07, 2008, 08:19:39 AM
Yes, don't know if that helps but it will protect your AVR at least...
Title: Re: quick adc avr question
Post by: superchiku on May 07, 2008, 02:49:15 PM
what is the problem in making avcc as ur reference, it well within ur sharp ir output values and u dont have to go through all these problems of using lm317 and all
Title: Re: quick adc avr question
Post by: benji on May 07, 2008, 03:34:33 PM
when you use avcc as your vref it means your using 5 volts ,this would cause to loose precision
ther resolution would be less.
im looking for to use the whole 8bits values in the sensor out range or lets say 0 ---> maximum(2.6)

what sampling freq is it best for this sharp IR?

anyone did interface a sharp ir with good digital interpretation? i would appreciate telling the initialization parameters values
Title: Re: quick adc avr question
Post by: TrickyNekro on May 07, 2008, 04:17:21 PM
when you use avcc as your vref it means your using 5 volts ,this would cause to loose precision
ther resolution would be less.
im looking for to use the whole 8bits values in the sensor out range or lets say 0 ---> maximum(2.6)

what sampling freq is it best for this sharp IR?

anyone did interface a sharp ir with good digital interpretation? i would appreciate telling the initialization parameters values


Sampling frequency is the greater you have the better you are... so set the prescaler to auto to get maximum frequency possible...

Given you want to convert data to something useful why don't you try first sampling and then get a math time...
It's not that difficult after all, cause I don't know any such math type, which however should exist :P
And it's a little bit fun!!!

Again, why don't you use the internal Vref and then just hook the output to a ADC channel...
You should have no problems...

Cheers,
Lefteris
Title: Re: quick adc avr question
Post by: benji on May 07, 2008, 04:24:48 PM
Quote
Again, why don't you use the internal Vref and then just hook the output to a ADC channel...
You should have no problems...
the internal vref provided are

1/ 2.54 volts , which would cause to loose reading between 2.54 and 2.6
2/ 5 volts ,which would cause loosing too many adc range values cuz the adc channel wont get higher than 2.6

Title: Re: quick adc avr question
Post by: superchiku on May 08, 2008, 12:57:04 AM
certainly u dont think that resoulution can be less if u use 5 v , just think abt it will be more reliable coz anything greater than 2.5v will be read as same , hence the robot will not be able to identify distances near it , which will lead to errors in robot ranging like it will make no difference betn 10 cm and 15cm just thinka bt it and ull get ur answer
Title: Re: quick adc avr question
Post by: TrickyNekro on May 08, 2008, 03:08:17 AM
Ha... it's just came to me...

Why don't you use one resistor and a zener diode to supply the Vref pin... I think there are 2V7 zener...\
And with another resistor in series with the Vdd and the Vref before the zener you can get the voltage you want precisely!

But I don't know how to calculate all that... sorry....

But also look here it might be a great help!!!
http://en.wikipedia.org/wiki/Zener_diode (http://en.wikipedia.org/wiki/Zener_diode)


Lefteris
Title: Re: quick adc avr question
Post by: benji on May 08, 2008, 07:39:38 AM
Quote
2V7 zener
Awesome !!!
thanks.

superchicku,, using 5 volts as vref when your sensor doesnt give higher than 2.6 volts is loosing resolution,thats because at 5 v vref the LSB is a big
step.
so always its better to benefit from all you 8 bits and to do this then they should be all included in the sensor output range.