Coder Social home page Coder Social logo

roscoe81 / enviro-monitor Goto Github PK

View Code? Open in Web Editor NEW
77.0 11.0 25.0 3.12 MB

An environment monitor based on a Raspberry Pi Zero W, a Pimoroni Enviro+ and a Plantower air quality sensor to monitor, display and report on air particles, gases, temperature, humidity, noise and air pressure.

License: MIT License

Python 100.00%
airquality-sensor pimoroni plantower-sensor air-quality-sensor luftdaten luftdaten-sensor environmental-monitoring pimoroni-enviroplus air-quality environmental-sensors

enviro-monitor's People

Contributors

roscoe81 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

enviro-monitor's Issues

Example json and Adafruit IO Feed Setup

Hi

This project looks incredible and I have tried to implement but without too much success. I was able to create an Adafruit account and actually saw the feeds and dashboard being created in the Adafruit IO site. However, the data did stream to the site. The Envriro+ unit was definitely working but it really seems to be a streaming issue. Specifically, I struggled with these fields in the config file:

"aio_user_name": "<>",
"aio_key": "<>",
"aio_feed_window": 0,
"aio_feed_sequence": 0,
"aio_household_prefix": "<>",
"aio_location_prefix": "<>",

and these fields in the Adafruit IO Feed Setup:

{'Property 1 Name': {'key': 'property1key', 'package': '<aio_package>', 'locations': {'': '<location1key', '': '<location2key'}, 'visibility': '<"public" or "private">'},
'Property 2 Name': {'key': 'property2key', 'package': '<aio_package>', 'locations': {'': ''}, 'visibility': '<"public" or "private">'}}

Can you provide an example of a short tutorial?

Thank you!

Victor

