Ultra-Low Cost LimeSDR-Based NMR Spectrometer

"I find the ability to modify and look at the source code to be really valuable," explains Carl Michal of his experiments with the LimeSDR in NMR spectroscopy. "I've learned a lot from tinkering with the LimeSDR that I'm sure I wouldn't have with a proprietary system."

“As a kid, I was always interested in how things worked: radios, lights, mechanical gizmos,” says Carl Michal, associate professor at the University of British Columbia’s Department of Physics & Astronomy. “I was constantly taking things apart to figure out what made things work. In school, physics seemed the best match with my interests. Then as a university student, the instructors of my introductory physics classes were truly inspiring, and provided the push to pursue physics.”

That interest in taking things apart would lead Michal to a level few reach: the study of solid-state nuclear magnetic resonance (NMR) spectroscopy, which allows for materials to be observed at the level of the local magnetic fields surrounding atomic nuclei – or as “taken apart” as anything is ever likely to get. While traditionally this requires expensive, proprietary scientific instrumentation, Michal and colleagues are investigating an alternative approach: home-made spectroscopy equipment.

Doing It Yourself

“I’ve been working with commercial and ‘home-built’ NMR spectrometers for about 25 years,” Michal explains. “In some sense a general purpose research NMR spectrometer is a software defined radio, though historically they’ve been extremely expensive and have had limitations on phase resolution and the complexity of what can be transmitted.

“The LimeSDR is the first software defined radio I’ve worked with. The combination of the price, the capabilities of the hardware, and the open source nature of the project triggered me to jump in. There are other people who’ve used earlier SDR projects for NMR, but until the LimeSDR it always seemed to me that I could meet my needs more cheaply or conveniently some other way.”

The result of those experiments: An NMR spectrometer console capable of demonstrating high-resolution and wide-line spectroscopy with line widths of up to 50 MHz, a considerable improvement on the earlier low-field implementations that inspired Michal’s efforts.

Carl Michal's NMR Spectrometer Console, Block Diagram

There’s a way to go before people will be carrying out NMR spectroscopy in their living room, though. “It is definitely a step in that direction,” Michal explains. “It certainly makes the RF part of the hardware affordable to anyone who wants it. For NMR though, you also need a magnet. In research labs, that magnet is usually a large, expensive, superconducting magnet.

“Compact magnets that produce a uniform enough magnetic field have become available in the last decade or so – though actually buying them is kind of a challenge. They are still not ‘affordable’ on the same scale as, say, the LimeSDR. We also generally use high-power RF power amplifiers – although there are lots of NMR experiments you can do with modest power output.”

The Hardware

Michal’s build combines the LimeSDR open-hardware software defined radio, based on Lime Microsystems’ LMS7002M field-programmable radio frequency (FPRF) product, with a custom pulse programmer – used to configure pulse timing and control the blanking of high-power amplifiers, switch receiver input gates, and other NMR components – built using an Arduino Due microcontroller board. In future designs, though, it’s possible that the LimeSDR could handle both tasks, using the field-programmable gate array (FPGA) with custom firmware and the board’s eight general-purpose input-output (GPIO) pins.

“The hardware is all there,” Michal explains. “There would need to be changes to the FPGA to add timestamp-synchronised GPIO outputs. So changes would be required to the FPGA, the host API and, maybe, to the FX3 interface. I think the sensible way to do this would be to set up an engine in the FPGA that would process a FIFO [First In First Out queue] of GPIO output events, where you could specify a series of output words and timestamps at which they were to be activated. A simpler, but not as good way might be to just set up a new stream for GPIO outputs, that was similar to a TX stream. I have toyed with the idea of implementing a ‘poor-man’s’ version of this by hijacking the stream for TX2, which I’m not using, and interpreting some of the low bits on it as GPIO output values. This seems like it would be easy to do, but would mostly just be for fun, since I really need more output lines than there are GPIO pins available.”

Carl Michal's NMR Magnet

Open Hardware, Open Source

Even in the two-board design, the open design of the LimeSDR – for its hardware, software, and firmware – was key. “There were some features I needed that the LimeSDR didn’t have, that I was able to add because of its open source nature,” Michal explains. “I find the ability to modify and look at the source code to be really valuable – I’ve learned a lot from tinkering with the LimeSDR that I’m sure I wouldn’t have with a proprietary system.”

Those features – primarily the need to synchronise timing with a high accuracy to the Arduino-based pulse programmer – were added by modifying the publicly-available source code for the gateware which runs on the LimeSDR’s FPGA hardware. With ready access to the original source code and a permissive licence which encourages modification and experimentation, Michal was able to implement a system which provides nanosecond reproducibility in the timing of events occurring on the two separate devices – something that would not have been possible on a proprietary, closed-source device.

The Results

Michal’s experiment proved beyond question that the LimeSDR is at home in an NMR spectrometer: in a pre-print copy of his paper, “A low cost multi-channel software-defined radio-based NMR spectrometer and ultra-affordable digital pulse programmer,” in which the resulting device is claimed to be the first multi-channel NMR spectrometer to be built around a commercial off-the-shelf SDR, Michal concludes that the creation “provides competitive performance” having showcased high-resolution and wide-line spectroscopy – at one point even using only the components built into the LimeSDR itself, without an external power amplifier or preamplifier.

Carl Michal's NMR Spectrometer Output

In the paper, Michal praises Lime Microsystems’ LMS7002M: “The LMS7002M chip incorporates an astounding level of integration,” he writes, “[while] the open-source nature of both the software and the support firmware [of the LimeSDR] allows modification of the device’s capabilities to optimise it for NMR-specific applications. The spectrometer described here could replace the RF console of a commercial multi-channel high-field NMR system [and] is capable of multi-nuclear solution and solids NMR experiments at any but the very lowest magnetic field strengths.”

The Future

That’s not to say Michal doesn’t have a wish-list for a future LimeSDR design that could improve the project, of course. “An easy way to reset decimation/interpolation on RX/TX and on multiple boards so that samples can be synchronized amongst multiple channels,” he begins. “I’ve solved this – though it would be great to have a way to do this built-in that doesn’t involve quite so many hacks as I had to make.

“An easier way to reset timestamps would be nice. Perhaps a ‘triggered start’ mode, where a t-start command is given over USB (which resets all timestamps to 0, and ideally resets all clock decimation and NCO phases to 0 – see a and B), then the FPGA waits for a GPIO trigger at which point everything starts.

“I’d love to see a separate amplitude modulation stage on the transmitters, then have an option to organize the TX stream data as amplitude and phase rather than I and Q. As a potentially less invasive alternative, just having the TX data streamed as amplitude and phase, and having the TSPs do the work to convert to I/Q samples would help. The issue here is that as amplitude is reduced, phase precision deteriorates. This would be completely solved with a separate amplitude modulation stage, but would also be significantly improved with a non-zero NCO frequency if the TSP’s did the translation from amp/phase to I&Q. More bits in the I&Q DACs would also be nice.”

Michal’s research has been published in the paper A low-cost multi-channel software-defined radio-based NMR spectrometer and ultra-affordable digital pulse programmer, available now.

See also: