Skip to content
This repository has been archived by the owner on Aug 28, 2023. It is now read-only.

ajportier/airquality

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AirQuality

Air quality sensor network sim

About

AirQuality is a service for collecting air quality readings from sensors attached to single-board computers, such as the Raspberry Pi. Readings are collected using a RESTful interface, then displayed in real-time using graphs. Sensors can be grouped into regions to create graphs averaging the results of all sensors in the region, instead of displaying individual sensor readings.

Final Project for Internet of Things class at Villanova University.

Made with Flask, jQuery, CanvasJS and Bootstrap, using MongoDB as a database backend.

RaspberryPi sender component written in C using WiringPi, libcurl and libconfig. Assumes use of MQ-2 Gas Sensor connected through a ADC0832 analog-to-digital converter.

Installation

Server Portion

  1. Install Python 2.7+, python-virtualenv and MongoDB on server
  2. Install the Python packages needed using virtualenv 1. virtualenv airquality-venv 2. source airquality-venv/bin/activate 3. pip install -r requirements.txt
  3. Configure application server to point at airquality.app or start server.py
  4. Browse to http://127.0.0.1:5000 or wherever the server is running to see the user interface

Raspberry Pi Portion

  1. Obtain and connect MQ-2 Gas Sensor and ADC0832 (wiring diagram in rspi/mq-2_wiring.jpg)
  2. Install WiringPi, libcurl and libconfig on RaspberryPi (instructions in rspi/sender.c)
  3. Compile sender executable, modify config.cfg to point at running server, and start as root

Simulator Instructions

In the rspi folder there is a simulator.py script that can send random readings similar to the ones generated by the MQ-2 sensor to a running AirQuality server. Change the URL in the script to point at a running server and run the simulator with the following command:

./simulator.py --config sim.txt

This will create a "sim.txt" file and populate with a random sensor ID if the file did not already exist, or will load the sensor ID from the file if it was already there. You can (and should) start multiple simulators when testing graphing of regional averages in the interface.

About

Air quality sensor network sim

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published