Setting up adafruit feed (please help with configuration

Hi Ross

I've spent a couple of hours trying to figure how to set up the adafruit io feed with the enviro+ and particle sensors and I feel I'm just a few settings away from getting this to work. I am attaching a couple of screenshots and will also describe what I have done. I would be very grateful if you could let me know why my feeds are not appearing in the io adafruit.

  1. I am using an pi zero with Enviro+ and the particle sensor.

  2. I have edited the "Northcliff_adafruit_io_feed_setup_Gen.py" file with my details but I'm really not sure what to do with the aio_feed_prefix. I have edited that line to have only 1 property and one location. I have called these "Mermaid" and "Home". Everything else, I left as default. I have also added that package type (Basic Combo), my "aio_user_name" and "aio_key" (see screenshot 1).When I run this script, I get no errors and the feeds and dashboard are created in my io adafruit website (see screen shot 2).

  3. I then edited my config.json file to include "enable_adafruit_io: true", my aio user name and aio key. I have also edited the "aio_houselhold_prefix" to correspond to "Mermaid" and the aio_location_prefix to correspond to "Home" but I feel that this is incorrect and I do not know what to add in these fields. Everything else I left as default but will eventually change the city name to "Gold Coast" and time zone to "Queensland" (see screen shot 3).

  4. I have edited the config.json to point it in the folder where my edited config is located (see screen shot 4). I also do not get any errors when I run this script and the enviro+ monitor in my pi turn on and I can cycle through the different data types.

I think the problem is just sending the feed to io adafruit but I am really not sure how to fix this.
Please let me know what I am doing wrong. I am really excited to get this dashboard working.

Thanking you in advance,

Victor

screenshot3
screenshot4
screenshot1
screenshot2

Your Watchdog File Name Here

Hi, really want to use this but being a novice I'm a little lost. I can work my way around most issues but struggling with this one

For now I'm using the default json file /home/pi/enviro-monitor/Config/config.json
Searching for watchdog but a little lost -- may be beyond my level at the moment

Raspberry Pi Zero W Buster, Enviro+

Appreciate your time & efforts
Regards, Ian

pi@tas:~/enviro-monitor $ python3 Northcliff_AQI_Monitor_Gen.py
2022-11-16 10:59:37.556 INFO Northcliff_Environment_Monitor.py - Pimoroni Enviro+ with noise measurement (and optional SGP30) sensor capture and display.
Supports external sensor capture and Luftdaten, mqtt and Adafruit IO Updates
Disclaimer: The noise measurement is not to be used for accurate sound level measurements.

#Note: you'll need to register with Luftdaten at:
#https://meine.luftdaten.info/ and enter your Raspberry Pi
#serial number that's displayed on the Enviro plus LCD along
#with the other details before the data appears on the
#Luftdaten map.

6.11 - Gen
Retrieved Config {'version': 'Base-6.10a', 'temp_offset': 0, 'altitude': 23, 'enable_display': True, 'enable_adafruit_io': False, 'aio_user_name': '<>', 'aio_key': '<>', 'aio_feed_window': 0, 'aio_feed_sequence': 0, 'aio_household_prefix': '<>', 'aio_location_prefix': '<>', 'aio_package': '<>', 'enable_send_data_to_homemanager': False, 'enable_receive_data_from_homemanager': False, 'enable_indoor_outdoor_functionality': False, 'outdoor_source_type': '<>', 'outdoor_source_id': {}, 'enable_noise': False, 'mqtt_broker_name': '<>', 'mqtt_username': '', 'mqtt_password': '', 'enable_luftdaten': False, 'enable_luftdaten_noise': False, 'disable_luftdaten_sensor_upload': 'None', 'enable_climate_and_gas_logging': False, 'enable_particle_sensor': True, 'enable_eco2_tvoc': False, 'gas_daily_r0_calibration_hour': 3, 'reset_gas_sensor_calibration': False, 'incoming_temp_hum_mqtt_topic': '<>', 'incoming_temp_hum_mqtt_sensor_name': '<>', 'incoming_barometer_mqtt_topic': '<>', 'incoming_barometer_sensor_id': 0, 'indoor_outdoor_function': 'Outdoor', 'mqtt_client_name': '<>', 'outdoor_mqtt_topic': '<>', 'indoor_mqtt_topic': '<>', 'city_name': 'Sydney', 'time_zone': 'Australia/Sydney', 'custom_locations': ['Townsville, Australia, Queensland, -19.26639, 146.80569', 'Thredbo, Australia, Sydney, -36.4999989, 148.2999988', 'Romsey, Australia, Victoria, -37.3581082, 144.7365582']}
2022-11-16 10:59:39.843 INFO Raspberry Pi serial: 0000000000000000
2022-11-16 10:59:39.857 INFO Wi-Fi: connected

Startup R0. Red R0: 9328.0 Oxi R0: 3327.0 NH3 R0: 2416.0
No Mender Software Version Available. Using Default
No Mender Config Version Available. Using Default
No Persistent Data Log Available. Using Defaults
Invalid Persistent Data Log. Using Defaults
Internal Temp/Hum Sensor
Internal Barometer
Raw Bar: 989.6 Comp Bar: 992.3
Reading Raw Gas sensors before warmup completed
Red Rs: 133867.0 Oxi Rs: 2333.0 NH3 Rs: 4032.0
Luftdaten Values {'P2': '822', 'P1': '1077', 'temperature': '17.93', 'humidity': '74.66', 'pressure': '98962.31'}
mqtt Values {'Gas Calibrated': False, 'Bar': [992.3, '0'], 'Hum': [74.7, '1'], 'Forecast': {'Valid': False, '3 Hour Change': 0, 'Forecast': 'Insufficient Data'}, 'P2.5': 822, 'P10': 1077, 'P1': 298, 'Temp': 17.9, 'Min Temp': None, 'Max Temp': None, 'Red': 0.16, 'Oxi': 0.11, 'NH3': 0.27, 'Lux': 11.0}
Traceback (most recent call last):
File "Northcliff_AQI_Monitor_Gen.py", line 2289, in
with open('', 'w') as f:
PermissionError: [Errno 13] Permission denied: ''
pi@tas:~/enviro-monitor $ ^C

No module named 'paho'

Hi,
Hi I installed paho (with sudo pip install paho-mqtt) but still I get the following error:

$ python3 Northcliff_AQI_Monitor_Gen.py 
Traceback (most recent call last):
  File "Northcliff_AQI_Monitor_Gen.py", line 5, in <module>
    import paho.mqtt.client as mqtt
ModuleNotFoundError: No module named 'paho'

Why isn't paho found?

Case

Hello,

A couple of queries please.
Is there any chance of getting a picture of the assembled case?
What is the recommended plastic for construction?

Thanks
Hugh

NameError: name 'aio_version_text_format' is not defined

I have been hitting this wall all day when Setting up Premium Plus Adafruit IO:

Sending Startup Versions to Adafruit IO Code: 6.11 - Gen Config: Base Config
Traceback (most recent call last):
  File "/home/pi/enviro-monitor/Northcliff_AQI_Monitor_Gen.py", line 2198, in <module>
    feed_resp = send_data_to_aio(aio_version_text_format, version_text)
NameError: name 'aio_version_text_format' is not defined

Any tips?
My knowledge is next to zero as this is my first project...
I have followed all the guidelines - let me know if specific screenshots would help...

Thanks :)

[Question] PPM readings vs other recommendation guides

Hi

First of all, thank you for this.

Secondly, this is my first project like this of sorts, so you're repo, has really helped me understand how to use the Envrio+, outside of the examples, but I'm just wondering if you could explain a little bit more about the numbers, please?

