Difference between revisions of "ECE434 Project - Air Quality Monitor"

From eLinux.org
Jump to: navigation, search
m
(Highlights)
 
(35 intermediate revisions by 2 users not shown)
Line 3: Line 3:
 
{{YoderHead}}
 
{{YoderHead}}
  
Team members: [[user:Yoder|Mark A. Yoder]] [[user:Zacherw|Wojciech Zacherek]]
+
Team members: [[user:Zacherw|Wojciech Zacherek]] [[user:ricet|Tiarnan Rice]]
  
 
== Grading Template ==
 
== Grading Template ==
Line 27: Line 27:
 
== Executive Summary ==
 
== Executive Summary ==
  
Picture that summarizes the project.
+
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.
  
Give two sentence intro to the project.
+
== 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.
 +
 
 +
[[File:Enclosure.PNG|400px]]
  
Give two sentences telling what works.
+
== Installation Instructions ==
  
Give two sentences telling what isn't working.
+
The Air Quality Monitor Repo is a free-to-use repo for anyone interested in producing the product we designed and/or for making improvements. You may click this [https://github.com/ricet/AirQualityMonitor Git Link] or go to https://github.com/ricet/AirQualityMonitor .
  
End with a two sentence conclusion.
 
  
The sentence count is approximate and only to give an idea of the expected length.
+
The following table details relevant files and their descriptions for installing the necessary packages
 +
{| class="wikitable"
 +
|-
 +
! 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.
 +
{| class="wikitable"
 +
|-
 +
! 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
 +
|}
  
== Packaging ==
 
If you have hardware, consider [http://cpprojects.blogspot.com/2013/07/small-build-big-execuition.html Small Build, Big Execuition] for ideas on the final packaging.
 
  
== Installation Instructions ==
+
{| class="wikitable"
 +
|-
 +
| Top View of PCB
 +
[[File:PCB_IRL_1.png|500px|border|Empty PCB Printed, Side 1]]
 +
| Bottom View of PCB
 +
[[File:PCB_IRL_2.png|500px|border|Empty PCB Printed, Side 2]]
 +
|-
 +
| Top View, Populated PCB
 +
[[File:Product_1.png|500px|border|Empty PCB Printed, Side 1]]
 +
| Bottom View, Populated PCB
 +
[[File:Product_2.png|500px|border|Empty PCB Printed, Side 2]]
 +
|}
  
Give step by step instructions on how to install your project. 
 
  
* Include your [https://github.com/ github] path as a link like this to the read-only git site:  [https://github.com/MarkAYoder/gitLearn https://github.com/MarkAYoder/gitLearn].  
+
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. There is a JSON file that can be imported directly into [https://easyeda.com/ EasyEDA] and be ordered through [https://jlcpcb.com/ JLCPCB], along with the Gerbers. The files can be found under the '''PCB Files''' directory on the git repo.
* 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.
 
  
 
== User Instructions ==
 
== 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.
  
Once everything is installed, how do you use the program?  Give details here, so if you have a long user manual, link to it here.
+
Once everything is setup, the user should be viewing a Grafana Dashboard with various plots displaying live data.
 
+
{| class="wikitable"
Consider making it autostart for full credit.
+
|-
 +
| Top portion of the provided Grafana Dashboard
 +
[[File:AirQuality1.png|500px|border|Empty PCB Printed, Side 1]]
 +
| Bottom portion of the provided Grafana Dashboard
 +
[[File:AirQuality2.png|500px|border|Empty PCB Printed, Side 2]]
 +
|}
  
 
== Highlights ==
 
== Highlights ==
  
Here is where you brag about what your project can do.
+
Here s our demo video on [https://youtu.be/dAZ93oahjzE/ YouTube]
 
 
Include a [http://www.youtube.com/ YouTube] demo the audio description.
 
  
 
== Theory of Operation ==
 
== Theory of Operation ==
  
Give a high level overview of the structure of your software.  Are you using GStreamer?  Show a diagram of the pipeline.  Are you running multiple tasks?  Show what they do and how they interact.
+
The product should work with minimum setup from the user, which shouldn't go beyond inputting network credentials for internet access.
  
== Work Breakdown ==
+
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).
  
List the major tasks in your project and who did what.
+
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.
  
Also list here what doesn't work yet and when you think it will be finished and who is finishing it.
+
== 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 ==
 
== Future Work ==
  
Suggest addition things that could be done with this project.
+
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.
 +
 
 +
{| class="wikitable"
 +
|-
 +
! 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 ==
 
== Conclusions ==
  
Give some concluding thoughts about the project. Suggest some future additions that could make it even more interesting.
+
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.  
  
 
{{YoderFoot}}
 
{{YoderFoot}}

Latest revision as of 11:15, 17 November 2021

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

The Air Quality Monitor Repo is a free-to-use repo for anyone interested in producing the product we designed and/or for making improvements. You may click this Git Link or go to 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


Top View of PCB

Empty PCB Printed, Side 1

Bottom View of PCB

Empty PCB Printed, Side 2

Top View, Populated PCB

Empty PCB Printed, Side 1

Bottom View, Populated PCB

Empty PCB Printed, Side 2


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. There is a JSON file that can be imported directly into EasyEDA and be ordered through JLCPCB, along with the Gerbers. The files can be found under the PCB Files directory on the git repo.

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.

Once everything is setup, the user should be viewing a Grafana Dashboard with various plots displaying live data.

Top portion of the provided Grafana Dashboard

Empty PCB Printed, Side 1

Bottom portion of the provided Grafana Dashboard

Empty PCB Printed, Side 2

Highlights

Here s our demo video on YouTube

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