Page 1 of 1

Setting the analog reference to 3.3V

Posted: Sat Dec 18, 2010 6:49 pm
by dwmcqueen
I apologize for the newbieness of this question, but what is the proper way to set the analog reference to 3.3V on the BBB? I am trying to do the Power Monitor at http://jarv.org/pwrmon.shtml#accuracy.

Thanks!

Re: Setting the analog reference to 3.3V

Posted: Sat Jan 01, 2011 6:35 pm
by paul
Sorry for the super-slow response - hope it still has some relevancy.

Setting the analog reference is described on the arduino site reference section, which I actually wrote. One problem is that the Atmega datasheet is entirely ambiguous as to the impedance of the AREF pin under different code conditions. I poked around on the Internet and didn't find much on this topic when I was writing the docs.

In any case that's more than you probably want. Here's my current advice based on some other reading and experiments that others have done.
Use a pretty stiff voltage divider such as 500 ohm or 1k pot hooked up to ground and 5V. This will allow you to dial in any voltage you want for AREF - then you have to do a bit of calibration on the project.

Use the code right off the Arduino reference section and let us know your results if you discover anything useful.

Paul

Re: Setting the analog reference to 3.3V

Posted: Mon Jan 03, 2011 9:39 pm
by dwmcqueen
Thanks!

I am brand new to the Arduino and even electronics in general. So the BBB has a reference of 5V, correct?

Re: Setting the analog reference to 3.3V

Posted: Tue Jan 04, 2011 7:49 am
by paul
The way the Atmega chip is configured the analog reference pin will default to the VCC that the chip is powered at. So if the BBB is getting power from USB or through its regulator (with a 5V or higher external supply) then the AREF pin will be at 5V. You can measure this but only with an expensive high-impedance volt meter.

If you supply the AREF pin with a different voltage AND change the code to EXTERNAL (see the Arduino reference page), it will use the voltage at the AREF pin for the A/D converter reference.

Paul

Re: Setting the analog reference to 3.3V

Posted: Fri May 06, 2011 11:52 pm
by Evan
Unless all you are measuring is the voltage off some potentiometers, I'd avoid the "DEFAULT" reference that uses the supply voltage as a reference. Depending on what your system is doing and how it is loading down the power, the 5 volt supply can be constantly varying and noisy. The worst case is when you power the board via USB from a laptop. My first Arduino project was trying to build a digital thermometer with a MCP9701A as the temperature sensor. That sensor has fairly wide tolerances so I was trying to calibrate offset and ratio variables in my sketch to get the displayed temperature right. I'd get it real close, and then suddenly it was way off, and I was getting really frustrated. It turned out the 5 volts the laptop supplied via the USB would be stable for a while, but then change when the cooling fan came on, or the disk spun down, or the temperature changed -- there was really no predicting it. If you want to measure real voltages, use the "INTERNAL" nominal 1.1 volt reference, which is about 1mV per count. Use a voltage divider to get the voltage you want to measure into that range.