DesconBelgrade / Klimerko

☁ DIY Air Quality Monitoring Device
https://klimerko.org
GNU General Public License v3.0
115 stars 23 forks source link
air-quality arduino citizen-science diy esp8266

“Klimerko” Air Quality Monitoring Station

"Klimerko" is the continuation of the Winning Project from Descon 4.0 2018.

See live data from all Klimerko devices: Klimerko.org

This is an affordable DIY air quality station that measures Particulate Matter concentration as well as Temperature, Humidity and Pressure.
It publishes data to your AllThingsTalk Maker Cloud (free) where you're able to visualize data, see it historically and control the device.
Continue reading to find out how to build your own, or watch the video below that covers the process.

NOTICE: The video was created before the release of Klimerko Firmware v2.0.0, which introduced WiFi Configuration Mode, so the process of connecting the device to WiFi and AllThingsTalk shown in the video is outdated.

YouTube Video: Kako napraviti klimerka?

Having issues? Go to the Troubleshooting section.
To update your Klimerko, go to Updating Firmware.

Table of Contents

This guide is in chronological order, so try not to skip through parts if you're not sure about it.

Hardware Build

This diagram shows an overview of how Klimerko works Klimerko Diagram

Hardware Required

You'll need these components to follow this guide:

Previously, some of the components below were clickable so you could buy them right away, but shipping to Balkans on some websites became 10x more expensive than the components themselves, therefore the list now only contains the names, description and a photo of the items you need to buy.
You can search for these components on eBay, Banggood, AliExpress or your local electronics store/website.

Tools Required

You’re going to need the following tools at minimum to complete the project:

Hardware Assembly

Once you’ve got all the components and tools ready, it’s time to begin the assembly process.

When soldering, make sure that there's no solder between any two pins (connection holes in the board) on any of the components before plugging the device into a power source.
Pay attention to VIN and GND pins on the NodeMCU, because shorting (connecting) those two pins together will fry NodeMCU and possibly the power source it's connected to.

3D Case Preparation

You can print your own Klimerko Case using a 3D Printer using the 3D Print Files. If you don't have a 3D Printer, your local hacker/makerspace most likely has one!

In case you're not following this guide at a workshop: You're still able to build this device if you don't have the 3D case. You'll just need to tinker and figure out how to place the device in a secure location away from rain/sun (but in an open space so it can detect pollution properly)

Depending on your use case, you can use either the flat stand or the wall-mounted holder. If you wish to wall-mount the device, use 2 screws to mount the holder to a wall. You’ll be able to easily attach and detach the device from the wall.

For now, disassemble the case and put away all the parts except for the components base, where you’ll be placing all the components.

PMS7003 Sensor Preparation

Bridge Board Wire Removal

BME280 Sensor Preparation

You have now completed the setup of the sensor side of the components base. Next up, the NodeMCU side.

NodeMCU Preparation

You should now have 8 wires coming through the circular hole leading to the NodeMCU side of the 3D case.

Please double check to make sure you’re soldering the correct wires (coming from the sensors) to the NodeMCU board.

Sensor Sensor Wire NodeMCU Pin
PMS7003 VCC VIN
PMS7003 GND GND (Any GND pin works)
PMS7003 RX D6
PMS7003 TX D5
BME280 VCC/VIN 3v3 (Any 3v3 pin works)
BME280 GND GND (Any GND pin works)
BME280 SCL D1
BME280 SDA D2

You have now finished all steps that require soldering.

Congratulations, you’ve assembled the device! Now onto the software side.

Cloud Platform (1/2)

Cloud Credentials

Software

For all of the steps below, you'll need Arduino IDE (Integrated Development Environment).
This is a tool that's used to send the "firmware" or "program" to your device.

If you already have Arduino IDE, make sure it's at least version 1.8.15

Installing ESP8266 Support

ESP8266 is the "brains" or "processor" of the NodeMCU, but Arduino IDE doesn't support it out-of-the-box. That's an easy one:

Uploading Firmware

Your NodeMCU's "brain" is empty at the moment. Let's teach it what it needs to do by uploading the program to it:

Configuring Klimerko Credentials and Temperature Offset

Since Klimerko Firmware version 2.0.0, the process of entering WiFi & Platform credentials has been immensely simplified by introducing WiFi Configuration Mode, a feature where Klimerko itself becomes a WiFi Access Point to which you can connect to using your computer or smartphone and then configure the credentials using a simple web interface that opens up automatically once you're connected to your Klimerko.

You need tell your Klimerko which credentials to use to connect to the platform and to which WiFi to connect to:

