Skip to main content
Graduate
December 16, 2023
Question

Read a temperature sensor on a battery system

  • December 16, 2023
  • 3 replies
  • 1160 views

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

 

 

    This topic has been closed for replies.

    3 replies

    Super User
    December 16, 2023

    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.

    Graduate
    December 17, 2023

    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.

    Super User
    December 17, 2023

    +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.