Pages

Sunday, September 9, 2012

UGP: Interfacing Geiger tubes to computers in a easy way

Universal Geiger Platform (UGP)

Sooner or later, any geiger user feels it's time to connect a Geiger tube to the computer to do some data logging. Some Geiger counters has computer interface, but most handheld or pocket Geigers does not have any way to connect them to a computer. Let's see how to accomplish this task:


In this proposed schematic, there are two distinct areas. The first area, at the capacitor left side, is present in almost any geiger counter. A high voltage is applied to the Geiger-Müller tube through two resistors: Rsense and Rload. Rload is the one proposed by the tube's manufacturer and limits the current through the tube, and Rsense produces a small  voltage drop every time the tube gets ionized from radiation. This small and quick voltage drop is the pulse we want to measure. Some designs with some tubes uses only one resistor to do the functions of Rload and Rsense. In both cases, we have a large negative voltage pulse available for us.

The second area, is the proposed interface between the Geiger-Müller tube and the computer. It is based on a 2-input NAND Schmitt trigger gate, one of the gates present in the 4093 CMOS integrated circuit. In its present configuration, it acts as a simple Schmitt trigger inverter, so the large high voltage pulse present at the tube's output is inverted and presented as a 5 volts positive CMOS-TTL level at the gate's output. There is a high value pull-up resistor (10Mohm) to set a logical one at gate's input when the tube is not active and two clamp diodes to keep input voltage at safe levels for the CMOS gate. Some people noticed me those clamp diodes are already built-in the 4093 circuit, so they can be omitted if you can ensure current flowing through them will be quite low. Anyway, 1N4148 (or similar) diodes are very cheap and make you feel good.

At the output of the gate, you have a positive pulse for each Geiger tube detection. It's amplitude will be determined by the gate supply voltage (from 3 up to 15 volts) and the pulse width will follow the original Geiger tube pulse: About 20 - 60 microseconds, depending on the tube. For data logging, all you need is to connect the gate output with the RXD line on your serial port.

The serial port as Geiger interface

To understand how a serial port can act as interface for a geiger counter, first you must to know how a serial port works. Serial ports send and receive bytes in asynchronous way, this is without a clock signal. To accomplish this, data are wrapped into a higher structure to be able to determine when the data starts, when the data ends, and sometimes, error check information. In serial ports data to be transmitted (mostly bytes) are preceded by a start bit, and followed by a stop bit. Sometimes a parity bit is transmitted between the data and the stop bit.

In the above image you can see how a serial port receives a character, exactly the letter K, which has the ascii code 75 (0x4B in hexadecimal, 01001011 in binary form). The first bit is the start bit. It is produced by the first transition from 1 to 0, and it is also the synchronization point to receive all remaining bits according to the actual bitrate. The next bits are the 8 data bits (LSB first) and the last one is the stop bit. The logic level for 1 is negative voltage and the logic level for 0 is positive voltage. There is a forbidden area, between -3 and +3 volts, where the bit is undefined, and the maximum voltage is +/- 15 volts. The idle status of the serial port is 1, which translates into the TXD / RXD pins as negative voltage.

Voltages between -3 and +3 volts (including zero) are undefined by the RS-232 standard, but real world RS-232 interfaces seems to work in a slightly different way: They interpret anything above +3 volts (from +3 up to +15 volts) as a logical zero, and voltages from +3 down to -15 volts as logical one. So, let's see what happened when we connect the output of the 4093 gate to the RXD line of our RS-232 port:




The first graph is the waveform at the HV line. The same waveform, appears at the 4093 gate input (red line). The gate acts as an inverter, so the second graph (green) is the output from the gate. The blue graph is the way the serial port interprets the pulse: The rising edge triggers the UART as a start bit. The remaining of the pulse is interpreted as zeroes, and the rest of the byte time is interpreted as ones. In the example shown above, the Geiger pulse appears as a 0xFC byte received by the serial port.

Universal Geiger Protocol (UGP)

In this way, we have created a stupid but effective protocol for Geiger counters. Just conform Geiger pulses to CMOS or TTL levels and apply them to the RXD line on your serial port. You will receive a byte for every Geiger pulse, so you only need to count how many bytes you receive in a period of time, and it will automatically translated to counts in the same period of time. Now you only need to pay attention to the speed used in the serial port.

A typical Geiger tube gives pulses around 20 to 80 microseconds long. You need to configure your serial port in a way your pulses fill some bits in the received byte. Let see the example in the blue graph above. If the serial port is configured at 57600 bauds, each bit lasts about 17 microseconds. The pulse is about 50 microsecond long, so the pulse is almost 3 bits long: The start bit plus two zero bits. Ideally you will want to have 5 to 7 zeroes in your bytes, but Geiger pulses are really fast, so usually you will always use the serial port at the maximum speed available: 57600 or 115200 bauds. As a rule, if your bytes have only a few zeros (or none) increase the serial speed. If your bytes are all zero (0x00), decrease the serial port speed.

