DIY Air Quality Sensor + 3D Printed Case

by finnbear in Circuits > Arduino

6166 Views, 27 Favorites, 0 Comments

DIY Air Quality Sensor + 3D Printed Case

Finished Product Cropped.JPG

This guide has all the information you need to create a very capable, pocket sized sensor.

Setting the Requirements

To get the most out of our DIY air quality sensor, we need it to be:

  • Pocket-sized
  • Battery-powered
  • Have a charging circuit included
  • Connected to USB
  • Connected to WiFi and Bluetooth
  • Readable with an included OLED screen
  • Under $100

We want our pocket-sized sensor to be able to measure:

  • Temperature
  • Pressure
  • Humidity
  • CO2 levels which affect brain function
  • TVOC (air quality) levels to help stay safe around a 3d printer

Collecting the Materials

For this project, you will need several components. The total cost is $82.57 at the time of writing.

You will also need:

  • A 3D printer, I used the MonoPrice Mini Delta 3D printer (https://www.monoprice.com/product?p_id=21666)
  • 3D printer filament, I used PLA
  • A Philips head screw driver
  • Scrap plastic sheet for the transparent face plate
  • Larger bolts to attach the transparent face plate

3D Printing the Enclosure

3D Enclosure Versions Cropped.JPG
3D Enclosure Empty Cropped.JPG

Normally, you would have to design your own 3D printed enclosure. Luckily, I have published the 3D printing files on Thingiverse: https://www.thingiverse.com/thing:3545884. In total, it took 4 iterations to get to the final design.

I used the following settings to print the design:

  • 0.2mm layer height
  • 20% infill
  • No bed adhesion layer

Assembly

Standoffs Cropped.JPG
Finished Product Cropped.JPG
Plastic Face Plate Cropped.JPG

First, attach the standoffs to the 6 small mounting holes in the enclosure.

Second, insert the battery between the standoffs. It will fit under the circuit boards.

Third, screw in the electronics. If the proper standoffs were used, the USB port should line up perfectly with the hole in the enclosure.

Fourth, connect the electronics together. After plugging in the battery to the microcontroller, use the QWIIC cables to connect the sensor and the display in series.

Lastly, cut a small sheet of scrap plastic for the transparent face plate. Drill holes to match the two larger mounting holes in the enclosure and then attach it with longer bolts.

Programming

Code.png
Online Page.png

Rather than programming from scratch, I suggest you download my code from the repository linked below.

Repository: https://gitlab.com/finnbear/pda/blob/master/PDA_ES...

Currently, the code:

  • Reads data from each sensor
  • Calculates a rate of change
  • Displays data on the OLED display
  • Connects to WiFi and displays data on a generated web-page (on the IP address displayed on the screen)

To program the microcontroller, you will need to:

  1. Download the Arduino IDE (https://www.arduino.cc/en/Main/Software)
  2. Set up the Arduino IDE and USB drivers (https://learn.sparkfun.com/tutorials/esp32-thing-p...)
  3. Download the libraries for the sensor and the OLED using the Arduino IDE libraries manager
  4. Save your WiFi SSID and password in the boards "preferences"

Future Improvements

Here are some ideas to improve the project:

  1. Use WiFi to upload data to ThingSpeak or another service to graph it
  2. Measure the battery voltage and display remaining time
  3. Use WiFi to download weather information, news, and anything a smart watch would display
  4. Add an alarm if CO2 levels are too high
  5. Add an alarm if TVOC levels are too high

Note: #4 would be a really awesome way to stay safe in enclosed spaces and #5 is very applicable to 3D printer users like myself!