Gamma spectrometer Experiment #1

Motivation

A friend gave me some photo multiplier tubes. The R1166 tubes from Hamamatsu were out of some medical equipment and also came with some scintillator crystals. Since these two things are essentially the business  end of a gamma spectrometer I thought I would have a go at this:

RMT11 and scintillator (Scintillator type and origin unknow)

A scintillator converts radiation into tiny flashes of light with an intensity proportional to the energy of the radiation

A photo multiplier tube (PMT hereafter ) converts tiny flashes of light into electrical pulses. The amplitude of these pulses are proportional with the intensity of the light flashes.

By combining these two you get electrical impulses indicating radioactive events (Gamma photons) with the amplitude of the pulses representing the energy of these radioactive events.

By creating a histogram of the energy distribution (pulse amplitudes) of these events you can determine the origin of the radiation e.g. which radioactive isotopes were involved.

It is a little bit like making a color spectrum but with Gamma rays in place of colors.

Operating a Photo Multiplier Tube

Hamamatsu supplies a manual about how to operate photo multiplier tubes so I won’t go into too much detail about this.

The R1166 tube require 1000V to operate. If kept completely in the dark it only draws around 5nA. but if subjected to just a little bit of ambient light the current may be as high as 100mA.resulting  in 100W being dumped into the tube which would instantly destroy it. This is why PMTs must be operated in complete darkness. When running normally with a scintillator it draws much less than 1 mA.

I started with one of these cheap high voltage modules from eBay:

The module can only delivers a few watts of power so it should be safe in case some light hit the PMT.

The tubes I got already came with the all the circuitry needed to bias the various electrodes (dynodes) inside so all I needed was to supply the 1000V:

Power supply, PMT and scintillator.

I put the whole thing including the scintillator in a light proof box and taped everything up with aluminum tape to avoid any light leaks.

Data collection

I wanted to use a micro controller to sample the signals from the PMT. I found many examples online on how to do this but most of them used fast OPAMPS and special filters between the PMT and the micro controller.

I wanted to try and keep everything as simple as possible and I had the feeling that the output from the PMT could be more or less directly connected to an analog pin on e.g. an Arduino.

With the tube powered i took a look at the signals that needed to be analyzed to create a spectrum:

The above is the PMT only loaded with a 1MOhm oscilloscope probe.  With the scope at 5V/div. it is clear that the voltages are too high to be sampled directly by most microcontroller analog inputs. The pulses are also very short which could also be an issue for many ADC’s.

PMT’s have very high output impedance so one could just load the signal with some appropriate resistor to achieve the needed voltage levels.  This would fix the voltage issue but not the speed problem.

Another way would be to add capacitance to the output.

PMT pulses are inherently small burst of current fired into the PMTs internal natural capacitance. This in turn determines the voltage of the output signal. This capacitance is normally kept small to increase the speed of the tube allowing more pulses per second to be detected. Increasing the capacitance would both slow down the pulses and lower the voltage to something that could be detected e.g. by an Arduino:

Above is the signal loaded with a 220pF capacitor. The red graph are a reference showing the speed of the tube before the capacitor was added. 

Most signals now stays within 5V and are slow enough to be sampled with even by something lik an Arduino UNO.

Hooking it up to an Arduino UNO

I set up this circuit for testing:

Even though it may seem a little outdated I chose an Arduino UNO for a very specific reason. 

The ATMEGA328p of the Arduino UNO has a built in voltage comparator. This allow a special software routine (interrupt) to be immediately executed when one voltage drops below another.

This provide a very precise method to trigger sampling of the pulses. 

The circuit

Pulses arrive from the PMT via. a capacitor internal to the PMTs electronics. Since the pulses (from this particular tube) are negative a 1MOhm resistor R1 charges the PMTs capacitor so that Vref are present on the ADCs input when no pulses are happening.

The capacitor C1 is added to control the amplitude/speed  of the pulses as described above. C1 also gets charged to Vref.

A potentiometer is used to set the threshold voltage for the comparator to just below Vref. (4.9 ish Volt).

When a pulse arrive from the PMT it quickly discharges (remember pulses are negative) C1 to some level representing the energy of the pulse. This trigger the voltage comparator which in turn starts the code for sampling the voltage on C1.

ADC speed consideration

From the datasheet of the ATMEGA328p I found that the built in Analog to Digital converter can operate at around 15 kilo samples per second. This is if you want the full 10 bit resolution (0-1023).  You can operate it faster by sacrificing some resolution.

I chose to run the ADC at 16MHz/64=250kHz giving a conversion time of around 20µS. This means that the ADC result only have 9 reliable bits of resolution. By dividing the result by two the “bad bit” gets removed.

The spectrum is formed by keeping a count of the individual pulse levels. Since the ADC can distinguish between 512 levels it then requires 512 different variables (channels) to keep the counts.

Since the ATMEGA328p  only have 2k of RAM it makes sense to let the histogram consist of 512  two-byte values . This will use 1kByte of ram and each channel can then hold up to 65535 counts. 

PMT speed considerations

