Saturday, 14 June 2014

Simple NMR Part 2

I had recently provided an overview of my Simple NMR project here. Since then, I have been busy prototyping and writing software for the project.

I am keeping all of the source code and PCB designs for my project on GitHub under the name SimpleNMR.

The current design is destined for failure as it is significantly under engineered in many ways. The purpose of this phase is really to master CAD PCB design and fabrication, as well as learn about dealing with the sources of noise in the system.

Here are the latest developments on each of the components.


It is very important to know the strength and direction of the earths magnetic field in your location. Luckily, this data is provided by The National Geophysical Data Center. Today in Ottawa, the magnetic field strength was measured to be 54.4275 uT. From this data we can compute the Larmor frequency using the gyromagnetic ratio for hydrogen nuclei.

gamma = 42.5774806 Mhz / T
B0 = 54.4275 uT
f = gamma * B0
f=(42.5774806 Mhz / T) * (54.4275 uT)
f=2.31739 kHz

Most smart phones have a built in compass nowadays. They also have the ability to measure the exact magnetic field strength. The iPhone app "Teslameter" was used to align the coil along the axis of earths magnetic field and to compute the correct Larmour frequency to use.

Transmit/Receive Coil (T/R coil) and Polarizing Coil

T/R Coil

60m of 30-gauge copper wire was used. Purchased from The Source. The wire was simply be left on the spool and used as is. The receive coil should be tuned with a capacitor, however I did not do this  this as I would need a 250 nF capacitor. The next version of the instrument will be tuned with a capacitor.

The red and green wires coming off of the coil belong to the T/R coil. The entire coil was glued with generous amounts of hot glue to the base (A piece of rubber).

Polarization Coil

A polarization pulse will be generated to enhance the signal strength. 12m of 22-guage copper wire was used. The polarization coil was wound atop the T/R coil spool. This coil is hooked up to the black and white wires attached to the coil in the above figure.


  • The sample volume on this coil is only about 8mL. This is not nearly large enough to get a signal from. The signal to noise ratio is proportional to the sample volume. Next time I plan to use a 500mL sample volume. Go big or go home!
Power Supply

All of the electronics will be powered by an ATX power supply from an old computer. I have built a box that connects to the standard ATX connector and beaks it out into each of the voltages using binding posts.


  • It can only provide 0.8A on the -12V rail. This could be a problem as I increase the power of the transmitting amplifier. I could just go and buy a new power supply, however it is hard to find PC power supplies with a large current rating on their -12V rail. Most are about 1A.

Relay Board

The polarization coil will be turned on and off through a relay. The T/R coil will be switched between transmit and receive mode by way of a another relay.

