PSoC based Photon Counter


In photometry of dim light sources (for example in the field of fluorescence) the “Photon Counting” technique is often used: this technique consists in the photon counting and the evaluation of the intensity of the light source in terms of the number of photons in the unit of time. Of course it is necessary to use single photon sensitive detectors, such as photomultiplier tubes, or solid state devices such as SiPM (silicon photomultipliers) or SPAD (Single Photon Avalanche Diode).
In addition to the detectors it is necessary to have an adequate fast counting electronics that is able to acquire the short pulses generated by the devices and able to work with high counting frequencies.

There features are also very useful :
– counting in a time frame (Time Gated Counting);
– timing between a pulse and the next one;
– timing between the trigger and the first pulse received (start-stop timer);

In this post we will describe the home-made “Photon Counter”, in order to obtain the features described above.

The choice of the PSoC

Our “Photon Counter” is based on the PSoC component. PSoC (Programmable System-on-Chip) is a family of microcontroller integrated circuits by Cypress Semiconductor. These chips include a CPU core and mixed-signal arrays of configurable integrated analog and digital peripherals.
A PSoC integrated circuit is composed of a core, configurable analog and digital blocks, and programmable routing and interconnect. The configurable blocks in a PSoC are the biggest difference from other microcontrollers.
PSoC resembles an ASIC: blocks can be assigned a wide range of functions and interconnected on-chip. Unlike an ASIC, there is no special manufacturing process required to create the custom configuration — only startup code that is created by Cypress’ PSoC Creator IDE.
PSoC resembles an FPGA in that at power up it must be configured, but this configuration occurs by loading instructions from the built-in Flash memory.
PSoC most closely resembles a microcontroller combined with a PLD and programmable analog. Code is executed to interact with the user-specified peripheral functions (called “Components”), using automatically generated APIs and interrupt routines. PSoC Creator generate the startup configuration code that initialize the user selected components upon the users needs in a Visual-Studio-like GUI.

In our application we used the model PSoC 5LP. For development we used the CY8CKIT-059 kit board.

The strong points of the PSoC are the ease of use and programming combined with a rich set of ready-made HW/SW components that easily integrate with each other. The clock speed is medium-high, up to a maximum of 80MHz. In our project we used a base clock of 40MHz that corresponds to a period T = 25ns, this we must take into account to establish the maximum limits of count and time duration of the input pulses.

The image below shows the inside of the Photon Counter with the PSoC 5LP base.

Functionality and Interface With Raspberry Pi

The features of the Photon Counter are the following :

  • Simple Counter : it counts the pulses and calculates the rate (in CPS) and the square deviation.
  • Time Gated Counter : it counts the pulses received within a time frame determined by the Gate pulse, the count is enabled when the Gate input is at a high level.
  • Fast Timer : it measures the time interval between a Trigger pulse and the first received pulse.
  • Pulse Interval : measures the time interval between one pulse and the next.

To realize these features, the device we have created has two inputs :
Pulse Input : input for the pulses that are to be counted.
Gate/Trigger Input : input for the Gate pulse and the Trigger pulse (they use the same physical input).

The Photon Counter also has a 4×20 LCD display, three control keys and status LED.

In the Time Gated Counter, Fast Timer and Pulse Interval modes, the measurement results are transmitted via the UART (serial) interface to a Raspberry PI which provides data storage for subsequent processing.
In the image below you can see the Photon Counter connected to the Raspberry PI.


In the images below we see the main parts of the software loaded on the microcontroller. Both for the input that receives the pulses to be acquired and for the input that receives the trigger pulse, the signal is sent to a comparator with hysteresis that makes a comparison with a predefined threshold: this allows us to obtain a positive edge not related to the amplitude of the input signal. This signal, sent to a Flip Flop type D, with external R and C components, allows us to produce a pulse with a fixed duration of 50ns.

The trigger pulse and the count pulse are sent to the Timer_Trigger which, when the device is in “Fast Timer” mode, measures the time interval between these two pulses.

The count and gate pulses are sent to the counter modules which perform pulse counting. The Timer_Pulse also measures the time intervals between one pulse and another.

The diagrams below shows the three buttons (Start/Stop, Control and Reset), the status LED and the Pulse Out signal. This signal is a positive 10ms pulse fired when the start button is pushed, this signal is useful ,for example, to switch-on an external light source (excitation laser).

The diagrams below shows the physical connections with the three buttons (Start/Stop, Control and Reset), with the status LED and with the input signals (Pulse and Gate/Trigger) and the Pulse Out.


The device realized has proven to be a versatile and reliable equipment. The possibility, with the PSoC, to have relatively high clock frequencies allows short pulse signals (30ns) to be acquired at fairly high frequencies. In a single device there are the main functions of pulse counting and measurement of time intervals. Of course there are limitations : time intervals that can be measured accurately are more in the microsecond range than in the nanosecond range, but for many applications this is more than enough.

If you liked this post you can share it on the “social” Facebook, Twitter or LinkedIn with the buttons below. This way you can help us! Thank you !


If you like this site and if you want to contribute to the development of the activities you can make a donation, thank you !

Check Also

KC761B: the new Gamma Spectrometer from DEEPACE

Abstract: in this article, we present an interesting new apparatus dedicated to gamma spectrometry and dosimetry measurements. It is a device based on a CsI(Tl) scintillator coupled to solid-state photomultipliers: SiPM. In addition to the scintillation sensor, the instrument has a PIN diode sensitive to beta radiation.