chrissyhroberts / Badger2040_XForm

An XForm interface for Badger2040
MIT License
2 stars 0 forks source link

Add temperature from Pico ABD sensor #1

Open chrissyhroberts opened 1 year ago

chrissyhroberts commented 1 year ago

https://electrocredible.com/raspberry-pi-pico-temperature-sensor-tutorial/

This guide shows how to get the ambient temperature from the onboard Pico w

Add a question type that pulls this datum from the temperature sensor, maybe with some kind of averaging across time to get a fair measurement

tiritea commented 1 year ago

note, ADC(4) is the onboard on-chip temperature sensor, which is highly influenced by the CPU chip temperature and clock speed; I've found it can run 10-5degC over ambient room temperature with an unenclosed Badger card (this will be even higher if enclosed in a case with less ventilation). I expect if an accurate environmental temperature is desired, an external temperature sensor will need to be wired into one of the exposed ADC inputs, or fed in from an external sensor board via I2C or Qwiic connection (and mounted accordingly)

tiritea commented 1 year ago

after some more experiments, changing the CPU clock speed from 2 to 4 (overclocked) increases the measured temp from approx 29degC to 32degC

chrissyhroberts commented 1 year ago

I’ve added functionality for an external sensor AHT20

https://github.com/chrissyhroberts/badger2040w_code#temperature-and-humidity-logger-aht20-unit-examplesweatherpy-and-examplesicon-weatherjpg-and-libahtx0py

At some point will do some work to compare the onboard temperature sensor to the external one.