Wi-Fi Geiger counter

From openPicus Wiki
Jump to: navigation, search


The nuclear catastrope in Fukushima (and of course Chernobyl, Harrisburgh and so on) made it clear that using radioactive materials for generating energy can and probably will end in a horrible disaster. Very soon after the first reactor in Fukushima exploded, geigercounters were sold out eveywhere and prices soared to almost ridiculous levels. Although I do not live in or near Japan, I too wanted to have a geiger counter to monitor radioactivity myself, being prepared in the case some nuclear accident should happen in my part of the world (central Europe). So I started researching for suitable DIY circuits on the net, testing a few of them and as none of them would fit my requirements, I designed my own circuits.

Building a basic counter that clicks is pretty easy, but such circuits will never give you detailed and reliable information on whats really going on. So the next step is to add a microcontroller and a display that would allow to calculate numerical values, but this would require you to record the measurements by yourself to have an overview of the long-term development of radiation. So the next logical step was to build a radiation logger device, that would record many thousands of measurements and display them on a computer screen. Here's is my creation: expansion board for Flyport module with Geiger counter. There's also a specific website for the project http://www.radiation-logger.net


A few months ago I created a very basic geiger counter application for the Flyport, it just displayed the Counts per Minute in simple text format. This worked nicely, but with a microcontroller and a wireless Lan you can of course do much more interesting things. The next step was a version of the program that would display one day of logged data with a simple HTML Bar graphic. This was a great improvement, since you could see very well the changes from minute to minute, especially when examining various materials for natural radiation.

The next step back then was to include more storage space for long term observation of the background radiation.
The AT45DB041 Dataflash has 4MBit (about 512kB) of storage capacity and I had several of these laying around. I ported a SPI Library for the Dataflash I had already written for Atmel Controllers, and voila, the Flyport could talk to the Dataflash memory. Once the storage issue was solved, I wrote some HTML / Javascript pages to display the logged data and added some extra fancy routines for Alert Emails and stuff like that, and so here it is, the Geiger Counter Logger Project for the OpenPicus Flyport.
A complete Solution for measuring and logging radiation, with a 128 Day / 1440 Minutes per Day logging Capacity, Graphic Data Display, different alert sources, Min / Max detection, Dosimeter, and Realtime Bargraph. If this is not enough, the Firmware allows you to write your own Javascript plugins and integrate them into the Flyport Web Pages WITHOUT having to reprogram the Module. You could write own modules for Excel Export or statistical analytices or whatever you want! See section "Edit Custom Scripts" for details.
By the way this software could easily be changed to serve in other data logging applications like a solar radiation logger or a temperature data logger. For every minute, simply two bytes of data are logged, so by just substituting the counter-value by an AD-Converter Value or something you could do alot of interesting things!

How it works

The Software id divided into two parts. One part is the firmware for the Flyport, which is written in C. It does the actual counting task and manages the dataflash storage, alarms and things like that. It also provides a interface for querying the realtime and logged data, by means of XML-like pseudo-files.
The User Interface is a typical HTML page with lots of javascript to generate the Graphics and display all values in a convenient way. Unlike a traditioinal Webserver, the Flyport does not have lots of Megabytes and Gigahertz of processing power to prepare all of the data on the Server, like a classical PHP / Apache Combination, so a lot of Work is done by the Client to achieve optimum performance. Most of the work is done by an infinite main loop within the "Taskflyport" function.
This loop permanently polls several flags and executes subroutines as needed. The flags are controlled by the HTTP Task that handles the delivery of data to the client / user interface.

The actual counting of impulses is done by using the integrated Timer2/4 provided by the PIC24F256 Microcontroller. The PIC24F256 is a 16 Bit microcontroller, but the two timers can be configured as one 32Bit timer. The main loop queries the counter every second (alarmflag provided by the Flyport RTC). This value is available as the Cps Value (counts per second) for the realtime Monitor.
The Cps values are accumulated and every minute a new Cpm (Counts per minute) value is being calculated. This value is stored to the dataflash memory, if the logging system is enabled.
In addition to this, the last 60 Cpm readings are held in a RAM memory buffer and can be read as the "Hour History", shown as the little graphic on the start screen.
Besides this basic functionality, the dosimeter values are accumulated, Min/Max Values detected and alarm levels are monitored.


Source code

To get the source code and contribute please contact the author

Personal tools