Python Forum

Full Version: Sensor reading changes with temperature. Looking for a good way to calibrate.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Newbie here.

I currently have a gas sensor connected to a raspberry pi. The sensor reading, however, is affected by temperature. I'd like to account for the change in order to get a more accurate reading. The manufacturer of the gas sensor has a graph which shows the temperature-dependent variation : https://ibb.co/YNdrPqd. I have a DH22 temperature sensor, and at first thought of just using a case statement or a bunch of IF statements to do the calibration, but I was wondering if there isn't a better way of going about this?

The graph is non-linear which makes it a bit trickier. Thanks for your help.
Not sure many people would click on a random link (I didn't)