DIY Arduino/microcontroller air quality device

Summary

Fine particulate matter in the air from cars and trucks, cooking, fires, and industry can give you cancer, heart attacks, and shorten your lifespan. Poor air quality can have a number of other bad effects. You can make a DIY air quality monitor (AQM) for about $20 that can warn you of poor air quality. You can add internet datalogging for another few bucks. This will give you a rough measurement of the air quality of your environment, and can help you determine if you should do anything about it (get an air filter, etc).

Background

Tiny particles in the air, generated from cars, trucks, powerplants, industry, and even cooking and burning fires at home, are causing cancer, heart attacks, and premature death among other ailments.

The risk of getting lung and brochus cancer stand at around 7% today, though around 80-90% of this is thought to be due to smoking.

Read more

New particulate sensors

New sensors for air particulate sensing

While ordering more Shinyei PPD42NS particle sensors off of aliexpress, I noticed a bunch of other particle sensors that I hadn’t seen before. It would appear measuring air quality is becoming more popular! I even found a full-on portable air quality monitor, but it appears it’s not wifi-connected, and apparantly has no documentation (common for Chinese goods). It’s by a company called Plantower out of China.

plantower.png

There’s also this, which I think is by Plantower too, the SDS011, the SM-PWM-01 (which is another ripoff of the Shinyei PPD42NS), the INSAN CP-15-A3 all in Chinese, and the PMS3003.

Of course there’s the Shinyei PPD42NS and it’s first ripoff, the Samyoung DSM501A, which have been out for a while.

Read more

Calibratin' air quality monitors

Calibrating air quality sensors

I’ve been working with the Shiyei PPD42NS sensor, and the cheaper (by %50) Samyoung DSM501A. My goal is to have a portable sensor that will keep track of the particulate matter you are breathing, and warn you if you hit dangerous levels.

The first step is making sure the sensors are accurate enough for this purpose. I bought a Dylos DC1100 Pro air quality monitor, which uses a laser and a fan to measure particles in the air. It puts out a number that is number of 1-micron or larger particles per 0.01 ft3 (and a number for 5-micron or larger).

Procedure

calib-setup.jpg

Read more

Python machine vision

Python machine vision LCD OCR WTF

I just finished getting a camera through a usb adapter visible in python, and now I’m getting the machine vision set up. I found someone who already did all the hard stuff. I used this LCD numbers image since it had the same font as the display on the Dylos air quality monitor. I had to adjust the perspective to make it flat for the machine vision training though, so I used gimp to do that. Then I realized there was a 0 with a line under it, so I replaced that with another 0 from lines below. After that, I started training the program, but it was seeing 4s and 1s. I had to change the threshhold for detection from

thresh = cv2.adaptiveThreshold(blur,255,1,1,11,2)

to this

thresh = cv2.adaptiveThreshold(blur,255,0,1,25,-2)

The docs describe this function a bit, although I can’t get the cv2.CV_ADAPTIVE_THRESH_MEAN_C to print, so I’m not entirely sure which adaptive_method I’m using (I think I changed it from gaussian, 1, to linear, 0). I empirically found the higher block size and lower constant seem to work best for this image. After that, it works well.

Read more

Camera and easyCAP usb

Camera troubles

I’m setting up a calibration platform for particle sensors, and I need a camera to capture the data from the Dylos sensor, because it only outputs data over serial once per minute, and I need once per second. So I need to capture an image of the number output on the display, process it and extract the data. Unfortunately, I don’t have any webcams lying around the house, and I’m not about to go spend $20 for one when I have another camera here. It’s a small camera, probably the same as in your laptop and webcams. (I was going to use it as a remote security webcam, but then I found out it’s much harder to interface a camera with a microcontroller than I thought.) So I hooked it up to an easyCAP I have with a patch cable, and tried to interface it with Python on a Windows laptop, which became very difficult. Eventually, I was able to get it working with this tip. The steps I had to take to get it working were:

The cd that came with easyCAP is here if anyone needs it.

With linux, this is easier because you can call mplayer with subprocess.

Read more