Let's Raise some Dust.

A couple of weeks ago, I found an article about dust sensors. As ‘dust’ is always an issue in modern world, I decided to read it and, surprisingly, it was highly interesting.

This was the first time I got in touch with PM2.5 and PM10 particles. To be honest, I had heard about those particles before, but this was the first time I realized the importancy of these measures. Soon later, I started to look for sensors to measure this invisible, but highly health influencing particles and noticed a wide price range.

They range from about 4.5$ delivered with a tolerance of +/- 40 percent (so more likely just dust-detectors than sensors) and up to freaking thousands of dollars. Personally, I decided to buy a 40 dollar one with a tolerance of +/- 15 percent and a range of 0 – 999 µg/m^3. This seems to be a good choice for getting a reasonable impression about the air quality. Furthermore, this sensor was handy because of its standardized RS232 interface and build-in sleep mode.

SDS011 Sensor

The major issue with these sensors is the optical measuring method and, as a result, dust that over the time pollutes the sensors from inside. The manufacturer guarantees a lifetime up to 8000 hours which is less than a year in 24/7 usage. That’s the reason why I appreciate this integrated sleep mode that is activated between measurements.

To be precise, it turned out to be best to capture one measure point each 15 minutes. This sounds like a lot but gives you the opportunity to average out some points when smoking pedestrians go by.
Before the measurement is taken, active mode is activated for 30 seconds to allow the fan to suck in new fresh air and stabilize the result. Then sleep-mode is activated again.

Seems straight forward, right? But this is just the naked sensor, no active partner to store the results and, most importantly, no power source as it’s most effective to measure dust outdoors. Next, I had a look at the device to store and upload data. At first glance a raspberry pi seems well placed, but they are expensive, especially those having an on-board WIFI chipset and raspberry-zeros on the other hand are hardly available here in Austria. Then I considered to take an ESP28xx which is a microcontroller module with an on-board WIFI chipset. It’s extremely cheap but also low-level programming and hard to maintain later on. So it had to be a Linux based system. Realizing that I had one Orange-Pi-Zero laying around this seemed to be best suited for this purpose.

It’s basically pretty similar to the raspberry apart from running Armbian instead of Raspbian and the way cheaper price of about 15$ delivered without micro-SD card. The sensor includes a USB to RS232 adapter and the Orange-Pi provides one USB2.0 interface – neat! No further programming for the GPIO’s was required and it was time to hook ever up.

Writing a class in python to send commands, receiving data and decoding the bytes was quickly done and tested. Additionally, I coded a simple php-file to insert data in a mySQL database that is located in my website’s webspace and thus can be accessed worldwide, as I don’t own a static IP address for my home internet connection.

It works! Nearly. There is still the issue with the power supply and potential rain on my balcony.

But first things first. To be on the save side I decided not to use batteries. It’s just annoying to frequently replace (or charge in case of rechargeable ones) the batteries. Which means I have some wires through my window anyways and it actually doesn’t matter if there are 4 wires or just 2 wires. To overcome any issues due to high temperature and humidity changes I placed the Orange Pi indoors and just the sensor outdoors.

Now to the more hacky part. I’m currently living in a rental flat and not allowed to drill any holes through the wall. So, I had to use one of those flat cables that can be placed between window and frame before closing and can withstand the closing without affecting it. After hours of searching I found some but they cost a fortune compared to its usage. Unfortunately, ordinary PCB-cables can’t be used as they are likely to break after a while. Luckily, I had some flat-flex cables from disassembled printers laying around. On each side of this cable I soldered appropriate connectors. Of course, I made the connection on the RS232 side and NOT on the USB side! I won’t get in trouble using non-shielded connections on a high-frequency bus system. RS232 with 9600 baud is pretty save and robust.

The final cable ended up to be pretty hacky, but better than spending a lot of money on a professional cable which, regarding my purpose is no better.

While surfing the net for dust sensors I found a nice and cheap way to protect the sensor against water. I bought two pieces of 90-degree angle sewage pipe with the right diameter to fit the sensor snugly inside and put them together in a U-shape with opening down to the floor. This makes it impossible for rain coming in and leaves the sides open to suck in fresh air. To make sure the sensor is reading correct values an additional thinner flexible tube is added to the air-inlet witch directly connects the opening to the sensor.

Perfect! Now we need a way to access the captured measurements. Maybe an app, or a display …. or a Smartclock that also shows time and news. Stay tuned for the next project!

Dust on a typical workday in Graz.

Appendix: The used particle sensor doesn’t provide any air drying at the inlet. High humidity or condensation might affect the measurements. Further information will be provided after some weeks of operations.