I have 6 DS18b20 sensors connected to my Pi3 sitting in an insulated box in my lounge. It is set up to provide a reasonable calibration environment (short of a stirred waterbath). Temperatures change slowly and I am sampling at 10 minute intervals. Results are good, with most sensors tracking OK, and one offset. There are two with bigger jumps in the temperature change:
Dont think that image has loaded!
It appears that 2 probes have a resolution of 0.25 C and the others 0.062 C. The 2 outlier probes are from the same batch as 4 others (my purchase batch that is). My reading is that the drivers control the resolution so this should be the same for all probes. My code is here
Code: Select all
#Multiple sensors #With the get_available_sensors class-method you can get the ids of all available sensors. #https://timofurrer.github.io/w1thermsensor/ #http://raspberrywebserver.com/cgiscripting/rpi-temperature-logger/building-an-sqlite-temperature-logger.html from w1thermsensor import W1ThermSensor import datetime import time import sqlite3 # store the temperature in the database def log_temperature(myTimeStamp,sensid,temperature): conn=sqlite3.connect('DataLogger') curs=conn.cursor() curs.execute("INSERT INTO SensorData values((?), (?), (?))", (myTimeStamp,str(sensid),temperature)) #curs.execute("INSERT INTO SensorData values("myTimeStamp","sensid","temperature");) # commit the changes conn.commit() #conn.close() while True: myTimeStamp = datetime.datetime.now() print("sensor log loop running") for sensor in W1ThermSensor.get_available_sensors(): #print("Sensor %s has temperature %.2f" % (sensor.id, sensor.get_temperature())) temperature=sensor.get_temperature() sensid=sensor.id