PMS5003 gas measurement with an enviro+ on a Raspberry

Thanks. There’s all the difference in the world between

The reducing and NH3 resistance readings will drop with increasing concentrations of the gases that they detect, and the oxidising sensor will increase with increasing levels of nitrogen dioxide.

which means that the values displayed for reducing (CO) and NH3 are actully misleading, and making a semi-decent attempt to display values that (a) move in the right direction and (b) give some indication of the magnitude of change.

I found an earlier post which has derived conversion formulae in a form which are similar to mine, and that gives me the reassurance that I am heading the right way.

So, the equations (code) I am presently using are (is) as follows [note you cannot simply copy my numerical factors - need to work out your own]:

from math import log10
gases = gas.read_all()
# oxidising, NO2: ppm = Rs /(6.5 * R0)
NO2 = gases.oxidising/6.5/20000 # R0 chosen to give value approx 0.01 in fresh air (detectable = 0.05 to 10)
# reducing,CO: ppm = 10^((log10(Rs / 3.5 / R0)) / -0.845 )
CO = 10**((log10(gases.reducing/3.5/150000)) / -0.845) # R0 chosen to give value approx 2 in fresh air (detectable = 1 to 1000)
# NH3: ppm = =10^((log10(Rs / 0.77 / R0)) / -0.5335 )
NH3 = 10**((log10(gases.nh3/0.77/570000)) / -0.5335) # R0 chosen to give value approx 2 in fresh air (detectable = 1 to 300)

The formula for oxidising, NO2 is simpler because things happened to cancel out in derivation, not because that is the line with positive gradient.

The previous post that I mentioned has equations of a similar form (except uses math.pow(10, …) rather than the more conventional 10**(…) for antilog, and he has moved the 3.5 and 0.77 factors outside of the antilog. But basically the same. He has also uses a stable value after sensors have been powered on for 100 minutes to derive R0 - which seems a good idea, and may allow selection to be semi-automated. Don’t forget that the parameter values will vary a lot between different sensors. I’ve yet to examine in more detail.
The previous post is at: Enviro+ / Ohms to PPM - #6 by Jdtinker