# Meter Stick REVA: Lights, Buzzers, Particulate Matter ... oh, my!

by donblair | | 2,527 views | 11 comments |

donblair was awarded the Basic Barnstar by cfastie for their work in this research note.

### What I want to do

There'd been a discussion recently (see the comment thread here) about interfacing with inexpensive particulate matter sensors. The particular sensors under discussion -- the Sinyei and Syhitech -- operate at 5V; and the most basic and inexpensive way to get data from such a device, suggested by Jeff, might be: connect the particle sensor to a laptop via a microcontroller, and get data off USB.

Jeff pointed to the wonderful DigiSpark project as a possibility. This inexpensive, Arduino IDE-compatible device looks like it might handle the job -- it has several digital pins available, and operates at the required 5V.

However, some initial review of the situation leads me to think that there some drawbacks to the DigiSpark for this sort of application:

These issues with the serial port aren't a serious problem if you're simply looking to program the device to e.g. blink an LED, or make a motor turn -- perfect applications for the super-cheap DigiSpark; but if you want to have a stable data transfer to your laptop, or debug measurements coming from an external device, these issues might make for quite a headache.

This made me think: what might be a nice, minimalist Arduino-compatible design that would allow for connecting to one of these particulate matter sensors? In addition to finding a more stable serial connection (so that we can get data into a laptop), I was also interested to see how we could make the readings from the device 'legible' in a minimalist way -- using light and sound to indicate particle levels.

### My attempt and results

Here's my first shot at a design:

Schematics and board design files, in Eagle, are available in the github repo here.

• It is an Atmega 32u4 chip (the same as the Leonardo and the Flora), running at 5V and 8 Mhz.
• It has 5, individually-addressed RGB LEDs, to indicate particulate levels, either through color, through lighting them up in sequence (levels "1" through "5"), flashing, or what-have-you.
• It has a piezo buzzer (optional geiger counter effect, that registers individual particle counts?)
• In order to save space and cost, I've arranged the board so that one can use some lengths of standard hook-up wire, soldered to "5V / GND / D6 / D8", solder one end on the pinouts on the side of the board, and then run the individual wires under the board and up through some holes drilled on the opposite side of the board -- allowing for mechanical stability without needing to use (relatively expensive, and space-hogging) screw terminals.
• I've also arranged the pinout so that it should be straightforward to add a thermistor. I'm not sure yet if this is useful for particulate measurements, but as there's a heating element in the S----- sensor, I figure it can't hurt to stick a $3 thermistor in there, in case it'd be a good idea to calibrate (and perhaps control for, by powering the device on or off -- which would required an additional mosfet, which I can add to REVB) temperature. • It uses a "PCB USB form factor", in which metallic pads on the printed circuit board itself can serve as a USB connector, in order to save slightly on cost. My experience is that this isn't always a very stable connection to a USB port, though, so I've also put a footprint for a standard Micro USB connector. ### Questions and next steps • Maybe I should switch up to 16 Mhz? • Should I add a mosfet in here anyway, on a digital line, just in case we want to control the temperature element on e.g. the Shinyei sensor? • I need to tally up the cost of putting this device together. The 32u4 has recently come down in price, comparable to a 328P (the UNO chip); I tried to use the minimal set of components to make the device operate, while still being safe in case of e.g. plugging it in upside-down to a laptop USB port (I'm keeping diodes and a fuse on the device). Still -- could it be a bit more minimalist? ### Why I'm interested It'd be nice to have a cheap little device that can measure a few analog and digital inputs, take that in via a serial connection, and give some nice visual and audio indications of what it's measuring. Thus the "meter stick" appellation. ### 11 Comments It seems like there are a lot of people who are worried about living in a dusty environment, but most of us already know whether it's dusty where we live. So making something blink or buzz when there is dust may not be as important as collecting time series data about how dusty it is. Those data can be used to demonstrate to others how dusty it is so that maybe something will be done about it. A device that collects a few weeks worth of dustiness data could be valuable. If it's cheap enough so that replication can be done and distance from source can be described with a transect or array of many devices, it becomes more powerful. The ability to add other sensors might allow correlating dust events with dust forming events, for example crude audio data could record when trucks went past on dusty roads. Other sensors will be more effective in other situations. But other sensors can be deployed independently, they don't have to be on the dust device. It might be most important to make a recording dust sensor as cheaply as possible so more people can have more of them. Reply to this comment... Ah, great points. It's true that having immediate, "here's how many particles your device registered in the last 30 seconds" data might not be so useful. I was sort of imagining that there could be some time-averaging on the device, so that if the particulate matter level has been "high" in the few hours, the line of LEDs would be fully red, or blinking, or what-have-you ... but right, maybe one was already coughing, and new that there was a lot of dust in the air ... or could simply run one's finger across a table-top ... Spot-on re: the ability to record data over time. This "Meter Stick" design is intended to exploit an already-extant laptop, or old desktop, that's always-on in the home. Data can be gathered and pushed online from a dust sensor (or other sensors) via this "Meter Stick", which is intended to be as minimalist as possible (no onboard storage) -- simply a conduit from the sensor to the laptop. But dedicating a laptop or a desktop to this application might prove onerous for some; and if one doesn't already have a laptop or desktop to spare, it's quite an expensive approach. For those cases, I'm about to post a revised version of the OpenLux -- which has both on-board flash memory (cheap, easy, but only 128 Kb), and a microSD card. I'm trying to design it so that the precise configuration is modular -- optional display, optional microSD, etc -- in order to address several use-cases as inexpensively as possible. Let me see if I can this new design up quickly -- can't wait to get feedback on it ... Reply to this comment... The OpenLux will be able to solve lots of problems, but I only have one problem -- I live in a rural neighborhood on a dusty road and local officials don't think they should be concerned. We could use a recording dust sensor, but it has to be cheap enough that we can put them in arrays at several impacted properties and also at control properties along paved roads (these will be where the Select Board members live). Let me know when the price gets below$15.

