Online Geiger counter hardware and software

2002

The Geiger counter

I bought an International Medcom, Inc Radalert Inspector Geiger counter. I chose this particular device because of its specs; Alpha, Beta and Gamma detection, counts per minute as well as µSv/h and TTL output jack. The device I have is no longer being made but has been replaced by the newer IMI Inspector Alert V2

Connecting it to a computer

The device was built to run on a 9V battery and did not have an external power input so I gave it one. It does have a 3.5 mm jack for TTL output. I wanted to hook this up to a computer running FreeBSD without having to use batteries and intended to use just a serial port to both power the geiger counter as well as read the count signal from it. Now a serial port does not offer 9V, but it does have 12V and 5V levels and the geiger counter also happily works on 7V ... Yes I use the 5V as ground ;-) I attached the TTL jack signal to the serial RX port in the hope that it would read 'something' and it does ! It reads a nonsense character of course as the Geiger counter does not truly speak serial but it was all I needed; power and a signal.

I wrote a small program to read the geiger ticks and store those with a high resolution timestamp of each event.
Here is the core of the radread.c program :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
    while(1) {
        retval=read(fd, &a, 1); /* block until +5V pulse is read */
        if (retval == 1) {
            gettimeofday(&tval, &tzone);
            ptm=gmtime((const time_t *)&tval.tv_sec);
            printf("%4d-%0.2d-%0.2d %0.2d:%0.2d %0.2d.%0.6ld\n",
                   ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday,
                   ptm->tm_hour, ptm->tm_min,
                   ptm->tm_sec, tval.tv_usec);
        } else {
            if (retval == 0) {
                fprintf(stderr, "end-of-file\n");
            } else {
                int *perr = __error();
                fprintf(stderr, "Error %d\n", *perr);
            }
        }
    }

This generates about 250 MiB of data per year.

Getting it all online

Another program reduces these timestamps to counts per minute and from there I translate to nano Sievert per hour (nSv/h) and graph those with rrdtool.

2010

A periodic generated HTML page serve the graphs to a web server.
The serial port sometimes gives up over my abuse, those are the blank periods in the graphs.

2015

I'm happy to report the year graphs are still very flat; nothing serious has blown up around here !

Upgrading to USB with Arduino

My replacement datalogging computer no longer has a serial port so it is time to upgrade the Geiger counters' computer link from above RS232 hack to USB. I intend to use an Arduino Nano to read the signal and upscale the USB 5V to 9V in a more sensible way; by use of an LM2577S voltage step up booster. First I tried an Arduino digital pin input to read the Geiger counter but got no signal there. Next I tried an Arduino analog input. This works but is not fast enough to see every signal. Finally I used a digital input pin with an interrupt to trigger on a Rising signal and this works beautifully. It catches every signal.

Here's a photo of this proof of concept work :

Radalert Geiger To Arduino Nano

The Geiger counter is on the left, the Arduino is the small blue electronics board with the green lit led, the LM2577S voltage step up booster is upside down, just below the Arduino. The voltmeter shows the voltage supplied to the Geiger counter. The Raspberry Pi above the voltmeter is unused here.

Here's the Arduino code^h^h^h^hSketch :

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
int led = 13;
volatile int state = LOW;

void setup()
{
  Serial.begin(9600);
  pinMode(led, OUTPUT);
  attachInterrupt(0, geiger, RISING);
}

void loop()
{
  if (state == HIGH) {
    state = LOW;
    digitalWrite(led, HIGH);
    Serial.println(1);
    delay(10);
    digitalWrite(led, LOW);
  }
  delay(1);
}

void geiger()
{
  state = HIGH;
}

I'll add high resolution timestamps with a support program that reads the serial-over-USB datastream.

-- Hans