# Algorithm to sample and interpret scintillator pulses

#### Vilius_Zalenas

Joined Jul 24, 2022
155
Hi,

I was not sure where should I post this question as it involves science, programming, math and a bit of everything. However, maybe you have any ideas... I got a task to create a simple MCA for a scintillator. If you are unfamiliar with those, not a problem, its just some background of what I am actually doing. I got my hardware and software ready, now its just a question of algorithms.

I am constantly sampling an electrical signal which consists of scintillator crystal pulses (amplitude does not matter, typical rise time is 250ns, fall time is 1us). I can never know how many pulses should I expect: sometimes there will be only tens of pulses during one minute, on the other extreme, pulses can literally be piled up on top of each other, I have to account for both of those cases. I use 12 bit ADC to evaluate the amplitude of those pulses and the process the data... Thats a typical MCA.

I now face a problem of the algorithm I should use. What sample rate should I pick for my ADC? If it is too low, my result will be inacurate, if its too high, I will make multiple samples of one pulse, which results in multiple values being written to the memory, while only the highest value should represent the peak amplitude of the pulse captured. If I pick the "oversampling" way, is there any algorithm to differentiate between the pulses? I know it wont be 100% accurate, but I have to make it work properly. Thank you in advance for any ideas. I dont want to go ,,all in" with extremely expensive sigma-delta ADCs involving difficult parallel interfaces, differential input etc. I was thinking something like 5 Msps, would that be enough?

#### Attachments

• 20.1 KB Views: 7

#### MrChips

Joined Oct 2, 2009
29,794
I am sorry to say that your knowledge of nuclear signal processing is inadequate at this point.

The first step is to characterize the type and source of the detector pulse.
What is the type of radiation, alpha, beta, or gamma?
What is the type of scintillator and detector?

For the moment, I am going to assume that the source is a gamma-ray source, the scintillator is a NaI (sodium iodide) crystal and the detector is a PMT (photo-multiplier tube). This is a common situation.

The next step is to characterize the electrical signal, its amplitude, polarity, width, rise and fall time. The shape of the detector pulse will depend on how the pulse is collected and altered by various circuit elements and amplification.

It is very common to utilize a preamplifier which has its own pulse characteristics. A shaping amplifier is used in order to reduce the width of the pulse tail.

When the tail of the pulse is very long, pulse pile-up becomes a problem at very high count rates. Hence, it is necessary to identify the maximum event rates to be encountered. Rates under 1000 cps can be handled without pulse pile-up effects. Many MCAs are not capable of analyzing pulse rates higher than 10k-100k cps.

The next step is to understand how a typical MCA (multi-channel analyzer) works. Traditionally, the MCA will attempt to measure the peak amplitude of the pulse signal. If the pulse-width is of the order of 1μs, then an ADC sampling rate of 5Msps is totally inadequate. The signal peak might rise and fall in less than 20ns. An ADC with 200ns sampling period would miss the peak entirely.

Traditional analog signal processing will use a peak detect and hold circuit. This is simply a diode and capacitor which holds the maximum voltage input. This type of circuit is usually implemented using opamps. An analog comparator circuit is needed in order to detect the presence of an event. Following this, the ADC measures the voltage output of the peak detector circuit. Finally, the MCA needs to discharge the peak detect capacitor. This method is not without its problems. The peak detect circuit will respond to any noise in the signal. Hence it is important that all noise, low and high frequencies be minimized.

Traditional MCAs use a different type of ADC for maximum resolution. 13-bit resolution is required for collecting an 8K energy spectrum. Instead of measuring voltage amplitude, time duration is measured using what is known as a dual-slope amplitude-to-time conversion.

The trend today is to use very high speed ADCs to digitize the entire pulse. The sampling rate has to be very high, in excess of 50Msps. There are many advantages of going digital. This is beyond the scope of this discussion at this point.

#### Vilius_Zalenas

Joined Jul 24, 2022
155
I am sorry to say that your knowledge of nuclear signal processing is inadequate at this point.

The first step is to characterize the type and source of the detector pulse.
What is the type of radiation, alpha, beta, or gamma?
What is the type of scintillator and detector?

For the moment, I am going to assume that the source is a gamma-ray source, the scintillator is a NaI (sodium iodide) crystal and the detector is a PMT (photo-multiplier tube). This is a common situation.

The next step is to characterize the electrical signal, its amplitude, polarity, width, rise and fall time. The shape of the detector pulse will depend on how the pulse is collected and altered by various circuit elements and amplification.

View attachment 303119

It is very common to utilize a preamplifier which has its own pulse characteristics. A shaping amplifier is used in order to reduce the width of the pulse tail.

View attachment 303118

