Serial processing code? Patchube?

Support forum for the mightyohm.com Geiger Counter.
http://mightyohm.com/geiger
Post Reply
peterloron
Posts: 12
Joined: Thu Dec 23, 2010 12:56 pm

Serial processing code? Patchube?

Post by peterloron »

Hi. Unless you know of some existing code for processing the serial messages, I'm going to be writing a script to take the serial output and pump the data into Patchube. I'll also probably modularize it to write out to CSV or MySQL or somesuch.

I'm going to be deploying this GC kit as a permanent environment monitor, and want to log the data...

Any thoughts / desires?

Thanks.

-Pete
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: Serial processing code? Patchube?

Post by mightyohm »

Yes, please do!

What data format does Pachube want? This has been on my list of "stuff to figure out" but I since releasing the kit I haven't had time. If there is anything I can do in the firmware to make it easier to interface the kit with Pachube then I'm all for including it in the next rev.
peterloron
Posts: 12
Joined: Thu Dec 23, 2010 12:56 pm

Re: Serial processing code? Patchube?

Post by peterloron »

It's a pretty simple XML format. Here's the API quickstart:

http://api.pachube.com/quickstart/

I'm hoping to take a stab at this next week, but I may wind up buried like this week...

As far as changing the firmware, I don't know of anything specific to change. The various modes (slow, fast, etc) will complicate things, but it's not insurmountable. You already have the values delimited in the output so it shouldn't be a problem to reliably parse them from the serial stream.

-Pete
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: Serial processing code? Patchube?

Post by mightyohm »

I tried to make the serial data easy to parse, but I didn't know who or what would be parsing it, so I had to take a guess. Let me know if there is anything i could have done better.
peterloron
Posts: 12
Joined: Thu Dec 23, 2010 12:56 pm

Re: Serial processing code? Patchube?

Post by peterloron »

Nothing for now. :-)

I've got a simple class written that pulls the data from the serial port and logs it to a CSV file. The next bit that is still being worked on is to take that second by second data and roll it up for pushing to Pachube on a longer interval...every 5 minutes or whatever. I just haven't had time to finish it off.

I'll post the code up to github once it is working and has enough documentation for others to make use of it.
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: Serial processing code? Patchube?

Post by mightyohm »

Yes, the interval is important. I think the NetRAD shield by Freaklabs posts data about once a minute.

Are you writing python or ?? What operating system?

Very excited to see your code. :D
peterloron
Posts: 12
Joined: Thu Dec 23, 2010 12:56 pm

Re: Serial processing code? Patchube?

Post by peterloron »

Yes, it's Python. I'm writing it on OS X, but will test it on Ubuntu and Windows 7 as well. Should be no problem to use it across operating systems.
peterloron
Posts: 12
Joined: Thu Dec 23, 2010 12:56 pm

Re: Serial processing code? Patchube?

Post by peterloron »

Ok, I had a bit of time last night and got a basic lashup working. You can see the data on Pachube here: https://pachube.com/feeds/29101

The code still needs some work to be suitable for public viewing. :-)
User avatar
mightyohm
Site Admin
Posts: 1064
Joined: Fri Apr 03, 2009 10:29 pm
Location: Seattle, WA
Contact:

Re: Serial processing code? Patchube?

Post by mightyohm »

Awesome! 8-)
Post Reply