Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5151

General • Re: Reading the internal temperature on a Pico using a solar panel

$
0
0
the internal temperature is calculated using ADC_VREF, which is different each time.
How do you know the ADC_VREF is different each time, and why would that be ?

If your hardware is using a regulator to provide a supply voltage for your electronics from the battery then its output voltage should be consistent. If ADC_VREF is derived from that then that too should be consistent.

If ADC_VREF really is changing you seem to have three options - First provide a proper or hacked voltage reference to ADC_VREF to improve things.

Using a simple LED has worked for me -

Code:

     3V3 >-----------------.     :                          .|.    :                     200R |_|    :                    __     |  35 :ADC_AVDD <----.----|__|----^-----( O----.              |     1R           :    __|__            __|__                :    \   /  RED            --.-- 2.2uF          :    _\ /_  LED              |                  :      |      0V >----^------------------( O----'                              33 :
The forward voltage drop will give an ADC_VREF higher than the temperature sensor voltage, the Pico has a convenient 200R pull-up to 3V3, it will run below its 100mW rating, and handily the LED lights when it's fitted the correct way round.

Other ADC inputs will need to have their voltages kept below whatever ADC_VREF is.


Second, leave ADC_VREF as it is, connect a voltage reference to a spare ADC channel.

Again, using a LED has worked for me, but not sure what value R I used -

Code:

             35 :       ___  ADC_VREF ---->( O----|___|---.------.                :              |    __|__      ADCx <----( O------------'    \   /  RED                :                   _\ /_  LED                :                     |        0V -----( O-------------------'             33 :
Knowing what reference voltage there should be on the ADC pin, from the reading you get and what it should be, you can determine what the ADC_VREF would have been. You can use that when calculating other ADC voltages assuming ADC_VREF is not rapidly changing. You could read the reference voltage again and check if the calculation is deemed correct and keep repeating if not.


Otherwise use an external sensor instead of the on-chip one.


When reading any ADC some time after previously reading an ADC, always do a double read and use the last value read. This will avoid the error from the ADC Sample and Hold cpacitor having crept up over time.

Taking multiple readings and averaging them may also help.

As noted the on-chip temperature sensor isn't great, delivers only a small change for a large temperature change. I recall it's 1-bit ADC reading change for every 0.5 C, approximately 1.0 F, temperature change with ADC_VREF of 3V3. A lower ADC_VREF will improve that.

Statistics: Posted by hippy — Mon Jul 22, 2024 11:29 am



Viewing all articles
Browse latest Browse all 5151

Trending Articles