paint-brush
How to Build a Mobile Particulate Matter Sensorby@OpenSchoolZ
466 reads
466 reads

How to Build a Mobile Particulate Matter Sensor

by Open School SolutionsMarch 15th, 2019
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

About a year ago I wrote about <a href="https://openschoolsolutions.org/measure-particulate-matter-with-a-raspberry-pi/" target="_blank">how to measure the air quality</a> with a Raspberry Pi and a cheap sensor. Make sure to read that article first! We’ve been using this setup in our school and privately for a few years now. However, this project has one disadvantage: it is not portable, but depends on a WLAN network or a wired network connection. You actually cannot access the measurements if the Raspberry Pi and the smartphone or computer are not in the same network. That’s why some time ago we added a small screen to the Raspberry Pi so that you can read the values directly from the device. How to set up this screen for our mobile fine particulate matter sensor and which additional configurations are necessary, I would like to describe in this article.

Companies Mentioned

Mention Thumbnail
Mention Thumbnail
featured image - How to Build a Mobile Particulate Matter Sensor
Open School Solutions HackerNoon profile picture

About a year ago I wrote about how to measure the air quality with a Raspberry Pi and a cheap sensor. Make sure to read that article first! We’ve been using this setup in our school and privately for a few years now. However, this project has one disadvantage: it is not portable, but depends on a WLAN network or a wired network connection. You actually cannot access the measurements if the Raspberry Pi and the smartphone or computer are not in the same network. That’s why some time ago we added a small screen to the Raspberry Pi so that you can read the values directly from the device. How to set up this screen for our mobile fine particulate matter sensor and which additional configurations are necessary, I would like to describe in this article.

Setting up the screen for the Raspberry Pi

On Amazon or AliExpress there are different displays for the Raspberry Pi. These range from ePaper screens to LCDs with touch function. We chose a 3,5″ LCD with touch, that has a resolution of 320×480 pixels (model MPI3501). You can simply plug this screen onto the GPIO pins. It costs only 10–20$. It’s also nice that a 3,5″ display is about the same size like a Raspberry Pi.

If you put on the screen and start the Raspberry Pi, the screen stays white. That normal, because the driver is missing. You have to install the appropriate drivers for the display first. To do this, log in via SSH and execute the following commands:




$ rm -rf LCD-show$ git clone https://github.com/goodtft/LCD-show.git$ chmod -R 755 LCD-show$ cd LCD-show/

Depending on the screen model you have to execute the appropriate command to install the drivers. In our case (for the model MPI3501):

$ sudo ./LCD35-show

This command installs the appropriate drivers and then restarts the Raspberry Pi.

Installing the Pixel Desktop and Setting Up Autostart

Here is what we want: if the Raspberry Pi boots up we want to display our small website with the measurements. So first you have to install the pixel desktop environment (if you have used Raspian Lite before) with

$ sudo apt install raspberrypi-ui-mods

Then the Chromium browser (we need it to display the website):

$ sudo apt install chromium-browser

By default, the autologin is not configured for the user “pi”. However, this is necessary so that the measured values can be displayed directly after the start. Otherwise you will only see the login screen. You can configure the autologin with the raspi-config tool:

In the menu select 3 Boot Options → B1 Desktop / CLI → B4 Desktop Autologin.

There is one step missing to start chromium right after bootup with our website. Create the folder /home/pi/.config/lxsession/LXDE-pi/:

$ mkdir -p /home/pi/config/lxsession/LXDE-pi/

Then create the autostart file in this folder.

$ nano /home/pi/.config/lxsession/LXDE-pi/autostart

and paste the following code:




#@unclutter@xset s off@xset -dpms@xset s noblank


# Open Chrome in full screen mode after boot@chromium-browser — incognito — kiosk http://localhost

If you want to hide the mouse pointer, you have to install the package unclutter and remove the comment character at the beginning of the autostart file:

$ sudo apt install unclutter

Since I made a few small changes to the code last year, it is recommended to re-download the script and the files of the AQI website (see the original article for how to do this).

Conclusion

With the touch screen added you now have a mobile particulate matter sensor! We use it at our school to check the quality of the air in the classrooms or to do comparative measurements. With this setup, you are no longer dependent on a network connection or WLAN. You can use the small measuring station everywhere — with a power bank even independent of the power grid.

Originally published at openschoolsolutions.org.