ECE434 Project - Air Quality Monitor

From eLinux.org
Revision as of 21:20, 15 November 2021 by Zacherw (talk | contribs) (Installation Instructions)
Jump to: navigation, search

thumb‎ Embedded Linux Class by Mark A. Yoder


Team members: Wojciech Zacherek Tiarnan Rice

Grading Template

I'm using the following template to grade. Each slot is 10 points. 0 = Missing, 5=OK, 10=Wow!

09 Executive Summary
09 Packaging
09 Installation Instructions 
09 User Instructions
09 Highlights
09 Theory of Operation
09 Work Breakdown
09 Future Work/Conclusions
09 Hackster.io
09 Demo/Poster
00 Not Late

Score:  90/100

Executive Summary

Our project is an air quality monitoring device that logs the data of several sensors to a database and and makes the data accessible and viewable using a Grafana webserver. The monitor can sense temperature, humidity, pressure, CO2, carbon monoxide, methane, volatile organic compounds (VOCs), and particulate levels. It also has a battery backup built in so that it can operate for several hours without a power supply, a buzzer so that it can act as an alarm if certain sensors are reporting dangerous levels, and a small OLED screen to show the current values of the sensors without having to log into the server. All of these components are assembled onto a custom designed PCB, along with some supporting circuitry. Currently we have all the sensors working with the data being logged and viewable through Grafana. The screen driver that was provided by Adafruit isn't supported by the Beaglebone, and writing a custom driver would have been too large of an undertaking for this project, so that doesn't work. The monitor also does not start everything up automatically after it boots because there is a minor issue with the systemd service that samples the sensors that requires it to be manually restarted once after it boots. Additionally, when the monitor is running on the battery the main 5V rail is not present, which powers several of the sensors, so those sensors do not work on battery power.

Packaging

We designed an enclosure to be 3D printed for the project using Autodesk Inventor, however we were unable to get it printed in time.

Enclosure.PNG

Installation Instructions

Give step by step instructions on how to install your project.

  • Include your github path as a link like this to the read-only git site: https://github.com/MarkAYoder/gitLearn.
  • Be sure your README.md is includes an up-to-date and clear description of your project so that someone who comes across you git repository can quickly learn what you did and how they can reproduce it.
  • Include a Makefile for your code if using C.
  • Include any additional packages installed via apt. Include install.sh and setup.sh files.
  • Include kernel mods.
  • If there is extra hardware needed, include links to where it can be obtained.


Here is the Git Repo with all the code https://github.com/ricet/AirQualityMonitor

The following table details relevant files and their descriptions for installing the necessary packages

Installation Files Description
libinstall.sh Installs all the necessary python libraries for interfacing with the sensors
grafanainstall.sh Installs grafana with the sqlite3 plugin and boot-on-startup enabled on Linux. Use this OR grafanainstallv2
grafanainstallv2.sh Installs grafana with the sqlite3 plugin and boot-on-startup enabled on ARM based machines. Use this OR grafanainstall
sqlite3install.sh Installs sqlite3
setupSystemd.sh Enables the code to auto-start on bootup
removeSystemd.sh Removes the code from auto-starting on bootup


To try out this project, you also need the following equipment and modules.

Module Link
CO2 Sensor https://www.adafruit.com/product/4867
Carbon Monoxide Sensor https://www.sparkfun.com/products/9403
Particulate Sensor https://www.adafruit.com/product/4505
Methane Sensor https://www.sparkfun.com/products/9404
OLED Display https://www.adafruit.com/product/4650
Temperature/Humidity Sensor https://www.adafruit.com/product/5046
Rechargeable Battery https://www.adafruit.com/category/889

On top of that, we have provided PCB files for you to procure. These are not necessarily required, but would really streamline the demo and potential debugging. The files can be found under the PCM Files directory on the git repo.

Empty PCB Printed, Side 1 Empty PCB Printed, Side 2

User Instructions

Once the monitor has powered up and has a network connection, all the user has to do is go to the monitors IP address in their browser and log into Grafana with their credentials (default is admin/admin). There they can see the home dashboard which is set up to have a separate plot for each sensor. The time range can be changed with the time drop down in the upper right if they want to see older data.

Highlights

Here is where you brag about what your project can do.

Include a YouTube demo the audio description.

Theory of Operation

The product should work with minimum setup from the user, which shouldn't go beyond inputting network credentials for internet access.

The BeagleBone Black has a systemd process that autostarts and auto restarts the process in case a crash (a crash could occur is not enough power is delivered to the sensors, rendering them disconnected from the i2c bus).

The project runs using a singular python script for reading, packaging, and saving data to an sqlite database. From there, the Grafana web server queries data from that same database. The queried data is organized into various plots running on a Dashboard on the Grafana web server. The user can access this web server and dashboard by accessing the ip address of the device.

Work Breakdown

The product can be characterized into two design sections - hardware and software. Tiarnan designed the PCB used to connect all the sensors, populated the board with all the modules and components, and wrote code templates for interfacing with the sensors. He also did a cursory search for a suitable data-display program (Grafana) and finalized the data-display interface to be user-friendly. Wojciech created scripts for reading data from the sensors, packaged the data to be inserted into an sqlite database, created and pushed data to the database, and setup the skeleton for interfacing with Grafana.

Future Work

This project had many bumps and turns, and some features were left for future endeavours. Likewise, the current product lacks some features the team thinks would improve the overall quality. We have listed these details below.

Feature Explanation
Buzzer In the event that there is an excessive amount of carbon monoxide in the air, the product's buzzer should alert the user.
OLED Screen The onboard OLED would display current/live data values for all the sensors, with the user toggling between screens using the onboard buttons. The provided libraries don't work with the BeagleBone, and writing custom drivers for this would've distracted from the main goal of the project. We decided to bypass the OLED screen implementation due to these constraints. However, future versions could resolve this issue with custom drivers or by utilizing a different display.
On-Board Power Regulation The current setup involves soldering a LIPO battery to the exposed PMIC battery pins. This setup is not safe and is unreliable, and may have caused the PMIC to break. Additionally, powering through the PMIC with this method does not provide power to the 5V rail, rendering half of the sensors unusable. A better solution would be to have a charger circuit and boost converter on the PCB creating 5V and powering the Beaglebone, and plug the battery into the PCB. This will ensure we are providing enough power in the safest manner possible whilst maintaining portability.
Wifi Adapters The current prototype works reliably connects to the internet using ethernet, but we would like to use wifi adapters to promote mobility. Unfortunately, all our trials suggest the BeagleBone Black cannot reliably use the wifi adapters - we had to unplug/plug in the module before it started working.
Grafana Currently the user has to log into Grafana in order to view the data. Ideally there would be a public dashboard that shows by default when anyone accesses the webserver, however setting that up is not trivial and would have taken more time than we had.

Conclusions

While the project certainly has plenty of rough edges and there's lots to improve on, we still achieved the core functionality of the original idea, which is to monitor the air quality and visualize the data nicely.




thumb‎ Embedded Linux Class by Mark A. Yoder