When the tail of the pulse is very long, pulse pile-up becomes a problem at very high count rates. Hence, it is necessary to identify the maximum event rates to be encountered. Rates under 1000 cps can be handled without pulse pile-up effects. Many MCAs are not capable of analyzing pulse rates higher than 10k-100k cps.

The next step is to understand how a typical MCA (multi-channel analyzer) works. Traditionally, the MCA will attempt to measure the peak amplitude of the pulse signal. If the pulse-width is of the order of 1μs, then an ADC sampling rate of 5Msps is totally inadequate. The signal peak might rise and fall in less than 20ns. An ADC with 200ns sampling period would miss the peak entirely.

Traditional analog signal processing will use a peak detect and hold circuit. This is simply a diode and capacitor which holds the maximum voltage input. This type of circuit is usually implemented using opamps. An analog comparator circuit is needed in order to detect the presence of an event. Following this, the ADC measures the voltage output of the peak detector circuit. Finally, the MCA needs to discharge the peak detect capacitor. This method is not without its problems. The peak detect circuit will respond to any noise in the signal. Hence it is important that all noise, low and high frequencies be minimized.

View attachment 303120

Traditional MCAs use a different type of ADC for maximum resolution. 13-bit resolution is required for collecting an 8K energy spectrum. Instead of measuring voltage amplitude, time duration is measured using what is known as a dual-slope amplitude-to-time conversion.

The trend today is to use very high speed ADCs to digitize the entire pulse. The sampling rate has to be very high, in excess of 50Msps. There are many advantages of going digital. This is beyond the scope of this discussion at this point.
Okay, a little update,

I implemented a shaping amplifier that extends the signal duration in time. The voltage levels between preamp and shaping amplifier are a bit off, resulting in 3V saturation of the signal, but that just proves my problem even stronger.

Now the saturated signal has around 2-3 us peak amplitude (around 3V) duration. For testing I am using 256 channel setup with teensy 4.1 (which has core clock of 600 Mhz and maximum ADC speed of only 1Msps.) 1 Msps should be more than enough measuring 2-3 us duration voltage levels.

Code fragment on how am I reading the data:

Code:
void loop() {

for (int i = 0; i<Chanel_number; i++){
if(Analog_value==Chanel[i]){
Chanel_value[i]++;
}
}

if(send_flag){
send_flag=false;
sendLine();
}

}
The data is then transmitted to the PC and written to a text file. Every step of this project is tested and verified, my hardware is setup correctly. (huge numbers on channel 8 and 9 can be explained by a small DC offset, lets not focus on that.) But still I am not getting the data right. I even tested the setup with a real Cs137 sample, it did not give me any results (counts) in lets say 50-250 channels.

How can it be that the teensy 4.1 does not catch up with these 3V signals? (looping 256 times in the program should be neglectable at 600 Mhz, that sholdnt make any difference.) My channels result file down below.

Could it be that ADC speed is not even set to 1Msps be default, do you know how to change it in software? Thank you in advance.

#### Attachments

• 8.8 KB Views: 1
• 2.8 MB Views: 2
• 2.5 MB Views: 2

#### MrChips

Joined Oct 2, 2009
29,794
Why are you allowing the signal to saturate?
1Msps is not fast enough to digitize the waveform. I would use the peak detect, hold and sample technique.

#### Vilius_Zalenas

Joined Jul 24, 2022
155
Why are you allowing the signal to saturate?
1Msps is not fast enough to digitize the waveform. I would use the peak detect, hold and sample technique.
Saturation is done just for testing. Saturated signal results in only longer peak voltage durations that are easier to catch (in theory.) But if I have a 2-3 us duration when the voltage is at 3V, there is no chance I will miss it at 1 Msps (simply impossible). And it still happens... Why?

#### MrChips

Joined Oct 2, 2009
29,794
Saturation is done just for testing. Saturated signal results in only longer peak voltage durations that are easier to catch (in theory.) But if I have a 2-3 us duration when the voltage is at 3V, there is no chance I will miss it at 1 Msps (simply impossible). And it still happens... Why?
You are missing it because you are not sampling at 1Msps. Your sampling rate is limited by the software loop that takes longer than 1μs to execute.

#### Vilius_Zalenas

Joined Jul 24, 2022
155
You are missing it because you are not sampling at 1Msps. Your sampling rate is limited by the software loop that takes longer than 1μs to execute.
How do you know that? At 600 Mhz core clock that 256 iteration cycle is done instantly (order of magnitude faster than 1 us.) Anyway, so you suggest I use something like SandH amplifier? Would someting like LF398 do the trick or I need someting more complicated for my application?

#### MrChips

Joined Oct 2, 2009
29,794
In order to measure the loop execution time, generate a pulse on a GPIO pin (or toggle the pin) and measure on the oscilloscope.