Giter Club home page Giter Club logo

Comments (10)

nophead avatar nophead commented on June 26, 2024 2

The code is here: https://github.com/nophead/EnviroPlusWeb

from enviroplus-python.

psycik avatar psycik commented on June 26, 2024 1

This seems to work for me. Do wish I knew how accurate it was though.

ox_ratio = gas.adc.get_voltage('in0/gnd') / 3.3
red_ratio = gas.adc.get_voltage('in1/gnd') / 3.3
nh3_ratio = gas.adc.get_voltage('in2/gnd') / 3.3
co = pow(red_ratio, -1.179) * 4.385
no2 = pow(ox_ratio, -1.007) * 6.855
nh3 = pow(nh3_ratio, -1.67) * 1.47
c3h8 = pow(nh3_ratio, -2.518) * 570.164
c4h10 = pow(nh3_ratio, -2.138) * 398.107
ch4 = pow(red_ratio, -4.363) * 630.957
h2 = pow(red_ratio, -1.8) * 0.73
c2h50h = pow(red_ratio, -1.552) * 1.622
print( 'co: %s ppm' % co)
print( 'no2: %s ppm' % no2)
print( 'nh3: %s ppm' % nh3)
print( 'c3h8: %s ppm' % c3h8)
print( 'c4h10: %s ppm' % c4h10)
print( 'ch4: %s ppm' % ch4)
print( 'h2: %s ppm' % h2)
print( 'c2h50h: %s ppm' % c2h50h)

co: 5.092087296056288 ppm
no2: 33.4387090215078 ppm
nh3: 2.0514111798875017 ppm
c3h8: 942.387572099747 ppm
c4h10: 609.9521573344416 ppm
ch4: 1097.1484880657024 ppm
h2: 0.9171637782593127 ppm
c2h50h: 1.9747757943785347 ppm

from enviroplus-python.

Gadgetoid avatar Gadgetoid commented on June 26, 2024

Looks like the code you're using talks - via i2c - to an ATmega168 which is what actually handles reading the gas sensor. I can't find the firmware for the ATmega168, so I can't figure out what it actually does.

If I were to hazard a guess, then the baseResistance is just the currently sensed system voltage since their schematic shows a 3V3_SENSE line connected to an ADC channel. The "ratio" in this case, would then be the difference between the gas sensor output voltage and the system voltage.

IE if 3V3_SENSE reads 2048 then we can assume that 2048==3.3v, so if your gas reading reads 1024 and you divide that by 2048 you get 0.5 which you can assume means 1.65v.

This is all pretty much guesswork, but I'd suggest that the ratio value can be calculated from our code by reading adc.get_voltage('in0/gnd') which gives you a voltage, and then dividing that by 3.3 to give you a ratio.

Hopefully working example:

from enviroplus import gas
gas.setup()
ox_ratio = gas.adc.get_voltage('in0/gnd') / 3.3

from enviroplus-python.

davidtme avatar davidtme commented on June 26, 2024

Thanks @Gadgetoid for spending some time on this, any help is much appreciated :)

Looking at set_multiplexer function, would I be able to use the following rather than / 3.3

from enviroplus import gas
gas.setup()
ox_ratio = gas.adc.get_voltage('in0/ref')

from enviroplus-python.

Andermutu avatar Andermutu commented on June 26, 2024

Hi @davidtme, @Gadgetoid;

I am also trying to measure gas concentrations, I need to get ppm values for CO, NO2, CH4... and the other detectable gases.

I think that the correct way to do it is as @Gadgetoid says, ox_ratio = gas.adc.get_voltage('in0/gnd') / 3.3. Doing by these way I can measure CO ppm (CO: 5.2351ppm)

But trying the same with ox_ratio = gas.adc.get_voltage('in0/ref') gives a negative ratio, so I would say it is wrong.

Thanks for your ideas and have a nice day.

from enviroplus-python.

davidtme avatar davidtme commented on June 26, 2024

@Andermutu I've tried the adc.get_voltage('in0/gnd') / 3.3 and I get some numbers :)

from enviroplus-python.

nophead avatar nophead commented on June 26, 2024

I have two Enviro+ boards and the gas sensors give very different readings in the same room. Not only that they are extremely dependent on a few degrees change in room temperature. The OX sensor also has a slow climb over a month and seems no sign of stopping. I.e. started around 7K but is now 127K.

I don't see how any meaningful absolute readings can be made unless there is some temperature compensation and a calibration procedure to account for the large difference between sensors.

from enviroplus-python.

psycik avatar psycik commented on June 26, 2024

I have two Enviro+ boards and the gas sensors give very different readings in the same room. Not only that they are extremely dependent on a few degrees change in room temperature. The OX sensor also has a slow climb over a month and seems no sign of stopping. I.e. started around 7K but is now 127K.

I don't see how any meaningful absolute readings can be made unless there is some temperature compensation and a calibration procedure to account for the large difference between sensors.

Interesting, after 24 hours of running this code the values are still relatively close with no climb. I will keep it going but I'd imagine I would have seen a climb by now.

from enviroplus-python.

nophead avatar nophead commented on June 26, 2024

This is what my first board has done over about 7 weeks, sampled every day. The cyan line is the OX sensor. My second board is on a similar trajectory.

image

from enviroplus-python.

Alexcirlan avatar Alexcirlan commented on June 26, 2024

beautiful chart, I will use it from now on :-)
thank you very much!

from enviroplus-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.