openHAB subscribes to that MQTT broker and integrating the topics into OH works like a charm. Furthermore Iām persisting data in InfluxDB and visualize it in Grafana.
On the Enviro+ board, thereās a MICS6814 sensor for measuring āreducingā, āoxidisingā and NH3 gas(es). As the measurements are converted to Ohms Iād like to convert them into PPM to get a better understanding about air quality. Of course you could also monitor the Ohms and track air quality via them, but thatās not what Iād like to achieve.
unfortunately there are no formulas, just these diagrams with RS/R0 over PPM.
Please donāt get me wrong, Iām not assuming that anyone here is providing a working conversion for my specific case. Iām just looking if anyone has an approach on converting Ohms to PPM when it comes to eletrical sensors.
Many thanks for your reply and your tip with including that conversion into .py-script, Iām aware of that :). Iāll investigate further and if I find a solution Iāll post here!
a method of stating a componentās tolerance value by specifying how many parts per million units a component may vary from its nominal value.
Put another way, itās a way to determine the tolerances of the electrical component. Iām definitely no expert, but I donāt think there is a single calculation that will work here. Every resistor and capacitor will have itās own individual set of tolerances. One of the examples from that site might be informative:
Letās say we a 1M⦠resistor.
A 1M⦠resistor is a resistor that has a color code of brown-black-green. It has a nominal value of 1,000,000ā¦.
Now letās say this resistor has a parts per million specification of 5000ppm. This means that for every 1,000,000 ohms of resistance that this resistor has, the resistance can vary as much as 5000 ohms. This means that this 1M⦠can have a resistance 5000 ohms below or above 1,000,000 ohms, which means its resistance can be as low as 995,000⦠or as high as 1,005,000⦠or somewhere in between.
Is that what you are after, or are you hoping to be able to convert the Ohms to a PPM of the gases you are sensing? If itās the latter, you canāt get there from here.
Curious about lines like āc = pow(ratio1, -1.179)*4.385ā I thought about exponential curves and stumbled upon a YT-video @ [2] https://www.youtube.com/watch?v=fBo3Yq9LK1U where a guy is explaining how to read that charts and get equations in the format Y = a *x ^b out of it.
So I started again with the fact-sheet of my initial post and tried myself, being able to reconstruct almost the same values like the library in [1].
Iām testing right now and try to evaluate if the āgeneratedā PPM could make sense in terms of common PPMs.
That makes sense. Looking at the charts on the data sheet they are in a log10 scale. You canāt get a straight line on that sort of chart without there being exponential curves.
Comment only - that is a curious device. You seem to have to know what gases may be present before decoding what the output means. Reading XX might mean high AA% ammonia or BB% ethanol or CC% carbon monoxide or ā¦
My 2 cents having spent most of my 40+ year career in R&D, I have had some experience with gas sensors. As far as I know there is no such thing as a universal sensor and each sensor needs to be calibrated for the gas of interest. This requires measuring and plotting resistance (ohms) as a function of gas concentration(ppm). A regression analysis is performed using the data collected, and unless you know with certainty otherwise, a straight line is assumed over the range of concentrations of interest, so ohms=a +m(conc) where āaā is the y-axis intercept and āmā is slope of the line. If the range of interest is broad and the sensor has non-linearity then a quadratic or power law fit can be used. The sensor mfg should provide this info ( at least generically if not specifically for that particular sensor) with sale of the sensor.
Hi @rossko57,
the MICS6814 has 3 different sensors, one for reducing gases, one for oxidising gases and one for NH3. Depending on what youād like to āconvertā (Iām writing this in " ", because I donāt think that this citizen science device will be able to replace professional sensors that are thoroughly calibrated) youāve to apply your individually generated exponential curves.
For the moment Iām therefore āconvertingā CO and NO2.
Hi @John_Siemon,
as itās my first touching point with that stuff (enviromental data on a citizen science base) I wanted to start a small project because Iām interested in such appliances (especially for Raspberry). I read an article about the Enviro+ sensor board in a Pi magazine and ordered it with the intention toā¦
learn sth about enviromental data
learn a bit of Python
make use of a MQTT broker
play around with my unused RPI
Thanks for clarifying how itās properly done - for the moment Iām trying to calibrate NO and CO2 as thereās a professional station around that provides official calibrated and open data.
CO (my reading/conversion): 0.344ppm
NO2 (my reading/conversion): 0.005ppm
So Iāll tweak a bit to get that CO right and then I guess Iām done.
Finally, something Iād like to add here - of course I donāt have intentions to take that collected data serious in any way. For me itās a project that helps me learning new stuff with the idea to get a rough idea if air quality is improving or worsening.
Those arenāt bad readings; I was wondering whether it was sensitive enough for any useful measurement of environmental atmosphere (as opposed to gross contaminants like a propane leak)
I think openHABs Number:Dimensionless type supports ppm units already. If the g/mol and g/m³ are common units, you could raise a request to have those added too for general benefit. My science is rusty, but those are properly āratiosā and so Dimensionless as well?
after a few days of testing and tweaking Iām happy with the results. Also I donāt have any remarkable jitters (< 0,1%), so I can say that the sensor is providing stable readings (yes, at different temperatures and humidities).
Here are the main steps;
Read sensor-data with Python-library (these values are in Ohms for that specific sensor)
Based on diagrams in sensorās fact sheet: build the exponential curve based on the gas youād like to convert (in my case CO and NO2)
Put the Ohms in that equation (be careful if the diagrams are in Ohm or kOhm) to get PPM
Optional: Further conversion to mg/m³ [1]
Optional: Sending data to MQTT
Optional: openHAB subscribing to MQTT-topics
Optional: openHAB persisting data in InfluxDB
Optional: Grafana visualizing data from InfluxDB
In my case I was able to validate my readings via a nearby official and calibrated station.
Hi, Iāve actually purchased the same hardware, with the same goal in mind, just havenāt had a chance to work it together yet. Feel like sharing your code & details of how it all works?
unfortunately Iām very busy at the moment, so I canāt go into details. What may help you for sure is Paul van Haastrechtās Excel on GitHub - https://github.com/paulvha/multichannel-gas.
If you take a look into āmics 6814.xlsā, youāll find the curves youāre looking for! These differ only slightly from mine. So @dta thereās no ācodeā to build the curves - youāve to read them on your own from the fact-sheet.
@Zylan you can take a look into the shipped .py-files to get an idea of how to read sensor data.
Hereās some code that will do the conversion based on the datasheet graphs. Theyāre developed by undertaking a log-log linear regression. You will need to define R0 for each sensor, based on each sensorās resistance in air. That allows you to undertake calibration. I havenāt included any temperature or humidity compensation at this stage.
The numbers here for the RED, OX and NH3 R0. Are they some rough estimates or ballpark figures? Iāve tried using this function and check the result on the sensor data sheet charts and it works out well.
So far I was just recording the kOhm output for each sensor and what always surprises me is how OX reading goes up whenever I open the window. The readouts would normally be around 22 kOhm, with opened window would go to 30-35 kOhm. I would really like to see how much ppm of NO2 are we talking about here.
You need to measure the resistances in āstandard airā (i.e. with the normal levels of gas concentrations found in air) to obtain the three R0 resistance levels. They form the baselines against which RS is measured as each gas concentration varies from āstandard airā. The algorithms are then applied to RS/R0 for each sensor. I donāt think you can specifically measure NO2, just the combination of oxidising gases as per the datasheet graphs.