I need to adjust the temperature output from a DHT22 connected to a Raspberry pi Zero. The DHT22 is situated onto the RasPi case and the heat from the Pi gives a false output compare to the ambient temperature. I need to get the output to be 5 degrees Celsius lower.
I have this script working:
streamer = Streamer(bucket_name=BUCKET_NAME, bucket_key=BUCKET_KEY, access_key=ACCESS_KEY)
while True:
humidity, temp_c = Adafruit_DHT.read_retry(Adafruit_DHT.DHT22, 4)
if METRIC_UNITS:
streamer.log(SENSOR_LOCATION_NAME + " Temperature(C)", temp_c)
else:
temp_f = format(temp_c * 9.0 / 5.0 + 32.0, ".2f")
streamer.log(SENSOR_LOCATION_NAME + " Temperature(F)", temp_f)
humidity = format(humidity,".2f")
streamer.log(SENSOR_LOCATION_NAME + " Humidity(%)", humidity)
streamer.flush()
time.sleep(60*MINUTES_BETWEEN_READS)
Please help me amend the code.
Why don't you just update your temperature read from the sensor to be 5 degrees lower? Such as
humidity, temp_c = Adafruit_DHT.read_retry(Adafruit_DHT.DHT22, 4)
temp_c = temp_c - 5
rest of logic goes here....
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.