ESP8266: Calibrating the Wifi Scale With Temperature Compensation

Do you like this post? Writing posts, developing libraries and programming online font creators is actually hard work. I order most of my electronics from a Chinese website called Banggood. It is save and the items usually arrive in good quality. With every order you do there by following this link you are supporting the blog. Thank you!

In my last post I talked about my self made scale. There are plenty of applications for a sensor that can sense the weight of things. But I guess the scale should not be tared (or set to zero) every time the ESP8266 wakes up from sleep. The load cell is basically a resistor that reacts to tearing and pushing of the metal bar. But like all resistors, they are prone to temperature drift. This means if I want to measure the weight of an object over a long time it either has to be under constant (room) temperature or I compensate for the drifting readings from the sensor by measuring the temperature and correcting the drift by software.

So for this test run I put the scale attached to the NodeMCU in a plastic box on my balcony. Together with the weight (drift) I’m also measuring the temperature. My hope is that this way I can learn how the load cell drifts with temperature. So now I hope for a cold night and a hot day to get a big range for my test;-)

Update (next day)

So with thingspeak I could collect some good samples: The temperature went from 15°C up to 21°C and a scatter plot showed that the drift of the load cell was pretty much linear in this range:
Scatter Plot of the load cell’s temperature drift: on the Y axis
is the deviation from a tared cell, on the X axis the temperature
So I got a sloap and an offset for line fitting into this scatter plot using the SLOAP and INTERCEPT functions in Excel and Google Spreadsheet. I then used these values to find the offset depending on the current temperature. Now see the result:
The uncompensated deviation from zero
The temperature at the same moment
The weight calculated after subtracting the temperature drift
Looks pretty good to me! I am aware that I made some possibly wrong assumptions, but hey, this is hobby science and pragmatism is all I can afford with the little time I have for this project;-).
Posted by squix78


  1. It look very promising, but the Compensated Weight curve does clearly show the result.
    I assume the unit for Compensated Weight is grams. The y scale span is 150 and your drift is only -5. So even uncompensated the curve would show pretty much the same. -LCL

  2. Hi Dani, are you using some table for offset in each temperature point (previously measured) or you are using some function derived from the measurement ?
    Thanks, Peter

Leave a Reply