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 (attached below). 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.
You could try a log-log plot, i.e. if you have y=f(x) then plot log(y) vs log(x). This should make the plot a straight line. You can calculate the best fit for that straight line.