mrgeiger.py -- Mr. Geiger Nick Parlante, 7/2012 Version 1.0 http://www-cs-faculty.stanford.edu/~nick/mrgeiger/ Mr. Geiger is a simple free program to process the output of the MightyOhm geiger counter. The idea is that you can use the geiger counter in a lab setting connected to a computer to record a series of measurements. The program makes it easy to record data series suitable for graphing or later processing. Command line flags: -i -- *required* Using the very common FTDI serial chip, the input filenames look like: /dev/ttyUSB0 on Linux /dev/cu.usbserial-XXXXXXXX on the Mac Something like "com1" or "com2" on Windows -o -- write to named output file -a -- auto output filename, e.g. 2012.04.01-23.14.12.csv (implies -o) -e -- echo the raw lines from the geiger counter -g N -- group into samples of N seconds Output will be CSV format: seconds, count, cpm, uSv/hr -t N -- timed exit after N seconds -u X -- specify X as cpm to uSv/hr conversion factor Use Ctrl-c to stop if not using -t N to exit. **Example 1** Group data by 20 seconds, ending at 120 seconds, write the csv data to afile.csv as well as stdout: mrgeiger.py -i /dev/cu.usbserial-A9007CPG -g 20 -t 120 -o afile.csv seconds, count, cpm, uSv/hr 20, 6, 18, 0.1026 40, 7, 21, 0.1197 60, 4, 12, 0.0684 80, 9, 27, 0.1539 100, 11, 33, 0.1881 120, 8, 24, 0.1368 total seconds:120 count:45 cpm:22.5 uSv/hr:0.12825 In group -g 20 mode as show here, the cpm and other computations just use the data in each 20 second group, not data from any other time. The summary printed at the end uses the data from the whole run. **Example 2** If -g group is not used, the output is left in the raw geiger format, e.g. CPS, 0, CPM, 23, uSv/hr, 0.13, SLOW and the summary stats are printed at the end of the run. Here just analyze 90 seconds of data using -t 90: mrgeiger.py -i /dev/cu.usbserial-A9007CPG -t 90 CPS, 0, CPM, 23, uSv/hr, 0.13, SLOW CPS, 1, CPM, 24, uSv/hr, 0.13, SLOW CPS, 0, CPM, 24, uSv/hr, 0.13, SLOW CPS, 0, CPM, 24, uSv/hr, 0.13, SLOW ...more lines like this... CPS, 1, CPM, 19, uSv/hr, 0.10, SLOW CPS, 0, CPM, 19, uSv/hr, 0.10, SLOW total seconds:90 count:26 cpm:17.3333 uSv/hr:0.0988 The raw data can be written to a file with: -o file.geiger mrgeiger.py -i /dev/cu.usbserial-A9007CPG -t 90 -o file.geiger A file like file.geiger can be used later with -i to process the raw data: mrgeiger.py -i file.geiger -g 30 In this way, your can grab the raw data first and play around with what -g options to process the data later. See the following for sample data and graphs, and how to connect and power Mighty Geiger from a cheap FTDI serial board. http://www-cs-faculty.stanford.edu/~nick/geiger/ If a text line from the device looks wrong, an error is written to stderr, and the line is skipped. On the Mac, the 2nd data line is frequently garbled for some reason, but everything else is fine. On Linux it seems to always work fine. Bugs: -The code does not set the baud etc. as that did not seem to be necessary on any computer I tested it on. I assume the FTDI chip is just happening to work in its default configuration, but I don't know if that's a reliable solution. -It only works when the geiger counter is in its "slow" once per second mode, which should work for low and medium levels of radiation. One could build a custom firmware for the Mighty Ohm Geiger, optimized for this pure data-collection application. It could just report only the raw count, say 10x per second, and let the higher level software do all the data manipulation.