Skip to content
Create a gist now

Instantly share code, notes, and snippets.

Sending measurements from a MighyOhm Geiger Counter to cosm, using a Raspberry Pi and its onboard serial interface.
import serial
from datetime import datetime
import eeml
import eeml.datastream
API_URL = 102285
ser = serial.Serial(port="/dev/ttyAMA0", baudrate=9600)
#sio = io.TextIOWrapper(io.BufferedRWPair(ser,ser))
cpm = []
usv = []
currentMinute =
while 1 < 2:
if not == currentMinute:
cpm_avg = round(sum(cpm)/float(len(cpm)),1)
usv_avg = round(sum(usv)/len(usv),3)
print currentMinute, ": CPM: ", cpm_avg, " uSv/h: ", usv_avg
cosm = eeml.datastream.Cosm(API_URL, API_KEY, use_https=False)
cosm.update([eeml.Data(0, cpm_avg), eeml.Data(1, usv_avg)])
print "Something unexpected happed. Let's forget about it and continue..."
cpm = []
usv = []
currentMinute =
line = ser.readline().split(", ")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.