The blue LED light on NodeMCU blinks slowly (in 1 second intervals) when Klimerko is trying to connect to WiFi or AllThingsTalk (or if the connection can't be established).
If it blinks rapidly a few times and then turns off, the connection to WiFi and AllThingsTalk has been made succesfully.
If it's turned on constantly, it means the WiFi Configuration Mode is currently active and you can connect to your Klimerko using your smartphone.
If you wish to turn off WiFi Configuration Mode without configuring your Klimerko, press the "FLASH" button on your NodeMCU quickly, once. The constant blue LED should turn off.

Cloud Platform (2/2)

All of the data from your Klimerko is available on your AllThingsTalk Maker.
Other than raw actual and historical air quality values, you’re able to see your air quality in a textual form at a glance, see the WiFi Signal Strength of your Klimerko and control how often your Klimerko publishes data.
You’ll also get notifications if your Klimerko goes offline for any reason.

Configure Device

Open AllThingsTalk Maker, go to “Devices” and select your new “Descon Klimerko” device.
You’ll see all assets of your device (stuff that it can report and things you can control).

Make sure to keep the data (that you’re about to set below) updated if you move your device

Share Data

Go to your “Decon Klimerko” device, click “Settings” in the upper right corner, go to “Share data” and share your data with “Vazduh gradjanima”.
Your device will now be visible on the map at Klimerko.org and can help the community be aware of the air quality!

Cloud Map

Visualize Data

Now go to “Pinboards” on the left side of AllThingsTalk Maker.
You should see a new pinboard named “Klimerko”. Select it if it isn’t already selected.
All data from your Klimerko is visualized here:

Textual Value PM 10 Value
Excellent 0 - 20
Good 21 - 40
Acceptable 41 - 50
Polluted 51 - 100
Very Polluted 100 >

You’re done!
Enjoy your device and feel free to visit Klimerko.org and see your device along with all the other devices just like yours that are helping others be aware of the air pollution in your area!

Updating Firmware

This step is for those who've already built their Klimerko and wish to update its firmware to the latest version.

To check what Firmware version your Klimerko is on, you can:

If you are updating from a version before 2.0.0 to version 2.0.0 or above, you'll need to re-enter the credentials once you've updated your device.
This only applies to aforementioned cases due to changes in how data is stored in firmwares 2.0.0 and above.

Updating Wirelessly (OTA)

Use this method if your Klimerko is currently on firmware version 2.0.0 or above.

  • Download Klimerko_Firmware.bin
  • Connect your Klimerko to power.
  • Take off the 3D printed cover (if present).
  • Enter WiFi Configuration Mode by holding the "FLASH" button on the NodeMCU board for 2 seconds and then let go (Klimerko's LED should turn on and stay solid blue, indicating WiFi Configuration Mode is on).
  • Using your computer/smartphone, connect to WiFi Network "KLIMERKO-XXX" using password "ConfigMode"
  • Klimerko's WiFi Configuration Portal may automatically open outside of your browser once you connect to it - ignore it in this case.
  • Open the browser on your computer/smartphone and navigate to 192.168.4.1 to manually open WiFi Configuration Portal.
  • Click the UPDATE button.
  • Click Browse and select the "Klimerko_Firmware.bin" file you downloaded earlier.
  • Click the red UPDATE button and wait for it to confirm that the update is finished.
  • Your Klimerko will reboot.

Updating using Arduino IDE

Use this method if your Klimerko is on a firmware older than v2.0.0 or you're having issues with Over-The-Air updating.

  • Plug in the USB cable into your Klimerko and your computer
  • Download the latest Klimerko Firmware
  • Unzip the file, open it and go to “Klimerko_Firmware” folder
  • Open “Klimerko_Firmware.ino” with Arudino IDE
  • Make sure you're running at least Arduino IDE version 1.8.15
  • If on Windows, click Help > About Arduino to check version
  • If on MacOS, click Arduino > About Arduino to check version
  • In case you're on a version older than 1.8.15, simply download Arduino IDE again and install it.
  • If on Windows, choose “Windows installer, for Windows 7 and up” when downloading
  • Go to Tools > Board > Boards Manager
  • Search for “esp8266” by ESP8266 Community and click "Install" or "Update" if you already have it installed.
  • If for some reason you don't see the search result, make sure you've installed ESP8266 support
  • Now go to Tools > Board and choose “NodeMCU 1.0 (ESP-12E Module)
  • Go to Tools > Upload Speed and choose 115200
  • Go to Tools > Port and you should see COM and a number next to it. Choose it.
  • If you have multiple COM ports available and the one you've chosen doesn't work, try the other ones as well.
  • If you're running MacOS, choose /dev/cu.SLAB_USBtoUART or /dev/cu.usbserial-0001 (if you don't see it, install the driver first)
  • Go to Tools > Erase Flash > Only Sketch
  • Go to “Sketch” > “Upload” and wait for the firmware to be uploaded to your Klimerko device
  • Optional: Open Serial Monitor (Tools > Serial Monitor), set it to 115200 baud rate and check Klimerko diagnostic output to see if everything is working.

Awesome! Your Klimerko is now updated to the latest version!

Troubleshooting

Update to newest firmware

Before anything else, make sure you've updated your Klimerko to the newest Firmware by following the Updating Firmware section.

Use Serial Monitor

To see what's really going on under the hood, use the Serial Monitor tool provided in Arduino IDE:

If your device is showing unintelligible text in Serial Monitor:

Compilation issues

If you're having compiling issues (orange errors in the bottom of Arduino IDE), make sure that:

Klimerko can't see WiFi network

Can't connect to Klimerko to configure it

If you can't connect to your Klimerko when it's in WiFi Configuration Mode or you can't open WiFi Configuration Portal (192.168.4.1):

Klimerko isn't connecting to WiFi or AllThingsTalk

If your device won't connect to WiFi or AllThingsTalk (blue LED on NodeMCU constantly blinking slowly):

Assets not being updated

If your device is connected, but some assets are not being updated (or only "Interval", "WiFi Signal" and "Firmware Version" assets are being updated):

Klimerko won't turn on

Factory Reset your Klimerko