my github

R graphing

Jabs Geothermal

A basic CO2 stream

Live streaming data is something that sounds great to most scientists. For us environmental scientists, the prospect of live data eliminating the tedious “sneaker-netting” of data (that is manually plugging-in to offload records), is a sort of nirvana – a technological paradise where data magically appears when and where you want it. Of course, these systems have existed for years, but they are clunky, and more importantly costly! As technological know-how increases, the day grows ever closer when a button-click (or screen-tap) will offer immediate information about our surroundings. This is the central idea behind the “Internet of Things (IOT)” movement, and its potential for environmental science and educationhas not gone un-noticed.

Our lab has a slick piece of equipment that measures CO2 gas. Its called a Li-Cor 820, and its great for high-accuracy measurements, but it doesn't connect to the internet very easily. I was tasked with the simple premise of making a public keeling curve for our lab, basically to put CO2 data from the Li-Cor onto the internet.


After much research I settled on using, mostly because I'm shallow and they make pretty graphs, but also because of a nifty streaming python-api. I'm programming mostly in python these days, so not having to mess with node servers or mysql/php was an upshot, and they have great documentation.

I came up with the python script below:

which takes the xml stream that comes into the computer (via serial.readline()), and adds those values, along with a time-stamp, to a stream of data that goes directly to plotly's servers, and makes a nice looking graph! Check out the code for yourself, and let me know if you have questions.

Live CO2 from MSU-Bozeman