The behavior I am seeing is that the temperature offset does not affect the first reading from the sensor, and is gradually applied over the course of the first few minutes.
With a delay of 30 seconds in my While: True loop and a temperature_offset value of 10, temp starts at about 25.4, and then every 30 seconds when I report a new reading to the serial console, it declines by a few degrees until it stabilizes around 15.7. It takes two to three minutes for the offset temperature to stabilize.
What I really want to do, and was doing initially, was to put the MagTag into deep sleep for one to five minutes between readings. Unfortunately what I've found when I try this is the temperature offset is never accounted for: since I am only taking one reading after waking from sleep it never stabilizes and I only get the initial high/incorrect/unadjusted temp value.
I am trying to determine if this is this a limitation of the sensor module, or in the circuitpython library, or in how I am using it? What are others' experiences with adjusting the temperature_offset?
I could just do the offset adjustment myself when I display the temp (I am already monkeying with it to present it as Fahrenheit rather than Celsius), but the temp offset also affects the humidity value.
Here is a simplified version of my code (for simplicity I removed the imports, network, and e-ink display stuff):
Code: Select all
magtag = MagTag()
i2c = board.I2C()
scd4x = adafruit_scd4x.SCD4X(i2c)
print("Temp offset: ", scd4x.temperature_offset)
print("Elevation: ", scd4x.altitude)
#commented out the settings adjustments. they are correctly persisted upon reset after being set
#scd4x.stop_periodic_measurement()
#time.sleep(3)
#scd4x.temperature_offset=10
#scd4x.altitude=93
#scd4x.ambient_pressure=1014
#scd4x.persist_settings()
#time.sleep(3)
#print("Temp offset: ", scd4x.temperature_offset)
scd4x.start_periodic_measurement()
print("Waiting for first measurement....")
while True:
while not scd4x.data_ready:
time.sleep(0.25)
print("CO2: %d ppm" % scd4x.CO2)
print("Temperature: %0.1f *C" % scd4x.temperature)
print("Humidity: %0.1f %%" % scd4x.relative_humidity)
print()
time.sleep(30)