Go Down

Topic: Bug with analogReference (Read 3426 times) previous topic - next topic

PaulS

Quote
I've been trying to find a way to post pictures but am unsure how most people do it.  


Use the option in your browser to look at the page source. You'll see stuff like:
<img src="http://farm5.static.flickr.com/4140/4849676324_ca1bf6ed77.jpg" alt="" title="" border="0" />

If you post your pictures on some photo sharing site, like flickr, and use the Insert Image button, 3rd one on the top row, you can insert a link to your picture.

mellis

I'm been thinking about adding a lower-level API for the ADC (and timers, etc.), which would provide direct control over the registers (i.e. non-deferred reference switching along with other things).  See: http://dam.mellis.org/2010/06/sensor_library_for_arduino/ for an initial idea of what the implementation might look like.  Suggestions welcome here or on the developers mailing list.

wayneft

I believe I've found what's causing the large delays.  It's the 100nF cap that they put across the AREF pin.  I didn't even realize it was on the pin because at first look I didn't see it on the schematic because it's tucked away in the top corner.  

I breadboarded the ATMEGA and ran the tests both ways with and without the capacitor.  With the cap I saw the standard 3.5ms switching time (D-I) and without the cap it dropped all the way down to 12.7us .  There was a large improvement in the other switch time (I-D) from 3.75us down to 15ns without the cap.  

I tried the same test with a 10nF cap and the two switch times were at 359us(D-I) and 435ns (I-D).  Using the input impedance of the AREF circuitry (32k ohms) these times make sense if you calculate the RC time constant.


Quote
See: http://dam.mellis.org/2010/06/sensor_library_for_arduino/ for an initial idea of what the implementation might look like.  Suggestions welcome here or on the developers mailing list.

Those are some good ideas Dave.  Another suggestion would be an "averaging" analogRead (ie analogReadAVG(pin,samples_to_average)).  I'm guessing a lot of people take sensor readings by embedding the analogRead function in a for loop and average the samples, might be nice to have that all in one function.

I2C GPS Shield

Checkout my Open Source GPS Tracker on Kickstarter

P_Wood

Quote
- short AREF to Gnd (I used digital pin 3 for this)
[glow]- wait 5us[/glow]
- disconnect AREF from Gnd

How does one wait 5 micro-seconds with an arduino?? I didn't know you could do that.

Quote
Another suggestion would be an "averaging" analogRead (ie analogReadAVG(pin,samples_to_average)).

I second this so much! Now I know it's not such a big deal to copypaste your usual bits and pieces, but I find myself doing it a lot with smoothing. Very annoying. Please add this functionality.

wayneft

Quote
How does one wait 5 micro-seconds with an arduino??


http://arduino.cc/en/Reference/DelayMicroseconds
I2C GPS Shield

Checkout my Open Source GPS Tracker on Kickstarter

Go Up