Go Down

Topic: How to wire sensor to use 1.1V internal reference - mega 2560 (Read 435 times) previous topic - next topic

lennon-pledge

I have an LM35 with an input, output and ground pinout. 

The input will be 5V, the analog output signal will be processed by the Arduino (0-1024).

Instead of using the 5V reference, I want a higher resolution, so I'm using the internal 1.1V reference instead.


However, I have noticed that the on-board 5V regulator doesn't always produce 5V (or even 4.980).. I have 4 boards and the regulation is not too good.

So, in light of that, I fixed an L7805CV 5V regulator with a 0.347uF on the 12V input going to ground, and a 0.1uF cap on the output.  (the datasheet says 0.33uF on the input, but I didn't have that or an equivalent network to produce it.)

If I supply the LM35 sensor with this new regulated 5V, will I be able to use the 1.1V internal reference on the Arduino (given the regulation network and LM35 both are wired to the Arduino ground) ?

Is that how the 1.1V reference works?  Or is it based on the Arduino-regulated 5V?

TonyWilk

Is that how the 1.1V reference works?  Or is it based on the Arduino-regulated 5V?
The Arduino 1.1V reference is generated internally, it is largely independent of the actual supply voltage.
(it's like it's own 1.1V regulator)

It is not particularly accurate, but better than the usual "5V" reference.

For even better accuracy you can supply an external reference voltage for the ADC.

Yours,
 TonyWilk
 

Koepel

"LM35" and "higher resolution" :o

When someone starts with Arduino, a LM35 (or TMP36) is one of the first things to try. Okay, that works. Forget about it and move on to the DS18B20.

Because the LM35 is so dependent on the voltage, it is hard to get the accurate temperature. You can tune the voltage, use the internal 1.1V or 2.56V or even try an external voltage reference for a better overall absolute accuracy, but its a pain.

The DS18B20 is digital and is accurate as is.

If ±0.5°C is not good enough for you, there are chips that can measure with 0.1 degrees accuracy. Seller Closedcube has a few on Tindie: https://www.tindie.com/stores/closedcube/.
For normal indoor and outdoor temperatures you don't need that. For example the room temperature with 0.1 degrees accuracy has little meaning since the temperature is not the same in every spot of a room. The DS18B20 is good for almost every situation.

Wawa

So, in light of that, I fixed an L7805CV 5V regulator with a 0.347uF on the 12V input going to ground, and a 0.1uF cap on the output.  (the datasheet says 0.33uF on the input, but I didn't have that or an equivalent network to produce it.)

If I supply the LM35 sensor with this new regulated 5V, will I be able to use the 1.1V internal reference on the Arduino (given the regulation network and LM35 both are wired to the Arduino ground) ?

Is that how the 1.1V reference works?  Or is it based on the Arduino-regulated 5V?
LM35 temp output voltage does not depend on it's power supply, so your construction with an 7805 is useless. Just power the LM35 from the Mega's 5volt pin.

1.1volt Aref is the reference for the A/D. It has nothing to do with the LM35.
Don't 'do' anything, or connect anything to the Aref pin.
Just switch to 1.1volt Aref in code.

Don't know what you're trying to measure, but note that the upper temp limit is dropped to ~105C with 1.1volt Aref.
The lower limit of an LM35 is about 5C, both with default and 1.1volt Aref.
Leo..

avr_fred

Code: [Select]

void setup() {
...
  analogReference(INTERNAL1V1);    // Arduino Mega ONLY
...
}

outsider

The LM35 output does not depend on supply voltage as long as it's between 4 and 20V.

Koepel

@outsider, to use the LM35 for a temperature measurement depends on the reference voltage of the Arduino board. That is the problem. A voltage regulator is not very accurate and the internal voltage reference has a bad absolute accuracy (the sketch has to be tuned for the actual voltage of the internal voltage reference).

@lennon-pledge, a DS18B20 has none of the voltage reference problems. In the Arduino IDE, in the Library Manager you will find the OneWire and DallasTemperature libraries. You can install both and try an example of the DallasTemperature library.

lennon-pledge

Thanks for all the responses:

1) Completely forgot that the LM35 has a wide range for input JUST TO ALLOW IT TO WORK!  My apologies on that end ...
2) Nonetheless, I'm still powered them via the regulator because I already wired it (as a prototype board, either mega regulator or 78 regulator powering will do.) ...
3) However, I decided to forgo the INTERNAL1V1 reference because it's hard to obtain very good accuracy when read the signal (even though, as most of you said, the accuracy of the sensor is not so good.)  So instead, I wired the output of the regulator circuit to AREF pin and use that as the reference.  Currently, the output is 4.991V and that's better than taking a chance on the Mega's regulator possibly being anywhere from 4.6V - 5.2V (again, I only had 5 boards and only 1 was in the 4.9-5.0 range.)

4) I'll take a look into DS18B20, thanks for the info.

Wawa

I wired the output of the regulator circuit to AREF pin and use that as the reference.
Dangerous for the Mega, unless you are sure that that external reference voltage comes up after the Mega has started up, and is gone before you power the Mega off. Atmel recommends a >=5k safety resistor between external voltage and the Aref pin. That will drop Aref a bit, so you must compensate in code.

It is NOT important what voltage Aref is, as long as it is stable.

The Mega also has an internal 2.56volt Aref.
Leo..


outsider

The advantage of a lower reference voltage is better resolution, 0 to 100 degrees with a 5V AREF is 205 ADC counts or 0.5 degrees per count, with a 2.048V external reference it is 500 counts or 5 degrees per count.
https://www.digikey.com/product-detail/en/texas-instruments/LM4040C20ILPR/296-21579-1-ND/1494034

avr_fred

Quote
0 to 100 degrees with a 5V AREF is 205 ADC counts or 0.5 degrees per count, with a 2.048V external reference it is 500 counts or 5 degrees per count.
Correction:  ...with a 2.048V external reference it is 500 counts or 0.2 degrees per count.

But, you knew that...

outsider

Should have said "5 counts per degree"  :smiley-confuse:
TNX for heads up & K++.

Go Up