Hah! -- $15! Sigh ...$5 would be even better, no? And it should have wifi too, right? :) The basic version of an OpenLux + dust sensor with recording capabilities could probably come out around $40 or$50, depending on how cheaply the dust sensor can be secured. An Arduino UNO, without any ability to record or display, goes for around $25. So:$50 would be a big improvement on $5000 or$1500, for commercial particulate matter sensors; but then, $50 will probably not be a particularly sensitive device, either ... hmmm. I guess it depends on who the "we" is in "we can put them in arrays". If it's an individual citizen scientist, paying out-of-pocket, then$50, for a device that will require tinkering, is probably too much for all but a few well-off geeks out there (though that 'few' might be sufficient for a successful Kickstarter, say). If, however, we're providing an alternative device for agencies, universities, or non-profits who are currently fielding $1500 or$5000 devices to get basic dust measurements, then maybe $50 is 'doable'. That's all to say -- I'm seeing in all of this that I should be careful when employing the phrase 'low cost', full-stop. Maybe "affordable for application X in community Y" is a better formulation ... Is this a question? Click here to post it to the Questions page. Reply to this comment... Chris-- your problem isn't unique. according to the EPA, dirt roads account for something like 1/6 of all the dust in the US.. Reply to this comment... Mathew, That's a lot of people who need hard evidence that it's dusty. I guess we'll just wait until Don can get the price down. Reply to this comment... That's why I'm thinking collecting dust on tape, scanning it, and using an algorithm to calculate particle size and maybe type would be a good idea. Not exactly real time, but as you said, people don't need to be told when its dusty-- they need to prove it was to the right people. Reply to this comment... I'm loving this whole comment thread almost as much as I'm enjoying Don's hyperactive circuit board authorship... amazing! However, given that the digispark sold for$9, if we keep things really minimal and the Scihitech dust sensor can be bought for <$5 in quantity, and we rely on a laptop and a long USB cable so you can hang it out your window while still plugged into your home computer, isn't <$20 a reasonable target for cost?

Is this a question? Click here to post it to the Questions page.

Yep, I think so. The Digispark is only $9, I think, because it uses the ATTiny processor, which is super cheap, and uses a really tiny board. It has really minimal memory for programming -- something like 6 Kb. I'm not sure that'd be enough for the sort of sampling logic we'd want to run for the run on the Syhitech -- but it might. The larger worry for me about the Digispark is whether the serial connection would persist long enough that it'd function as a long-term data conduit. But given that it's a <$20 experiment to try it out, we should give it a shot!

But, right -- the cost of parts for something that simply measures e.g. the Syhitech output, and delivers it to a computer, while having as much memory as an UNO, and a 'real' USB connection, could be something like $7. (For example: the same hardware we're using in the Riffle can do full USB, and the same hardware, in a relevant configuration, has been priced out on http:///mchck.org for$7 in parts.) This Meter-Stick idea is intended to make something that's directly compatible with the Arduino IDE, and is as flexible and capable as an UNO or Leonardo (which might be overkill)> I'd have to do the math for this Meter-Stick prototype, but it also might be in the same ballpark. Looks like one can get the 32u4 for about $4 if one purchases 100 at a time; and the cost of the Meter-Stick PCB was about$10 for 3 on OSHPark. The rest of the parts are cheap enough that the entire Meter-Stick could probably be put together for $10 in parts; probably a little less, if we optimized board space (and thus PCB cost), component prices, and etc. And adding in the ~$5 Syhitech, and that's something like $15-$20 for the cost of parts.

Is this a question? Click here to post it to the Questions page.