By adding a capacitor (C1)to the PMTs output the signal gets lowered and slowed enough for the Arduino to sample it. This also has the effect of slowing down how many pulses per second the tube can detect.  After each pulse C1 need to be slowly recharged by R1. During this time successive pulses would just keep (dis)charging C1 giving wrong results or not triggering the voltage comparator at all.

To fix this I used the ability of the analog pin of the ATMEGA328p to be temporarily configured as digital output. After each pulse is successfully sampled by the ADC the pin is set to output and HIGH for a short amount of time. This rapidly charge C1 to its pre-pulse level allowing new pulses to be detected immediately:

The yellow trace is a debug signal the purple trace is the voltage over C1

This completely reverse the slow down effect of C1 and actually makes tube even faster than original!

The code for attempt 1 

I used the code below for testing. Even though it is written for Arduino I still access some internal stuff in the ATMEGA328p chip directly and to keep the timing really thigh I avoided using some  Arduino functions:

 
//*****************************************************
//  Simple photomultiplier sampler
//  Dzl 2024
//*****************************************************
//Macros (in place of digitalWrite() etc..):
#define SET(x, y) (x |= (1 << y))
#define CLR(x, y) (x &= (~(1 << y)))
#define CHK(x, y) (x & (1 << y))
#define TOG(x, y) (x ^= (1 << y))

uint16_t channels[512];  //-Histogram
//---------------------------------------------
//  Code triggered by pulses:
//---------------------------------------------
ISR(ANALOG_COMP_vect) {
  //Sample pulse:
  SET(ADCSRA, ADSC);           //-Start AD converter
  SET(PORTB, 0);               //-Set pin 8 HIGH (debug)
  while (CHK(ADCSRA, ADSC)) {  //-Wait for AD finish
    asm("NOP");
  }
  //Discharge capacitor:
  SET(PORTC, 1);                       //-Set A1 LOW
  SET(DDRC, 1);                        //-Make A1 output
  for (uint8_t i = 0; i < 100; i++) {  //-Wait for a short while
    asm("NOP");
  }
  CLR(DDRC, 1);    //-Make A1 input
  CLR(PORTC, 1);   //-Set A1 LOW (no pullup)
  CLR(PORTB, 0);   //-Set pin 8 LOW (debug)
  SET(ACSR, ACI);  //-Re enable comparator
  //Update histogram:
  uint16_t e = 1023 - ADC;  //-Invert ADC result (pulses are negative)
  e = e / 2;                //-ADC only has half resolution at this speed
  channels[e]++;            //-Update channel for this pulse
}
//Need to be here:
ISR(ADC_vect) {
}
//---------------------------------------------
//  Setup
//---------------------------------------------
void setup() {
  Serial.begin(115200);
  //-Set up comparator
  ACSR = 0b00011011;
 //-Set up ADC   ADMUX = 0b01000001;   //-A1 NOT A0!!
  ADCSRA = 0b10000110;  //-ADC@250kHz => only 9 bit
  ADCSRB = 0b00000000;
  TCCR0B = 0;    //-Stop Arduino timer millis() and delay() won't work
  SET(DDRB, 0);  //pin8 is output
  sei();
}
void loop() {
  //Delay without Arduino:
  for (uint32_t i = 0; i < 10000000; i++) {
    asm("nop");
  }
  //Stop sampling and send histogram
  ACSR = 0b00000000;  //Disable comparator
  Serial.print("{\"histogram\":[");
  for (int i = 0; i < 512; i++) {
    if (i) {
      Serial.print(",");
    }
    Serial.print(channels[i]);
  }
  Serial.println("]}");
  ACSR = 0b00011011;  //-Re enable comparator
}

I disabled TIMER0 which is used to keep time in Arduino. This runs in the background and may interfere with the timing of the sampling code. This means that the millis() and delay() functions no longer works. In stead I just use some long counting loops to introduce delays.

After a few seconds of counting the analog comparator is temporarily disabled and the histogram is sent over Serial as a JSON string.

A debug signal is sent to pin8 for each pulse to be monitored with an oscilloscope.

Displaying the spectrum

There is no good visual way to visualize the spectrum using the current Arduino tools so I decided to write a quick spectrum visualizer in JavaScript:

The program is a single .html file that runs in compatible browsers (or just use the one below).

The ‘connect’ button opens a serial connection to the Arduino board. Once some data is available it will be plotted as a histogram. 

No calibration or analysis is available in this version.

Conclusion

I set out to make a working gamma spectrometer using only readily available parts. I feel that I have come up with a really simple and kind of elegant solution to collect pulse data from a photo multiplier tube. By simply using a capacitor to control the sensitivity of the tube and hold it long enough to be sampled by a moderate microcontroller does not really seem to have any drawbacks as long as the capacitor is immediately discharged after sampling. I do not know if this is a known method (probably is) but I haven’t seen it before.

I still have to find some radioactive materials so I can calibrate the detector and check how well it works. I have checked with Americium from old smoke detectors. It produces a lot of small uniform pulses since all emissions have about the same (low) energy level. I will need something that emit radiation with higher energy levels to really see a spectrum. I am on the lookout for some natural minerals with a known spectrum that may be used to calibrate the detector.

I find PMT’s in old equipment all the time and have collected a few over time just for fun. If this seems to work well I may build something with those as well.

Leave a Reply