2023-12-16 02:24 AM
Hello everybody,
Actually I'm working on a temperature sensor. This project works on battery (2 x 1.5 V alkaline).
I would like to read the temperature in the room with an external analog sensor.
But I don't understand how VrefIN works. Because my Vcc supply is not fixed like it is on a battery.
Should I add an external fixed reference to the Vdda pin? but this one risks being distorted with the outside temperature?
I thought that an LDO internal to the microcontroller could power the ADC part, but I can't find it. My idea was to have a stable reference lower than Vcc (<2.5V) to read my temperature sensor and also the battery voltage to estimate battery wear.
Thank you
2023-12-16 05:52 AM
The VREFINT channel is a fixed voltage of about 1.21V. See the datasheet for exact range.
Measure the VREFINT voltage channel and infer/calculate what VREF+ is.
You know in general (assuming 12-bit readings):
VOLTAGE = (ADC counts) / 4095 * VREF+
so:
VREF+ = 1.21 * 4095 / (VREFINT counts)
After you know VREF+, you can measure VBAT or any other voltage you want.
2023-12-17 12:08 PM
For sure this answer is a bit off topic, but there are sensors that measure temperature and send it through digitally such as DS18B20. I once built a pt100 measuring device to see afterwards that there were viable alternatives hence my reply.
2023-12-17 12:37 PM
+1 to @Johi , you can find a digital sensor which produces temperature in degrees, self-calibrates. Even more, for a battery powered device you can find a sensor that measures automatically and produces alarm/interrupt if the temperature goes out of specified range. Your MCU can sleep most of the time and wake from this signal.