Having each received byte 10 bits ( start bit + 8 data bits + stop bit ), working at 115200 bauds, and under favorable conditions, you will be able to catch a maximum of 11520 pulses / counts per second, or 691200 CPM. A very respectable value.

Universal Geiger Program (UGP)

With all this concepts in mind, I wrote a small program to log Geiger counter data. It's called UPG and it is quite simple to operate. When the program starts, you will see the configuration window:


 The options are:

COM port: This is the COM port used to logging data, or in other words, the COM port where the Geiger counter is connected.

Units: Here you can choose the units for the data. The options are: CPM (counts per minute), µR/h or µSv/h.
Average: If needed, you can average the received data over a period of time. Default is one minute.

Cal. factor: If you choose µR/h or µSv/h as units, you need to set the calibration factor. The calibration factor is the period of time in milliseconds where one count equals to 1 µR/h. This can be calculated in a very easy way:

Calibration factor in milliseconds = 1000000 / cps/mR/h sensitivity

For example: A SBM-20 Geiger tube has a sensitivity of 29 cps/mR/h for Ra226, 25 cps/mR/h for Cs137 and 22 cps/mR/h for Co60. Calibration factors will be 1000000 / 29 = 34000 milliseconds for Ra226, 1000000 / 25 = 40000 milliseconds for Cs137 and 1000000 / 22 = 45000 milliseconds for Co60.

Log data to: If this option is set, the program will write logged data to the selected file each log interval selected minutes.

When all the configuration is done, press the Start button to start the program. The program running look in this way:


If you press the arrow button, you will find a resettable statistics panel:


And if you minimize the program, it will stay silently on your task bar. You can check current value placing your mouse over the taskbar icon and restore it by double click:


Now let's see how looks the logged data file. It is a common comma separated value file intended to be used with common spreadsheets or any other software. It looks in this way if logging in CPM:

2012-03-14 13:56:12 ,     34.0 , CPM
2012-03-14 13:57
:12 ,     26.0 , CPM
2012-03-14 13:58
:12 ,     25.0 , CPM
2012-03-14 13:59
:12 ,     28.0 , CPM

Or in this way if you are logging in µR/h or µSv/h:

2012-03-14 14:01:42 ,     22.0 , CPM ,    0.147 , uSv/h
2012-03-14 14:02
:42 ,     26.0 , CPM ,    0.173 , uSv/h
2012-03-14 14:03
:42 ,     24.0 , CPM ,    0.160 , uSv/h
2012-03-14 14:05
:42 ,     15.0 , CPM ,    0.100 , uSv/h

Fields are obvious: Timestamp, in format YYY-MM-DD HH:MM:SS, value and unit. Here you can find an example of how data is plotted using OpenOffice Calc:


The program needs no installation. Just place it in any convenient location in your hard drive and execute it.

Download UGP 0.10 for Windows 32/64 bits: UGP.zip

If you have any ideas to improve UGP, please feel free to contact me.

7 comments:

  1. Hi there!

    I am going to make a geiger counter with this circuit http://madscientisthut.com/wordpress/daily-blog/geiger-counter-audio-circuit-board/attachment/geiger_board/#comment-10863
    and I also want to know if the "pulse out" pin that there is in this circuit will work with the serial port and your program. Can you also tell me which pins of the serial port do i use and how to connect it? :)
    Thank you in advance!

    ReplyDelete
  2. The pin used is TXD. That Geiger works only with 3 volts. Maybe can excite a RS-232 pin, but maybe not. I consider 5 volt the minimun safe value to excite modern RS232 interfaces.

    ReplyDelete
    Replies
    1. The obvious way to handle that is a level shifter,
      a 4050 buffer with its Vcc connected to +5v.

      Delete
  3. Hello,
    I am using a SI-33G (CI33G) Geiger Muller Tube, and I want to know the values for the Rsence and Rload. Can you please help me? I don't have any clue what to do.
    BTW the manufacturer does not say anything about Rload. Please help me ASAP! I have all the components except the two resistors. They should be in the Mohm range, should't they?
    Thanks!

    ReplyDelete
    Replies
    1. Rsense and Rload must be detailed in the tube datasheet. Yes, usually they are in the Mohm range. If you can't find anything you can try 2M2 as Rsense and 1M for Rload as a starting point.

      Good luck!

      Delete
    2. Thank you very much! I am going to try this! :)

      Delete
  4. Miguel, thanks for the nice and simple hardware interface and for the software.
    Now, if you would only port the program to Linux I'd be in heaven.

    ReplyDelete