Pages: [1]   Go Down
Author Topic: Using analogReference()  (Read 3411 times)
0 Members and 1 Guest are viewing this topic.
New Jersey
Offline Offline
God Member
*****
Karma: 2
Posts: 535
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a couple questions about using analogReference on an Pro Mini 3.3volts.

If I set the reference to 1.1volts with analogReference(INTERNAL), I assume it's till okay to have the actual voltage on the pins go up to 3.3 volts.  Is that correct?

Can I change the analogReference before I read an input, then change it back to read a different input. Any issues with doing this.  For example:
Code:
analogReference(INTERNAL);
analogRead(0);
analogReference(DEFAULT);
analogRead(1);
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17301
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I have a couple questions about using analogReference on an Pro Mini 3.3volts.

If I set the reference to 1.1volts with analogReference(INTERNAL), I assume it's till okay to have the actual voltage on the pins go up to 3.3 volts.  Is that correct?

Yes, electrically no problem, however all values above 1.1vdc will read as 1023 counts.

Can I change the analogReference before I read an input, then change it back to read a different input. Any issues with doing this.  For example:
Code:
analogReference(INTERNAL);
analogRead(0);
analogReference(DEFAULT);
analogRead(1);

Yes in theory it will work, but I've found that a analogRead() right after a change in analogReference() will usually return a 'faulty' value. I've usually do a couple of analogReads on the same pin after such a reference change and the last reading tends to be OK. You may have to play around with it to see what you get.

Lefty


Logged

Offline Offline
Faraday Member
**
Karma: 66
Posts: 2570
Now, More Than Ever
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/
Logged

"Hello, I must be going..."
"You gotta fight -- for your right -- to party!"
Don't react - Read.
"Who is like unto the beast? who is able to make war with him?"

New Jersey
Offline Offline
God Member
*****
Karma: 2
Posts: 535
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset


That's a neat trick, I'm gonna have to try it out
Logged

Pages: [1]   Go Up
Jump to: