Go Down

Topic: Internal Analog Reference - 1.1v & 5v in the same program (Read 1 time) previous topic - next topic

jtw11

Morning,

I've got a program that is using the internal 1.1v reference to increase the read resolution of an LM35 temperature sensor output using analogReference(INTERNAL);

However, is there a way for me to set analogReference to 1.1v on specific analog pins, and 5v on other pins?

majenko

No.  It's one or the other.

You can, of course, switch between them at will though.  Add a slight delay to allow the references to settle between each change.

jtw11

I feared that would be the problem.... the dreaded delay.

Cheers anyhow!

majenko

The other option is to use an external ADC.  Then you can have 2 voltage references - the one for the internal ADC, and a different one for the external ADC.

I am working on an ADC shield at the moment: http://hacking.majenko.co.uk/node/58 and in my testing of it I use the internal ADC of the Arduino to monitor the Vref of the external ADC.

PaulS

Quote
I feared that would be the problem.... the dreaded delay.

It is not necessary to delay(). Simply discard the first reading after switching reference voltages.

majenko

Quote
It is not necessary to delay(). Simply discard the first reading after switching reference voltages.

Which basically creates a delay ;)

AWOL

Quote
Which basically creates a delay

Yes, but it is a delayMicroseconds (110) (approx), which is only a tenth of a "delay(anything)" ;-)
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

jtw11


Quote
I feared that would be the problem.... the dreaded delay.

It is not necessary to delay(). Simply discard the first reading after switching reference voltages.


Simply discard the reading? Sorry?

What I meant, was to be able to simultaneously read the input from an LM35, whilst reading other 0 - 5v sensors - in addition to running numerous other I/Os. A delay of any sort is a delay is it not?

AWOL

Quote
Simply discard the reading? Sorry?

Code: [Select]
(void) analogRead (myPin);
myReading = analogRead (myPin);
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

James C4S


What I meant, was to be able to simultaneously read the input from an LM35, whilst reading other 0 - 5v sensors - in addition to running numerous other I/Os. A delay of any sort is a delay is it not?


You can't simultaneously read more than one analog input anyway.  There is only one ADC.  The pins go into a MUX, which sits in front of the lone ADC.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Go Up