haydnw / airpi Goto Github PK
View Code? Open in Web Editor NEWThis project forked from guruthree/airpi
A Raspberry Pi air quality station
This project forked from guruthree/airpi
A Raspberry Pi air quality station
If GPS is enabled, it´s not possible to upload to Xively ?
I get (coordinates anonymized):
_DEBUG:main: ERROR: Exception during output: 'Disposition'
DEBUG:main: GPS output (55.71072, 12.57942, -6.6, 'fixed', 'indoor')
INFO:main: Success: Data successfully obtained from all sensors.
DEBUG:main: Dataset to output to <outputs.csvoutput.CSVOutput object at 0xa646b150>:
DEBUG:main: [{'description': 'BOSCH combined temperature and pressure sensor.', 'symbol': 'C', 'value': 30.8, 'breach': False, 'readingtype': 'sample', 'sensor': 'BMP085-temp', 'unit': 'Celsius', 'name': 'Temperature-BMP'}, {'description': 'BOSCH combined temperature and pressure sensor.', 'symbol': 'hPa', 'value': 998.676351863236, 'breach': False, 'readingtype': 'sample', 'sensor': 'BMP085-pres', 'unit': 'Hectopascal', 'name': 'Pressure'}, {'description': 'A combined temperature and humidity sensor.', 'symbol': '%', 'value': 23.5, 'breach': False, 'readingtype': 'sample', 'sensor': 'DHT22-hum', 'unit': '% Relative Humidity', 'name': 'Relative_Humidity'}, {'description': 'A combined temperature and humidity sensor.', 'symbol': 'C', 'value': 31.0, 'breach': False, 'readingtype': 'sample', 'sensor': 'DHT22-temp', 'unit': 'Celsius', 'name': 'Temperature-DHT'}, {'description': 'A light dependent resistor', 'symbol': 'Ohms', 'value': 535.5303810504636, 'breach': False, 'readingtype': 'sample', 'sensor': 'LDR', 'unit': 'Ohms', 'name': 'Light_Level'}, {'description': 'A nitrogen dioxide sensor', 'symbol': 'Ohms', 'value': 32625.0, 'breach': False, 'readingtype': 'sample', 'sensor': 'MiCS-2710', 'unit': 'Ohms', 'name': 'Nitrogen_Dioxide'}, {'description': 'A carbon monoxide sensor', 'symbol': 'Ohms', 'value': 37500.0, 'breach': False, 'readingtype': 'sample', 'sensor': 'MiCS-5525', 'unit': 'Ohms', 'name': 'Carbon_Monoxide'}, {'description': 'A microphone to measure ambient noise', 'symbol': 'mV', 'value': 203.2258064516129, 'breach': False, 'readingtype': 'sample', 'sensor': 'Microphone', 'unit': 'millvolts', 'name': 'Volume'}, {'name': 'Location', 'altitude': -6.6, 'longitude': 12.xxxxx, 'disposition': 'fixed', 'latitude': 55.xxxxx, 'sensor': 'MTK3339', 'exposure': 'indoor'}]
DEBUG:main: Dataset to output to <outputs.xively.Xively object at 0xb591cc10>:
DEBUG:main: [{'description': 'BOSCH combined temperature and pressure sensor.', 'symbol': 'C', 'value': 30.8, 'breach': False, 'readingtype': 'sample', 'sensor': 'BMP085-temp', 'unit': 'Celsius', 'name': 'Temperature-BMP'}, {'description': 'BOSCH combined temperature and pressure sensor.', 'symbol': 'hPa', 'value': 998.676351863236, 'breach': False, 'readingtype': 'sample', 'sensor': 'BMP085-pres', 'unit': 'Hectopascal', 'name': 'Pressure'}, {'description': 'A combined temperature and humidity sensor.', 'symbol': '%', 'value': 23.5, 'breach': False, 'readingtype': 'sample', 'sensor': 'DHT22-hum', 'unit': '% Relative Humidity', 'name': 'Relative_Humidity'}, {'description': 'A combined temperature and humidity sensor.', 'symbol': 'C', 'value': 31.0, 'breach': False, 'readingtype': 'sample', 'sensor': 'DHT22-temp', 'unit': 'Celsius', 'name': 'Temperature-DHT'}, {'description': 'A light dependent resistor', 'symbol': 'Ohms', 'value': 535.5303810504636, 'breach': False, 'readingtype': 'sample', 'sensor': 'LDR', 'unit': 'Ohms', 'name': 'Light_Level'}, {'description': 'A nitrogen dioxide sensor', 'symbol': 'Ohms', 'value': 32625.0, 'breach': False, 'readingtype': 'sample', 'sensor': 'MiCS-2710', 'unit': 'Ohms', 'name': 'Nitrogen_Dioxide'}, {'description': 'A carbon monoxide sensor', 'symbol': 'Ohms', 'value': 37500.0, 'breach': False, 'readingtype': 'sample', 'sensor': 'MiCS-5525', 'unit': 'Ohms', 'name': 'Carbon_Monoxide'}, {'description': 'A microphone to measure ambient noise', 'symbol': 'mV', 'value': 203.2258064516129, 'breach': False, 'readingtype': 'sample', 'sensor': 'Microphone', 'unit': 'millvolts', 'name': 'Volume'}, {'name': 'Location', 'altitude': -6.6, 'longitude': 12.xxxxx, 'disposition': 'fixed', 'latitude': 55.xxxxx, 'sensor': 'MTK3339', 'exposure': 'indoor'}]
_
I was wondering if there were plans to update the calibration code to convert the readings to more human-readable units (ppm, dB, etc.) instead of the raw ohms or millivolts? Mainly for Nitrogen Dioxide, Carbon Monoxide, Volume, etc.?
I was happy to see some of the calibration formulas in /cfg/supports.cfg but they are all commented out and don't seem to convert units. Thanks!
Out of all the calibration functions the only one I get to work is:
func_Nitrogen_Dioxide = (0.0014*(x/142686.5672))+0.2857
Any other one and I get this error:
Exception during output: unsupported operand type(s) for ^: 'float' and 'int'
TypeError: buckettip() takes exactly 1 argument (2 given)
Sample frequency increases by 0.01 seconds per sample, so at high frequency it will start to deviate after running for some time. Professional-grade scientific gear skips a sample or just resets the clock every 24-hours - do we just mimic that behaviour?
Hey there! I'm currently setting up my own AirPi and I'm pretty happy about this fork for having done all the things I'd need to implement myself ;) Thank you!
However, trying to use the http plugin results in serveral errors. They appear in the dev and master branches, my current setup is using the dev branch:
[AirPi] Current installed version and latest change:
commit 4c0341dea64ad26e8a3e1acd6758361dd1a4de3d
Author: Haydn Williams <[email protected]>
Date: Sun May 31 19:38:46 2015 +0000
Change: Add clarification to calibration function comments.
(snip)
My outputs.cfg (for http)
[HTTP]
filename = http
enabled = yes
calibration = on
wwwPath = www ; Must be full path if used with AirPi bootstart feature
port = 8080
history = on
historyFile = history.dat
historySize = 2880
historyInterval = 30
historyCalibrated = false
title = AirPi - <hostname>
about = This is an AirPi pollution / air quality monitoring device.
#target = internet
target = lan
Trying to simply use the http plugin throws the following error:
{'historyCalibrated': False, 'historyFile': 'history.dat', 'about': 'This is an AirPi pollution / air quality monitoring device.', 'historyInterval': '30', 'target': 'lan', 'limits': False, 'calibration': True, 'title': 'AirPi - <hostname>', 'history': True, 'historySize': '2880', 'httpVersion': False, 'wwwPath': 'www', 'port': '8080', 'metadata': False}
done first bit
done second bit
done third bit
starting hostname
starting title et al.
ERROR: Failed to import plugin HTTP: global name 'calibration' is not defined
I solved that one myself by adding a simple import calibration
at the start of the file. With that, the http plugin loads, but trying to access the site gives me the following error:
----------------------------------------
Exception happened during processing of request from ('192.168.2.112', 52948)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__
self.handle()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
self.handle_one_request()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
method()
File "/home/pi/AirPi/outputs/http.py", line 333, in do_GET
page = replace(page, "$time$", self.server.httpoutput.lastUpdate)
AttributeError: 'HTTP' object has no attribute 'lastUpdate'
----------------------------------------
This happens no matter if the sampling has actually started or not. I fixed it by replacing self.server.httpoutput.lastUpdate
with the current time, but this yields the following error:
----------------------------------------
Exception happened during processing of request from ('192.168.2.112', 52955)
Traceback (most recent call last):
File "/usr/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock
self.process_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 321, in process_request
self.finish_request(request, client_address)
File "/usr/lib/python2.7/SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python2.7/SocketServer.py", line 649, in __init__
self.handle()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle
self.handle_one_request()
File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request
method()
File "/home/pi/AirPi/outputs/http.py", line 336, in do_GET
for i in self.server.httpoutput.data:
AttributeError: 'HTTP' object has no attribute 'data'
----------------------------------------
I'm assuming that the sample data isn't send to the http output module, but since my understanding of the projects code (and, well, python) is very shallow, I can't fix this on my own. Any ideas?
I'll maybe try an older commit until this is fixed.
Update: Reverting to commit/version 1.0 didn't fix this :/ (it did fix the import however)
When trying to print to console via print.py
with GPS enabled, there is no GPS output, no '=' delimiter line between readings, and in the airpi.log
file I see the following:
2016-09-25 17:01:05,689 - __main__ - DEBUG - ERROR: Exception during output: Unknown format code 'f' for object of type 'str'
The breakage seems to have happened In the commit by Haydn Williams on Oct 15, 2014 - Lots of pylint improvements.
This part of the commit in format_output_gps()
broke GPS output:
100 - return str(prop.ljust(17) + ": " + str("{0:.2f}".format(value)).rjust(10) + " " + unit)
147 + value = str(prop.ljust(17)) + ": "
148 + value += str("{0:.2f}".format(value).rjust(10) + " " + unit)
Note that value
is passed in as an argument then immediately overwritten and assigned a value that is a string. When it is then appended to, the attempt to format what is now a string as a float causes the exception.
GPS output works by just changing back with an ljust(18)
to match the other outputs:
return str(prop.ljust(18)) + ": " + str("{0:.2f}".format(value).rjust(10) + " " + unit)
When I run airpictl.sh normal
the process seems to freeze at "INFO: Doing initialising runs for 15 seconds."
Have left it for several minutes. No change. Won't respond to ctrl
+c
.
New Raspberry Pi 2. AirPi 1.4 (previously working on an old Pi).
Fresh install of Jessie Lite. Have updated and rebooted.
Full output is:
[AirPi] Starting normal AirPi sampling.
[AirPi] This run will end if you log out.
[AirPi] Press Ctrl + C to stop.
==========================================================
Loading: SETTINGS
Success: Loaded settings.
==========================================================
Loading: SUPPORTS
Success: Loaded support plugin Calibration
==========================================================
Loading: SENSORS
Success: Loaded sensor plugin BMP085-temp
Success: Loaded sensor plugin BMP085-pres
Success: Loaded sensor support plugin MCP3008
Success: Loaded sensor plugin DHT22-hum
Success: Loaded sensor plugin DHT22-temp
Success: Loaded sensor plugin LDR
Success: Loaded sensor plugin TGS2600
Success: Loaded sensor plugin MiCS-2710
Success: Loaded sensor plugin MiCS-5525
Success: Loaded sensor plugin Microphone
==========================================================
Loading: OUTPUTS
Success: Loaded output plugin Print
==========================================================
Loading: NOTIFICATIONS
INFO: No Notifications enabled.
==========================================================
Loading: METADATA
Run started............10:36 on Monday 02 May 2016
Operator...............Dr. O. Perator
Raspberry Pi name......AirPi
Raspberry Pi ID........00000000xxxxxxxx
Sample frequency.......5 seconds
Initialising runs......15 seconds
==========================================================
Success: Setup complete.
==========================================================
INFO: Sampling will start in 43 seconds.
INFO: Sampling will start in 40 seconds.
INFO: Sampling will start in 30 seconds.
INFO: Sampling will start in 20 seconds.
INFO: Sampling will start in 10 seconds.
INFO: Doing initialising runs for 15 seconds.
Any way to tell what's causing the problem?
Thanks :-)
I get this error when I enable the Calibration plugin. Error: faild to import....
outputs\ubidots.py line 31 remove extra space showing after ID-LDR
Hey there!
My AirPi works fine but I have got problems with the Adafruit GPS.
I installed gpsd, gpsd-clients and python-gps. With cgps –s I get positive results.
But when I start the AirPi I get the following error:
INFO: Doing initialising runs for 15 seconds.
DEBUG:__main__: GPS output (nan, nan, nan, 'fixed', 'indoor')
Traceback (most recent call last):
File "/home/pi/AirPi/airpi.py", line 1388, in <module>
dummy_runs(SETTINGS['DUMMYDURATION'])
File "/home/pi/AirPi/airpi.py", line 1011, in dummy_runs
read_gps(i)
File "/home/pi/AirPi/airpi.py", line 1067, in read_gps
reading["name"] = sensorplugin.valname
AttributeError: 'serial_gps' object has no attribute 'valname'
[AirPi] Current installed version and latest change:
commit 6a047b605f3263d4b791363b6df95740050f60a3
Author: Haydn Williams <[email protected]>
Date: Tue Jul 14 22:22:19 2015 +0000
Change: Partial fix for issue #19, error with HTTP output.
gpsd, gpsd-clients and python-gps:
Version 3.6-4+deb7u1
Thanks for your great help.
Kind regards
Sven
Hi,
Just use your install procedure on a fresh RPI and I noticed that git is not install by the install.sh while it is required further in the install script.
Maybe an apt-get install git can be inserted in that script ?
Regards.
Alexandre
Enabling the HTTP output plugin has been shown to cause the Raspberry Pi to crash after running for any length of time. There are no error messages or debug messages displayed. Cause is currently unknown.
More info: http://airpi.freeforums.net/post/902/thread
I was trying to implement it myself into the support.cfg but I have to admit I have failed...
Since 1 tip equals to 0.2794mm the equation should be something like:
Total of the tips times 0.2794mm in 3600 seconds and reset, but since I am an absolute Python I have no idea whatsoever on how to implement it...
Thanks for the project, very very nice work.
Previously I used the csvout it works well. For the past few days I'm trying to use rrdoutput but without success.
There were some issue like problem with lack of calibration module and graph printing section (i throw out it from rrdoutput.py) and I assume it should help. But I got the following error in debug mode.
Loading: OUTPUTS
INFO:__main__: Config file: /home/pi/AirPi/cfg/outputs.cfg
INFO:__main__: Success: Successfully imported output module: print
INFO:__main__: INFO: Trying to get subclass for print
INFO:__main__: Success: Successfully got subclasses for print
INFO:__main__: Starting to set instclass for print
INFO:__main__: Output plugin params are: {'calibration': True, 'metadata': True, 'target': 'screen', 'limits': False, 'format': 'friendly'}
INFO:__main__: Success: Successfully set instclass for print
Success: Loaded output plugin Print
INFO:__main__:*******************
INFO:__main__: Success: Successfully imported output module: rrdoutput
INFO:__main__: INFO: Trying to get subclass for rrdoutput
INFO:__main__: Success: Successfully got subclasses for rrdoutput
INFO:__main__: Starting to set instclass for rrdoutput
ERROR: Failed to import plugin RRDOutput: SafeConfigParser instance has no attribute '__getitem__'
INFO:__main__: ERROR: Failed to import plugin RRDOutput: SafeConfigParser instance has no attribute '__getitem__'
The installation is clean, sensors are working, tested outputs http, cvs, print works like a charm. Rrdoutput no :/
Rrd file created manually, path is correct and present in config file. Have no idea were cloud be the problem.
version is:
commit fce8f757f9c6b549be7c8e46d69869584de3c69d
Author: Haydn Williams <[email protected]>
Date: Wed Nov 11 20:53:45 2015 +0000
Change: Update release notes in README.md. Add line re: GPS setup.
Did you met that kind of issue?
Enabling the averaging function can cause the "Sample frequency too fast" warning message to display, even if the sample frequency is not too fast.
Note that the values output by the averaging function are correct; it is only the display of the warning message which is incorrect.
Probably related to issue #10.
Using HTML output - all working fine and showing correct readings/headings, but not all of the graphs seem to update correctly
i.e. AirPi been running 3 hours, top graph for Temperature-BMP is showing full 3 hours in the graph, but most of the others just showing an hour or less and not updating to show full period that AirPi has been sampling
ThingSpeak and Xively output plugins are not currently working when enabled in outputs.cfg. Reasons unclear as yet.
Loading: OUTPUTS
Success: Loaded output plugin Print
ERROR: Could not import output module csvoutput
ERROR: Did not import output plugin CSVOutput: No module named calibration
Traceback (most recent call last):
File "/home/pi/AirPi/airpi.py", line 1356, in
PLUGINSOUTPUTS = set_up_outputs()
File "/home/pi/AirPi/airpi.py", line 604, in set_up_outputs
raise excep
ImportError: No module named calibration
The 'metadata' output with print or csv currently always outputs a dummy name. It does not yet use the setting in settings.cfg.
NOT FIXED - updated to latest version and still crashes the AirPi software when the LDR gets complete darkness - disabled LDR sensor again and then the software works fine and has been running for hours
Hi
My BMP085 reads about 3 degrees C higher than the real temperature
What line do I need to add to supports.cfg to minus 3 degrees off the result?
Thanks
get following error with it enabled:-
Missing config section for plugin Ubidot.
ERROR: Failed to import plugin Ubidots
The warning designed to highlight when the sample frequency is too short sometimes appears even when the frequency is sufficiently long (e.g. sample every minute and average every ten minutes).
When I first ran the software, it popped up with this error message:
Error: Check wiring for the TGS2600 measurement, no voltage detected on ADC input 1
Looks like it wasn't correctly configured for my sensors.
DEBUG:main: ERROR: Exception during output: global name 'findVal' is not defined
Running on the latest release I´m having trouble with the xively plugin:
Outputs.cfg:
[HTTP]
filename = http
enabled = no
calibration = off
wwwPath = /home/pi/AirPi/WWW/ ; Must be full path if used with AirPi bootstart $
port = 8099
history = on
historyFile = history.dat
historySize = 2880
historyInterval = 30
historyCalibrated = false
title = AirPi -
about = This is an AirPi pollution / air quality monitoring device.
target = internet
[Xively]
filename = xively
enabled = yes
apikey = {myKey}
feedid = {myFeedId}
calibration = off
target = internet
Run log on raspberry:
==========================================================
Loading: OUTPUTS
ERROR: Failed to import plugin Xively: global name 'http' is not defined
==========================================================
After tireless hours of running into compatibility issues, I've made it to somewhat of a point where I can take readings from my sensors. But when I try and view the via the built-in HTTP server I run into an error:
Exception happened during processing of request from ('192.168.1.237', 46793) Traceback (most recent call last): File "/usr/lib/python2.7/SocketServer.py", line 290, in _handle_request_nobloc k self.process_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 318, in process_request self.finish_request(request, client_address) File "/usr/lib/python2.7/SocketServer.py", line 331, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/lib/python2.7/SocketServer.py", line 652, in __init__ self.handle() File "/usr/lib/python2.7/BaseHTTPServer.py", line 340, in handle self.handle_one_request() File "/usr/lib/python2.7/BaseHTTPServer.py", line 328, in handle_one_request method() File "/home/pi/AirPi/outputs/http.py", line 323, in do_GET page = replace(page, "$time$", self.server.httpoutput.lastUpdate) AttributeError: 'HTTP' object has no attribute 'lastUpdate'
This occurs when I initially try to load the webpage (which I had previously enabled in~AirPi/cfg/settings.cfg). I haven't the slightest clue as to what I can do so any help would be much appreciated.
The plots in the HTTP output plugin show the time axis in UTC, not in local time.
Can easily be fixed by correcting for the local timezone offset:
Line 206 in http.py (in recordData function):
Change 't[0] = time.time()' to 't[0] = time.time() - time.timezone'
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.