Comments (10)
The code is here: https://github.com/nophead/EnviroPlusWeb
from enviroplus-python.
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.
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.
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.
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.
@Andermutu I've tried the adc.get_voltage('in0/gnd') / 3.3 and I get some numbers :)
from enviroplus-python.
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.
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.
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.
from enviroplus-python.
beautiful chart, I will use it from now on :-)
thank you very much!
from enviroplus-python.
Related Issues (20)
- NumPy Error when working with LCD HOT 1
- Install script does not install all required python libraries HOT 4
- all_in_one (and combined) needs to recalculate humidity based on compensated temperature HOT 3
- Gas sensor not returning values HOT 3
- Migrate Lufdaten.py to Sensors Community (luftdaten.py) HOT 1
- Install script is missing a of dependencies and simply does not work HOT 3
- PMS5003 best use HOT 6
- light.py sample fails to run on new Enviro+ HOT 3
- BME280 - Pressure / Humidity Incorrect Readings HOT 3
- Failed to read PMS5003 (fresh latest install) HOT 1
- Pillow 10 compatibility HOT 1
- install.sh not working when trying to install over SSH HOT 6
- Installing enviroplus-python library and running lcd.py does not work HOT 3
- Error `/usr/bin/raspi-config: 2909: do_serial_cons: not found` when running install.sh HOT 1
- Running live vs cron HOT 7
- Raspberry Pi 4 Enviro+ examples error. HOT 6
- Problems getting started HOT 14
- No display for noise analysis example HOT 3
- Support for other boards besides raspberry Pi with 40 pin gpio HOT 1
- LCD does not show anything only backlight is on HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enviroplus-python.