ESP8266: Calibrating the Wifi Scale With Temperature Compensation

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
Related:  ESP8266 Arduino IDE Alternative: Platformio
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;-).
Now a beer! Did you like this post? It often takes me several hours of my free time to write one. If I was your neighbour would you offer me a beer for the hard work I did for you? The beauty is: beers can be teletransported with a painless donation using Paypal. A beer in a Swiss bar costs about USD $4.80. Or use this affiliate link if you order something on Banggood and I'll get a small kickback. Thank you!