Translate

Sunday, February 21, 2021

Playing with CircuitPython and Enviro+ - Gas sensor

 The feather wing Enviro+ has different sensors in it.
One is the Gas sensor MiCS-6814.
The article covers some information about how to interpret the measurements made with this sensor.

The main question is : what use can be done to the gas sensor on the Enviro+ board ?

The MiCS-6814 gas sensor was originally designed  to measure three main gas for automotive use :

  • Carbon Monoxide (CO)
  • Nitrogen Oxide (NO2)
  • Ammonia (NH3)
Actually also other gases are detected :














but the three main gases detectable are the three above.
The sensors has 3 channels :
  • OX --> oxidizing gases
  • RED --> reducing gases
  • NH3
The OX channel mainly detect NO2, the RED channel CO and the NH3 ... well, the NH3 gas.

So, to sum up, the sensor has three "channels" capable to recognize different gases.
These gases can not be measured directly, i.e. every one of the three channels will read different gases.
  • channel OX
    mainly : Nitrogen Dioxide
    in minor part :  Hydrogen - NO
  • channel RED
    mainly : Carbon Monoxide - Hydrogen
    in minor part : Ethanol - Ammonia - Methane - Propane - Iso butane
  • channel NH3
    mainly : Ammonia - Hydrogen - Ethanol
    in minor part : Propane - Iso Butane 

CircuitPython library


Adafruit/Pimoroni prepared a CircuitPython quite basic library to read this sensor.
These the methods available in the library :
  • setup()
    Execute only once (is called at every read) and basically :
    • assign pinout
    • set up ADC on specific pins (5,6,7)
  • cleanup()
    remove the setup
  • read_all()
    read all three sensors at the same time
  • read_oxdising()
    read only the PX sensor (chlorine, nitrogen dioxide)
  • read_reducing()
    read only hydrogen, carbon monoxide
  • read_nh3()
    read only ammonia
That's it !
The value reported is raw, i.e. basically is the resistance  read on the sensor normalized, is not converted in any standardized measurement unit.
Of course is better always to call the read_all and assign the result to a variable and then extract the specific values :


reading = gas.read_all()

reading.oxidizing
reading.reducing
reading.nh3
 

Converting in ppm

Reading the datasheet, the value returned (the resistance) can be roughly converted in ppm.

  • OX channel
    • mostly NO2
    • range : .8 k-ohm - 20 k-ohm
    • equivalent : 0.05 ppm - 10 ppm
  • RED channel
    • mostly CO
    • range : 100 k-ohm - 1500 k-ohm
    • equivalent : 1 ppm - 1000 ppm
  • NH3 channel
    • NH3
    • range : 10 k-ohm - 1500 k-ohm
    • equivalent : 1 ppm - 300 ppm
Assuming the value read are linear would be possible to convert the value in ppm with a proportion  :

max k-ohm : max ppm = reading k-ohm : x 

i.e.  x = (max ppm * reading k-ohm ) / max k-ohm 

However :
  1. Usually the gas sensors reading are NOT linear
  2. The measurement made with this sensor CAN NOT be used to be converted in ppm mostly because each channel measurement depends of the presence of different gases.
    However somebody did write an Arduino library for a Seed module that shows the ppm for different gases, not really sure how they did come up with such formula.
  3. According to the application note for gas sensors, the behavior of the reducing sensors (RED channel) is opposite to the OX channel but the datasheets shows in both cases the same behavior.
    i.e. the OX channel has an increase of the return value for the increase of the gas level, the RED channel has an increase of the value for a DECREASE of the gas !
    But looking the specific datasheet shows for both OX and RED channel a proportional increase of the ppm a front of an increase of the reading value !

Conclusion


So how this sensor can be actually used ?
The limit to don't show ppm values for specific gases limits little bit the usefulness of such sensor, it can be used maybe to see differences not related to an absolute values but to detect dynamic improvements/worsening situation comparing values on the long term. 

References


No comments:

Post a Comment