I'm trying to make an indoor air quality sensor that I can use to keep tabs on my office, nothing super accurate, just something to let me know when changes are needed with the air quality, temp and humidity, so I'm trying to extend your code so that I can output overall quality regarding the factors mentioned, but when I come to work out the levels for the cO2 I see my reading are as followed in the json file

{"Time": "Sunday 06 February 2022 @ 10:29:01", "Run Time": 39005.0, "Raw Temperature": 35.84, "Output Temp": 24.21, "Raw Humidity": 17.07, "Output Humidity": 28.9, "Output Bar": 993.4, "Raw Bar": 972.4, "Oxi": 0.16, "Red": 3.31, "NH3": 0.89, "Raw OxiRS": 17448.0, "Raw RedRS": 310803.0, "Raw NH3RS": 66298.0}

and I know that the Red output is the one I'm looking for cO2 but when I compare that with some guidance of recommended cO2 PPM they don't correlate?

image
Taken from here

Is there a table you used to work out good/bad ranges? Are your numbers shortened? or am I just completely getting the wrong end of the stick? (more likely 😅 ).

Many thanks for the help in advance!

UnboundLocalError: local variable 'parsed_config_parameters' referenced before assignment

When I run the following, I get this error:

pi@raspberrypienviro:~/enviro-monitor $ python Northcliff_AQI_Monitor_Gen.py
2022-01-24 11:09:08.579 INFO Northcliff_Environment_Monitor.py - Pimoroni Enviro+ with noise measurement (and optional SGP30) sensor capture and display.
Supports external sensor capture and Luftdaten, mqtt and Adafruit IO Updates
Disclaimer: The noise measurement is not to be used for accurate sound level measurements.

#Note: you'll need to register with Luftdaten at:
#https://meine.luftdaten.info/ and enter your Raspberry Pi
#serial number that's displayed on the Enviro plus LCD along
#with the other details before the data appears on the
#Luftdaten map.

6.11 - Gen
Config Retrieval Failed
Traceback (most recent call last):
File "/home/pi/enviro-monitor/Northcliff_AQI_Monitor_Gen.py", line 190, in
outdoor_mqtt_topic, indoor_mqtt_topic, city_name, time_zone, custom_locations) = retrieve_config()
File "/home/pi/enviro-monitor/Northcliff_AQI_Monitor_Gen.py", line 85, in retrieve_config
temp_offset = parsed_config_parameters['temp_offset']
UnboundLocalError: local variable 'parsed_config_parameters' referenced before assignment

The only thing I updated in your Northcliff_AQI_Monitor_Gen.py is the config file location:

def retrieve_config():
try:
with open('/home/pi/enviro-monitor/Config', 'r') as f:
parsed_config_parameters = json.loads(f.read())
print('Retrieved Config', parsed_config_parameters)

This is what I have in the config.json set to:

{"version": "Base-6.10a",
"temp_offset": 0,
"altitude": 2,
"enable_display": true,
"enable_adafruit_io": false,
"aio_user_name": "",
"aio_key": "",
"aio_feed_window": 0,
"aio_feed_sequence": 0,
"aio_household_prefix": "",
"aio_location_prefix": "",
"aio_package": "",
"enable_send_data_to_homemanager": false,
"enable_receive_data_from_homemanager": false,
"enable_indoor_outdoor_functionality": false,
"outdoor_source_type": "Enviro",
"outdoor_source_id": {},
"enable_noise": false,
"mqtt_broker_name": "<>",
"mqtt_username": "",
"mqtt_password": "",
"enable_luftdaten": true,
"enable_luftdaten_noise": false,
"disable_luftdaten_sensor_upload": "None",
"enable_climate_and_gas_logging": false,
"enable_particle_sensor": true,
"enable_eco2_tvoc": false,
"gas_daily_r0_calibration_hour": 3,
"reset_gas_sensor_calibration": false,
"incoming_temp_hum_mqtt_topic": "",
"incoming_temp_hum_mqtt_sensor_name": "",
"incoming_barometer_mqtt_topic": "",
"incoming_barometer_sensor_id": 0,
"indoor_outdoor_function": "Outdoor",
"mqtt_client_name": "",
"outdoor_mqtt_topic": "",
"indoor_mqtt_topic": "",
"city_name": "Newark",
"time_zone": "America/New_York",
"custom_locations": ["Townsville, Australia, Queensland, -19.26639, 146.80569", "Thredbo, Australia, Sydney, -36.4999989, 148.2999988", "Romsey, Australia, Victoria, -37.3581082, 144.7365582"]}

Is there a mistake I made in the config.json file that's causing the error? Or is there a bug in the python script? The city_name I'm using is listed in the database already https://astral.readthedocs.io/en/latest/#additional-locations

