Public Lab Research note

EPA's Advanced Monitoring Tech Demo Day

by donblair | August 14, 2014 23:38 14 Aug 23:38 | #11054 | #11054

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

@mathew and I had a great trip EPA's Advanced Monitoring Tech Demo Day on August 5th at the EPA's headquarters in DC. Catherine Tunis and others at the EPA organized a wonderful event -- we met a ton of folks who were really interested in Public Lab's approach to environmental monitoring, and it has led to lots of great conversations!

I'll be posting more details here soon, but just wanted to put a quick link to the poster we put together for the event, which turned out nicely:

Here's a snapshot of the poster as it was set up next to our table:


-- thanks to Jennifer Wills, who posted the photo on Twitter! We totally forgot to take any pictures of our demo setup -- we were so busy talking to people! It was a really neat demo, though -- trust us. Buzzers and water and salt and Riffles and all that jazz. More description soon.

Big thanks to @kanarinka, @lilybui, and @walkerjeffd for helpful feedback on the poster; to @walkerjeffd for all of the data analysis ... and to Katie Booras, who arranged for the entire City of Cambridge Water Dept deployment around which the poster is based!


Hey Don - I hadn't seen this for a while and it looks awesome! We are just bringing our analysis system online at PhotosynQ which might be able to help you with the display and data storage end. Contributing to the database is pretty straightforward, I'd be curious to see how much effort it'd take to get the riffle to connect to our backend.

Here's an example of a recent project where we took some data points around a bean field performing variety trials. We were measuring stuff with our device the MultispeQ, but any device that sends the right kind of data to the right server will show up. If this is useful let's see if we can connect!


Reply to this comment...

Hey, Greg -- thanks for the feedback. And the data platform you're developing looks great! It'd be great to learn more about it ... is it on e.g. github / described somewhere?

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

Reply to this comment...

... and congrats on all the amazing progress with the MultispeQ!!

Reply to this comment...

Thanks! Yeah we've kept the data site hidden for a while because we're going to move it to the main site pretty soon. But you can find the current version at Here's an example of the data explorer function: (not sure, but you may need to create a login to view). We have about 3 active projects, the largest has about 3400 data points. We're making improvements to speed right now, so we hope to be able to comfortably do 10 - 20k data points (with wait times for download of course, but point is it shouldn't crash your browser :). You can plot any of the fields against each other, do histogram, averages, etc. And you can filter (right hand side) the data to create separate series. I don't know if you get a full sense of what it can do from this, but you'll get the idea. Pushing data to the database is just a JSON with a specific structure, not too hard.

All the code is on github on the PhotosynQ page. We have a company doing the database and android app, so their stuff is private until they are comfortable with the quality then it'll be open - if you want to see it beforehand I'm sure I can share it just let me know.


Reply to this comment...

Hi Greg!

Just revisiting this here (rather than on Twitter -- 140 char would almost be over right now :)).

The platform looks fantastic. Re: getting Riffle data into it, the Riffle's current hardware + software repository is here:

There you can find the Eagle files for ordering a PCB, and some starter Arduino code for recording values. It's built so that it appears exactly as an Arduino UNO in the Arduino IDE, so there's nothing particularly special about the code. It's recording timestamped sensor readings as a CSV file to a microSD card, and one can choose to format that file however one likes -- it could, e.g., be JSON instead of CSV. So I think getting data into the PhotosynQ platform should be pretty straightforward?

It looks like there will be an 'alpha' version of the Riffle (the main board, plus the conductivity + temp + light sensor add-on module) for around $150 available pretty soon (in the next weeks, I think). I'll be pinging the lists with updates as I know more.

Cheers! D

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

Reply to this comment...

Awesome! I think given our workload, ordering one may be easier... I'll just wait till I hear more on that front.

Do you have a device yourself at the moment? If I did some work on the firmware and sent it to you, could you test it out for me? I'd be coding blind, but I think converting outputs to JSON is pretty straightforward. Could I even just test the code on an arduino uno - shouldn't matter that the readings are nonsense right, just matters that it compiles and ships data correctly. Then I could try it out here and make sure it works.

As an initial proof of concept, I just connected YwRobot's moisture sensor succesfully and did some quick soil moisture comparisons - worked great! Here's the results with 4 samples and 3 moisture levels (highest peaks are high moisture, lower peaks are lower moisture), hope to post more soon. Here's an image of the setup, and what it looks like in the software:



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

