Auto Temperature Sensor Correction


When I get new temperature sensors they are always a little off from the actual temperature. I found that I can “calibrate” them by running them side by side next to a know accurate sensor and adding an offset to the new sensor. This works but it's time consuming and assuming the sensor needs to be re-adjusted yearly this could be time consuming.


Create a master node that is known to be accurate, battery powered so it's easy to move. Place this node right next to the node to be calibrated and issue a series of MQTT commands to both nodes to start the calibration process. The master node will measure the air temperature and read in the temperatures being reported by the slave node. The master node will then calculate an offset and report this number to the slave node. The slave node will save this offset and start sending it's temperature readings using the offset. This process should happen continually for 24 hours or until the nodes have less than a 0.5% difference.


  • ESP8226 module. Since it only needs to run for 24 hours we shouldn't worry about power consumption.
  • Accurate temperature sensor


The master node will run custom software that subscribes to a calibration topic. To start the calibration process we publish a message that includes the topic the master node should subscribe to in order to read temperatures from the slave node. For example, if we have a temperature sensor reporting temperatures on the sensor/temp_sensor_01/temperature topic we would publish a topic calibration/start with a payload of sensor/temp_sensor_01/temperature. The master node will subscribe to that topic to read the reported temperatures of the slave node. When it receives a temperature message it will compare it to it's temperature and calculate an offset. It will do this a few times and average the offset at which point it will publish that offset out to the calibration topic. The slave will notice this message and adjust it's offset accordingly. This process will repeat until the calibration process has completed.


  • To calibrate battery powered devices we'll need to retain the calibration message on the MQTT server so when the device wakes up it can read it.
  • We'll have to have a different process for RF nodes, this will only work if the slave can subscribe to MQTT messages which means it requires wifi.