Science and technology

How to construct a cellular particulate matter sensor with a Raspberry Pi

About a 12 months in the past, I wrote about measuring air quality utilizing a Raspberry Pi and an inexpensive sensor. We’ve been utilizing this venture in our faculty and privately for a number of years now. However, it has one drawback: It will not be moveable as a result of it will depend on a WLAN community or a wired community connection to work. You cannot even entry the sensor’s measurements if the Raspberry Pi and the smartphone or laptop aren’t on the identical community.

To overcome this limitation, we added a small display to the Raspberry Pi so we are able to learn the values immediately from the system. Here’s how we arrange and configured a display for our cellular high quality particulate matter sensor.

Setting up the display for the Raspberry Pi

There is a variety of Raspberry Pi shows out there from Amazon, AliExpress, and different sources. They vary from ePaper screens to LCDs with contact operate. We selected a reasonable 3.5″ LCD with contact and a decision of 320×480 pixels that may be plugged immediately into the Raspberry Pi’s GPIO pins. It’s additionally good three.5″ show is about the identical dimension as a Raspberry Pi.

The first time you activate the display and begin the Raspberry Pi, the display will stay white as a result of the motive force is lacking. You have to put in the appropriate drivers for the show first. Log in with SSH and execute the next instructions:

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

Execute the suitable command to your display to put in the drivers. For instance, that is the command for our mannequin MPI3501 display:

$ sudo ./LCD35-show

This command installs the suitable drivers and restarts the Raspberry Pi.

Installing PIXEL desktop and organising autostart

Here is what we would like our venture to do: If the Raspberry Pi boots up, we need to show a small web site with our air high quality measurements.

First, set up the Raspberry Pi’s PIXEL desktop environment:

$ sudo apt set up raspberrypi-ui-mods

Then set up the Chromium browser to show the web site:

$ sudo apt set up chromium-browser

Autologin is required for the measured values to be displayed immediately after startup; in any other case, you’ll simply see the login display. However, autologin will not be configured for the “pi” consumer by default. You can configure autologin with the raspi-config software:

$ sudo raspi-config

In the menu, choose: three Boot Options → B1 Desktop / CLI → B4 Desktop Autologin.

There is a step lacking to begin Chromium with our web site proper after boot. Create the folder /dwelling/pi/.config/lxsession/LXDE-pi/:

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

Then create the autostart file on this folder:

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

and paste the next code:

#@unclutter
@xset s off
@xset -dpms
@xset s noblank
 
# Open Chromium in Full Screen Mode
@chromium-browser --incognito --kiosk http://localhost

If you need to disguise the mouse pointer, it’s a must to set up the package deal unclutter and take away the remark character at first of the autostart file:

$ sudo apt set up unclutter

I’ve made a number of small adjustments to the code within the final 12 months. So, if you happen to arrange the air high quality venture earlier than, make sure that to re-download the script and information for the AQI web site utilizing the directions within the original article.

By including the contact display, you now have a cellular particulate matter sensor! We use it at our faculty to test the standard of the air within the lecture rooms or to do comparative measurements. With this setup, you might be now not depending on a community connection or WLAN. You can use the small measuring station in every single place—you possibly can even use it with an influence financial institution to be impartial of the facility grid. 


This article initially appeared on Open School Solutions and is republished with permission.

Most Popular

To Top