This was the relay board that I designed in KiCad.


  • When I got it back from the fab house ( I found that the pin headers didn't quite fit inside the traces on the board. The problem was that the fab house can only drill circular holes, I had designed the board using ovular/rectangular holes. The solution was to use the vice and force it.
  • This board suffered from poor labelling, there is a power pin header on the right-middle. Any guess which one is ground and which one is positive?
  • Mechanical relays were used on this board, they are very noisy (in a EMI sense). I will be using reed type relays for the T/R switch next time.
  • The relays used were rated at 3 Amps, I was pushing 9 Amps through the relay for the polarization coil. They worked just fine, however this is bad practice. Next time I will use two low current relays for the transmit/receive switch, and then a high current relay for the polarization coil.
  • The relays were only type SPDT, this meant that the transmitter and receiver had to have a common ground. This was a terrible idea as there was significant enough noise coming through the ground to the receiver to saturate the receiving amplifier during the transmit phase. Next time I will use DPDT relays, or perhaps more SPDT relays.
  • When the transmit and receive process is happening, the polarization coil should really be grounded. Also, there should be a short period of time after the transmit process where the receive coil is grounded to allow the ringing to stop.
Transmit Electronics

The transmit signal will leave the sound card of the PC and go to a LF411 operational amplifier. The output of the amplifier will go to the relay and then to to the T/R coil. Here is the transmitter board that I designed in KiCad. I had this board manufactured by (


  • This board is really low power, there is only one stage and it is about 670 mW. Next time I will probably move to multiple stages, and perhaps a higher power op amp.
  • There is no adjustment on the gain because I made an incorrect connection in my schematic. The solution was to put a wire across the board (Seen on the bottom right) where the pot would have gone.

Receive Electronics

The received signal will leave the T/R coil and go through the relay, then to the LF1115 operational amplifier where the signal will be amplified tens of thousands of times. The output of this amplifier will go to a PC's sound card. Here is the receiver board that I designed in KiCad.


  • The pin headers on the board are poorly labeled. This was because I was trying to cram everything onto the smallest possible board. I will never do this again, it is more important to have a clear design, than a cheap design. It ended up not being so cheap, I fried a $6 op amp due to bad labels. 
  • It has a gain of about 50,000 which is only adjustable to about 55,000. It would be nice to be able to adjust the gain in software. The pot is large and is very good at picking up EMI as well.
  • Right now I connect to the T/R coil using pin headers, in the next revision, I would like to use some sort of Coax to keep the noise down.
  • It would probably be a good idea to have some sort of enclosure around this amplifier.


I am using the MSP430 micro controller to control the relay board. Right now the MSP430 simply listens for commands from the serial connection and does what it is told. I have written a simple C program that runs on the MSP430, however it just turns the chip into a serial to parallel converter.

I chose the MSP430 because it costs only $4.99, shipping included, USB cable included, on board serial connection included.

On the other side of the serial connection, is a C++ program which controls the entire experiment. I am using GNURadio for all of the pulse generation, and digital signal processing. Right now timing is not a big deal. In the future, I may need to rethink my software design so that it can time the pulses more accurately. There are some options.

- Move the project to the raspberry pi
- Create a custom USB device, add a 23942342902342342334-Bit ADC to it, and a respectable micro controller
- Move more of the software onto a micro controller


Originally I thought that it would be a good idea to use a large pot to shield the experiment from EMI, this turned out to be a bad idea because the pot was capable of causing inhomogeneity in the magnetic field. I am going to leave shielding out of the next design and focus on filtering out noise using either hardware or software, or by going to a remote location.

The polarization coil that I will be using in the next design is significantly larger than the previous, it should be able to provide a significant amount of shielding on its own.

I have no doubt that I will return shielding to the design some day.


  1. Hi !
    Congrats on choosing this project !! I'm always excited to see something like this. Just a couple of comments. 8 mL might not be too small of a sample if the TR coil is tightly wound around it. It will all come down to the performance of your receiver preamp. You will definitely want shielding, use copper foil or if thats to expensive then use BBQ foil....
    In your design the polarization coil can only be used as prepolarization (since TR coil and polarization coil are parallel in orientation), which is harder to accomplish than a constant polarization field because the turn-off transient will disturb your magnetization unless you turn the polarization coil off very carefully...

    1. Thanks for the input, and you are totally right, I meant to say pre-polarizing coil! I am using a 500 mL volume in the current version, and I am looking into getting a cylindrical piece of metal to use for shielding.

      Have you seen any other projects along these lines that have been successful?

    2. Well, not with that simple construction :-) In our lab we have a machine that can make images of human brain at 270kHz Larmor frequency.
      I know that Los Alamos has a device that make an image of a human hand at 4 kHz (using SQUID detectors, so not easy to do at home)....
      I helped design & build a batch of very low cost educational systems for MIT last year ( This is roughly 8 MHz and makes 100 micrometer resolution images of 10ml samples....
      I'll be curious what you'll be getting from your device....

  2. Hi - nice project.

    I thought you might be interested in this earth's field NMR project I found. Apparently this spectrometer can be constructed for less than $200. It uses an arduino/avr microcontroller setup to do signal generation and provides schematics for the amps and drivers.

    pdf is free to download at: