The Challenge

Our small team of domain experts, with minimal embedded design expertise, had to develop a ready-to-run, high-speed X-ray imaging system that is robust, accurate and easily upgradable. For the first time ever, this system would promote the wider adoption of the Medipix3 detector chips developed at CERN.

The Solution

By using off-the-shelf NI technologies, we avoided the complexities of traditional embedded design. The NI FlexRIO platform minimised our custom electronics requirements, while LabVIEW removed the complexities of VHDL development. By choosing NI, we reduced expected development time by six months and enabled a clear path to future upgrades.

About Quantum Detectors

Quantum Detectors is a spinoff of Diamond Light Source and the Science and Technology Facilities Council (STFC), based in Oxford, UK. We transfer technology from world-leading scientific facilities such as Diamond, CERN and the European Synchrotron Radiation Facility (ESRF). Quantum Detectors is well integrated into the synchrotron community around the globe and was founded to promote a wider exploitation of detectors developed for large-scale facilities.

Introducing Merlin

Scientists often use particle beams at synchrotron research facilities to generate high-energy photons in the form of X-rays. In turn, they use these X-rays as measurement probes to examine the material characteristics of everything from fossils to jet engines to viruses to vaccines. However, these X-rays are useless without accurate detector systems to monitor their interactions with the test samples.

Merlin is a cutting-edge X-ray imaging system, which counts individual photons above a user-selected energy level as they strike the integrated pixel sensor. Merlin can indefinitely acquire X-ray images at 100 frames/second in continuous mode. In burst mode, in which the user predefines the number of images to capture, Merlin can capture 1,200 frames/second.

Merlin is fueling materials experimentation around the world, enabling researchers to study fine details of material surfaces or look inside solid objects nondestructively.

To exemplify the fidelity of the images that Merlin can capture, we scanned a sealed tin of fish. The following image from our LabVIEW user interface, allows you to clearly identify the tin’s integrated ring pull and the minute fish bones. Merlin delivers an incredible resolution of 55 µm per pixel, capturing significantly finer details than many other well-known systems on the market.

fig 1















Applications of Merlin

Merlin is enabling a wide range of advanced X-ray-based research applications all over the world, including:

Scanning Transmission Electron Microscopy: A technique used to study small details in materials and biological cells at near-atomic levels

Tomography: Obtaining detailed images of a selected section/plane of a solid object while blurring out the other planes

Grazing-Incidence Small-Angle Scattering: A technique used to study nanostructured surfaces and thin films

Phase Contrast Imaging: Exploiting the differences in the refractive index of various materials to differentiate between structures under analysis

Although we designed Merlin primarily for synchrotron experiments, it was used in a novel entomological demonstration at Göttingen University in Germany. To examine a Green Lacewing insect, Merlin generated a phase contrast X-ray image of the inner-anatomy of the insect. We set this experiment up with our intuitive LabVIEW user interface, which enabled us to configure, network, and complete the experiment within just 30 minutes

Empowering Merlin

We developed the Merlin system with three key enabling technologies.

1. Medipix3 ASIC

Medipix3 is the third-generation of a cutting-edge CMOS sensor, suitable for monitoring X-rays in the range of 5–20 keV. CERN hosted development of the sensor, but included contributions from a consortium of laboratories including DESY, ESRF, and Diamond Light Source.

Until now, Medipix3 sensors were only available to members of the consortium. However, under license from CERN, Merlin integrates multiple Medipix3 sensors, empowering any scientific facility or university laboratory to take advantage of this fast, color, noise-free photon counting ASIC.

2. PXI Express System

Devices based on the sensor’s predecessor, Medipix2, are available to plug directly into laptops. However, to take full advantage of Medipix3’s superior performance, including the continuous dead-time-free readouts, we supply Merlin with an industry-leading NI PXI Express system. This robust, extensible and well-supported platform, integrates a high-performance industrial controller and NI PXIe-7962R FlexRIO module with integrated FPGA and 512 MB of dedicated DRAM.

With four detector chips, 66K pixels/chip, 16-bits/pixel, and 100 frames/second, Merlin’s readout electronics need to process and store an immense amount of data—over 500 Mb/s. Fortunately, PXI Express provided this high-throughput data communication with no custom design work.

The FlexRIO module, which plugs into the PXI Express chassis, performs high-speed, in-line processing on the Medipix3 sensor streams. We programmed the integrated FPGA of the FlexRIO to implement a huge range of tasks, including constructing image frames from the live data streams, formatting control commands for the Medipix3 chip, providing custom trigger and timing signals with a resolution of 10 nS, and transmitting data from the FPGA to the host controller through DMA FIFOs.

The only custom hardware required was the front-end electronics that provided the interface between the sensor and the exposed FPGA I/O of the FlexRIO. Although NI offers a broad range of front-end FlexRIO adapter modules, we required something very specific. But, we could simplify even this potentially complex task using the FlexRIO Adapter Module Development Kit (MDK) to quickly develop a custom FlexRIO adapter module and interface it with the FPGA software.

3. LabVIEW

LabVIEW delivers a single tool to design, prototype, and deploy both the PC host and FPGA processing code. When we started the project, we had no experience with LabVIEW or FPGA. Yet, within nine months we had our cutting-edge, complex detector system up and running. We could not have achieved this if we were configuring the FPGA with VHDL and coding the GUI and host processing with C++.

Using LabVIEW, we developed high-speed image acquisition software, which temporarily holds images in RAM whilst they stream to the hard drive. The application can acquire and process images at a constant 100 frames/second without ever running out of memory. The intelligent memory management and allocation of LabVIEW, and built-in multithreaded capabilities, simplified our code enormously.

The LabVIEW code also implements TCP/IP-based remote control functionality, which provides easy integration into existing EPICS and TANGO control systems.

At the start of the project, NI experts delivered LabVIEW and FPGA training, which significantly accelerated our system development. Now passionate about LabVIEW, our team regularly joins the LabVIEW user group meetings at Rutherford Appleton Laboratories to learn best practices from fellow developers and implement timely design reviews.


Traditional embedded design starts with the purchase of an FPGA development board. Users then must add power supplies, software development systems, analog and digital interface components, a PC host interface, and a protective enclosure. Then VHDL development begins, which can quickly generate enormous, difficult-to-manage code. This traditional approach would have stretched our team resources and significantly delayed the project.

By choosing NI, we avoided the traditional complexities of the embedded design process. Other than a small custom interface PCB, we built our cutting-edge detector system with off-the-shelf NI technologies, reconfigured for our specific requirements using LabVIEW. This saved six months of development time. Having a single vendor responsible for the support of both software and hardware is very helpful and assuring.

Not only did the NI solution accelerate our initial development, it mitigates against component obsolescence and allow us to implement future upgrades with minimal hardware and software redesign. NI’s continued investment in the FlexRIO platform helps us improve performance by adding additional modules or by simply replacing our existing FlexRIO system with new models. By preventing complete redesigns when implementing future iterations of Merlin, we expect development time to be reduced from months to weeks.

With Merlin, we have created a cutting edge, upgradable detector system, which is enabling the wider adoption of advanced Medipix3 technologies developed at CERN. Merlin systems have already been installed in five beam lines at Diamond Light Source, as well as labs and synchrotrons at Spring8 (Japan), Soleil (France), APS (USA), and Glasgow University (UK). With NI by our side, we are excited about what the future holds for Merlin.