Reply to this comment...

Hey Don, quick question, I was trying to compile the riffle code on a naked Arduino Uno (nothing attached), and downloaded the libraries and such, however I can't see that the RTC_DS3231 class has the function 'begin' in it (line 100). Am I missing a library or messing something else up?


Once I get it to compile, I think as you said it should be fairly straightforward to adjust the output.


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

Reply to this comment...

Hey Greg,

Wow, this is amazing! Super cool to see you forging ahead with this. My impression is that what's going on here is that the basic utility of the 'riffle' is to do with the RTC + the microSD -- that is, a design that's intended to be an easy-to-use, low-power datalogger. And then we're adding additional sensors to turn it into a water quality datalogger, an air quality datalogger, a plant health datalogger, etc ... is that how you're thinking about it? Cool things to think about!

Anyhoo, I'm wondering if the problem you're running into is resulting simply from my poor documentation :) I haven't consolidated everything I should, but as a first shot: if you look at the 'Required Libraries' section here:

are you using the same libraries? Maybe that's the issue? Lemme know ...

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

Reply to this comment...

I used micro SD when I started out also, but for our applications it just was too slow. However, we aren't trying to take lots of measurements over a long time, everything we do so far is handheld and cell-phone attached, so SD makes way more sense for you.

So I was thinking for proof of concept to just get the riffle to ouput via serial USB or bluetooth to a computer and/or cell phone. From there we can use the PhotosynQ backend which is my goal, even though we admittedly lose the long life / low power piece. At least it would give us a chance to play with a different kind of data and see how it looks.

I believe I have everything which is included at the top of the .ino file (except stdlib is already installed of course):

include <JeeLib.h> include <Wire.h> include <SPI.h> include <SD.h> include <RTClib.h> include <RTC_DS3231.h> include<stdlib.h>

In addition I got the DHT-sensor-library which isn't referenced in the .ino but is in the riffle-ito-apps github page.

Here's what I get - seems like the RTC_DS3231 library isn't right, it's missing classes and redefining stuff...

In file included from riffle_testing.ino:6: /home/photosynq/arduino-1.0.5/libraries/RTC_DS3231/RTC_DS3231.h:88: error: redefinition of ‘class DateTime’ /home/photosynq/arduino-1.0.5/libraries/RTClib/RTClib.h:10: error: previous definition of ‘class DateTime’ riffle_testing.ino: In function ‘void setup()’: riffle_testing💯 error: ‘class RTC_DS3231’ has no member named ‘begin’ riffle_testing:102: error: ‘class RTC_DS3231’ has no member named ‘isrunning’ riffle_testing:107: error: ‘class RTC_DS3231’ has no member named ‘adjust’ riffle_testing:115: error: ‘class RTC_DS3231’ has no member named ‘adjust’ riffle_testing.ino: In function ‘void loop()’: riffle_testing:194: error: ‘class RTC_DS3231’ has no member named ‘getTempAsFloat’

Hey, are you going to the Nov 14th barnstorming? We were thinking about coming, and I'd love to see a riffle in action!

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

Reply to this comment...

Hey Greg -- neat ideas!

Re: compiling errors -- just to make double-sure: are you using the version of the RTC library linked to here: ? We're using a particular fork of the RTC library, so maybe that's the issue?

I can't think of a good reason for the library not compiling on an UNO, unless we're running into some odd issue regarding Arduino IDE versions or something; I'm away from my main computer, but I'll let you know what version worked for me as soon as I can get to it, and make sure that I've described the proper libraries to use :)

Meanwhile, since the UNO doesn't have the requisite hardware for running the real time clock anyhow, you could simply drop all references to the RTC library in order to play with data formats. As you say, what you're doing right now doesn't seem to require having the microcontroller sleep (you're plugged into USB, yeah?); maybe a simple first pass would simply be using e.g. the millis() command to get the elapsed time, and using that in lieu of a timestamp?

For further debugging convo, it might be good to switch over to the associated github repo, here:

(I created an issue by copy-pasting your text)

Hope to be able to send you an actual Riffle device soon!

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

Reply to this comment...

Oh and -- yes, I'll be going to the barnraising -- excited to meet up there!

Reply to this comment...

Login to comment.