Readings or compensation factors for temperature and humidity seem way off

Disclaimer: I have yet to print the case, as I've just discovered this project yesterday. If this is the only variable it seems like airflow is extremely limited in the case and a fan to circulate air may be necessary.

I had previously purchased a ribbon cable and inserted a 10 second delay in the Pimoroni code based on a YouTube video where it seemed like constantly querying for data was heating up the sensors and giving completely incorrect data. I also purchased a BME688 breakout, installed on a breakout garden on another pi. This only measures temperature, pressure, humidity and "air quality" though the last one has no implementation other than an Ohm reading. On the Enviro+, the delay and ribbon cable seemed to fix the temperature and humidity readings, but then I ran into problems with the gas sensor which lead me to finding this https://forums.pimoroni.com/t/enviro-oxide-level-slow-climb/10835/53 post on the Pimoroni forum.

I just installed this yesterday as an alternative to the "combined" version offered by the official Pimoroni code.

The pressure reading seems to be fine, as it was with the Pimoroni code.

Both the temperature and humidity reading seem off compared to both the BME688, the original Pimoroni code for the Enviro+ and an analog thermometer + hygrometer which I had also purchased to compare data.

After installing the ribbon cable: the Enviro+ has always read about 2-3C high on the temperature with the original code compared to an analog thermometer, with similar results coming from the BME688 on another Pi which are side by side. The humidity had generally been in line on all three data points, though the analog hygrometer doesn't seem to be as sensitive as either of the digital sensors, but it will move in line with them.

Now with this code, the temperature is about 5C under what the analog thermometer shows (plus another 2-3C below the uncompensated temperature on the BME688, which again remains in line with the analog thermometer). As for the humidity, it shows between 20 and 25 points higher than either the BME688 or the analog hygrometer.

SyntaxError: Non-ASCII character '\xc2' in file Northcliff_AQI_Monitor_Gen.py on line 1103

I´m getting this error if I try to run Northcliff_AQI_Monitor_Gen.py on my Raspi Zero.

File "Northcliff_AQI_Monitor_Gen.py", line 1103
SyntaxError: Non-ASCII character '\xc2' in file Northcliff_AQI_Monitor_Gen.py on line 1103, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details

If I google the error message: SyntaxError: Non-ASCII character '\xc2' in file I´m getting the hint to: https://stackoverflow.com/questions/18078851/syntaxerror-of-non-ascii-character
Set # -- coding: utf-8 -- on top of the script.

But if I do that and run the py I`m gettin this:

File "Northcliff_AQI_Monitor_Gen.py", line 1105
    temp_string = f"{data['Temp'][1]:.0f}°C"
                                            ^
SyntaxError: invalid syntax

maybe this has something to do with my location settings?

pi@raspberrypi:~/enviro-monitor $ sudo raspi-config
Generating locales (this might take a while)...
  de_DE.UTF-8...

Deployment Process

I am new to all this so bare with me. After following the Enviro+ setup, how do you then go through and utilize the config.json file in the setup? I have a raspberry pi that I have managed to get connected with the enviro plus and I can get it to activate but looking at your documentation and reading through I would like to utilize it though I am unsure how to go about doing so.

SyntaxError

Hi roscoe81,

just tried to run your program.
Getting an error message. ...line 1205 SyntaxError: Non-ASCII character ˋ\xc2ˋ...on line 1205, but no encoding declared
Maybe I did something wrong. I’m pretty new at raspbian.

Thanks a lot

Northcliff Enviro+ LCD control feature request

hello,
firstly thanks for such a great component. it truly maximized the potential of the Enviro+ reporting capability

I don't really have an issue, but maybe more of a feature request:
1- how can I make dashboard selection? like only show 0,4,5,15
2- how can I turn the lcd completely off while running the script / separate the lcd part so that I can turn it on/off based on other parameters?

suggestions:
how did you fit the SGP30 in the case?
how would you map the red, nh3 and oxi sensors to the devices classes listed here ?
and would I need any conversion to read them in Homekit?

thank you

adafruit.io has updated package offerings

commenting here to note that adafruit.io now offers 10 free streams and anything else is considered adafruit.io+ that gives you access to 60 streams for $10.00 a month or $99.00 a year.

the current Basic or Basic air scripts get you 5 or 5 streams and the preminium gets you 14 which no longer fits the free tiers. 10 isn't optimal with the PM gauge, so I ended up having to mark my license as premium and remove extra items like lux and weather to get what I wanted.

Ultimately some of the code should be refactored to allow the additional free streams. I might take a crack at this if I have some time along with changing metrics to barbarian freedom units since I live in the US

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.