Go Down

Topic: Using analogReference() (Read 3798 times) previous topic - next topic

ScottG

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: [Select]
analogReference(INTERNAL);
analogRead(0);
analogReference(DEFAULT);
analogRead(1);

retrolefty


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: [Select]
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



Runaway Pancake


http://provideyourown.com/2012/secret-arduino-voltmeter-measure-battery-voltage/
"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?"

ScottG



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


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

Go Up