tijmenvandenbrink / enviroplus_exporter

Prometheus exporter for enviroplus module by Pimoroni
MIT License
83 stars 39 forks source link

Converting raw values from MICS6814 into ppm #8

Closed razzor1984 closed 3 years ago

razzor1984 commented 3 years ago

Hello,

the sensor is delivering the raw values in kohm. Is there a forumular for the conversion? https://www.sgxsensortech.com/content/uploads/2015/02/1143_Datasheet-MiCS-6814-rev-8.pdf The Datasheet gives me only some basic values. If there is a valid formular, how will this then be calculated? Query in Grafana?

Best regards razzor

tijmenvandenbrink commented 3 years ago

Hi @razzor1984, unfortunately this doesn't make too much sense as the sensors pick up a mix of gasses. this is what Pimoroni explains on their website:

https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-enviro-plus

MICS6814 analog gas sensor and ADS1015 analog to digital converter (ADC) The MICS6814 is an analog gas sensor that can detect three different groups of gases that they refer to in the datasheet as reducing, oxidising, and NH3. The major gases/vapours that the sensor detects are: carbon monoxide (reducing), nitrogen dioxide (oxidising), and ammonia (NH3), but it is also sensitive to others, including hydrogen, ethanol, and hydrocarbons.

Each of the three groups of gases is effectively its own sensor within the MICS68141, and the analog voltage readings that the sensor produces are read by an analog to digital converter (ADC) and then converted into resistances by our code. These resistances will range from low hundreds of Ohms to tens of thousands of Ohms, and vary depending on the levels of each group of gases.

Because each group of gases could be a mix of different gases, it's not possible to single out any one gas specifically or to quantify their levels precisely, so the best way to interpret the data is to take readings until they stabilise, set a baseline, and then look for changes relative to that baseline. This gives you a rough idea of whether the air quality is increasing or decreasing.

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. You can see how the sensor reacts to the different gases in the charts below.