- C++ 66%
- Python 34%
| src | ||
| .gitignore | ||
| analyze.py | ||
| platformio.ini | ||
| Readme.md | ||
| saveserial.py | ||
Idea
This repository contains example code to read multiple DS18B20 1-Wire temperature sensors and compare them. These sensors can have a resolution of up to 12 bits, but vary sometimes in their absolute accuracy. When using multiple of these sensors in a project, where it is neccessary to compare absolute temperature values, the absolute error of each sensor can be measured in advance and corrected. This repository contains scripts to simplify this process.
Collect Measurements
The platformio project contains code for an esp8266 (wemos d1 mini), but coult be easily adapted to work on other microcontrollers. The data is sent via Serial as CSV rows. "saveserial.py" can be used, to collect this data to a csv file on a host computer.
All connected sensors should be as close to each other as possible. Heat sources (like the esp itself) should not be close to the sensors. To limit temperature differences airflow should be minimized, by putting the setup into a box. During a few hours of gathering readings the temperature could be slowly changed or a combined csv can be manually created that covers a larger temperature range. Filtering out the first minutes where temperatures change fast by hand can also improve the result.
The header contains the timestamp (uptime of the microcontroller) and all addresses of the connected sensors.
Analyze
To analyze the csv run:
python3 analyze.py 19700101_combined.csv
A sensor with the median temperature will be chosen automatically as a reference.
Add --reference 0123456789abcdef to specificy the reference sensor if needed.
The script will print out the differences of all sensors to the reference.
The idea is to take these values and subtract them from the tempereature reading in other projects.