Hardware timer based coincidence trigger


I'm making a cosmic ray detector based around the mbed. The detector is built using plastic scintillator, wavelength shifting fibre and silicon photomultipliers. When a charged particle (usually muons at ground level) goes through the scintillator some of its energy is absorbed and emitted as visible light. Some of the light will hit the wavelength shifting fibre, which absorbes the light, and remits more light at a lower wavelength, some of which is captured in the fibre. The light that couples into the fibre hits the a silicon photomultiplier. This is a solid state devices that is constructed from an array of pixels. Each pixel, if it absorbs a photon, will allow a small current though the device. The pixels have a large gain, so each absorbed photon leads to a current of many electrons (10^6). All the pixels are connected in parallel, and so the total current passing through the sensor is proportional to the number of pixels which absorbed photons.

The detector has a silicon photomultiplier at either end of the optical fibre. Each sensor fires a trigger when the current passing through the sensor exceeds a set threshold. However, the sensors have a high rate of fake signals compared to the rate of signals from cosmic rays. The fake rate can be reduced by raising the trigger threshold and also by implementing a coincidence trigger. When a cosmic ray passes through the detector both sensors (at either end of the fibre) should receive a signal at essentially the same time. The fake signals occur randomly, however, and so the probability that they both receive a fake signal in a short time window scales with the length of the time window.

A coincidence timer can be implemented using the mbed SDK's Timer class, however this requires waiting for software in interrupts to play with the timer, at at best can give microsecond resolution. The LPC1768 has a number of hardware timers that could be used to implement a coincidence trigger that should have better performance than one based on the Timer class.


The LPC1768 has 4 timers (TIMER0/1/2/3). Each timer has two capture input pins. These can be set up to store the current value of the timer when the input changes (or rises/falls), and optionally cause an interrupt. There are also at least two match output pins, which can change their output when the timer's value matches stored values. The timers also have some internal matches, that can reset the timer, interrupt, etc when the timer's value matches other stored values.

TIMER2 and TIMER3 both have their capture pins routed to the mbed's pins. TIMER3 is used for the SDK's timing classes, so playing with this should be avoided. TIMER2 will therefore be used for the coincidence trigger. The mbed pins corresponding to the TIMER2 pins are shown below

TIMER 2 functionmbed pin

Coincidence trigger

How the hardware timer based coincidence trigger works, the library to use it, etc..

1 comment on Hardware timer based coincidence trigger:

14 Apr 2015

Exposed pin mappings for Timer 3:

  • CAPTURE0: p15
  • CAPTURE1: p16
  • MATCH0: p28
  • MATCH1: p27

Please log in to post comments.