Keywords

1 Introduction

NMR spectroscopy is used to study molecular order and dynamics in different materials, as for instance, organic compounds like ionic liquids and liquid crystals [1,2,3,4,5,6,7,8,9,10,11].

There are different NMR techniques used to study molecular dynamics by measuring relaxation times T 1 spin-lattice and T 2 spin-spin. The main difficulty associated with the NMR relaxometry at different magnetic fields is the signal-to-noise ratio (SNR) of the measured NMR signal, since the NMR SNR decreases with the magnetic field [2,3,4]. Therefore, conventional NMR spectrometers, which operate at fields above 0.1 T, are not suitable to perform studies of resonance frequencies associated with low magnetic fields [5]. The FFC-NMR apparatus is used to overcome this difficulty, by applying different magnetic fields at distinct times, but always measuring the NMR induction signal when the sample is submitted to a high magnetic field.

In an FFC-NMR experiment to measure the T 1 spin-lattice relaxation time, the sample is submitted to different Zeeman fields B 0 at different times, allowing measurement of the magnetization decay with time at a low magnetic flux density, but detecting the NMR signal when the sample is submitted to a high magnetic flux density, which provides good SNR measuring conditions.

In general, the magnetic flux density varies cyclically, as it is illustrated in Fig. 1.

Fig. 1
figure 1

Standard time diagram of the magnetic flux density of the FFC-NMR technique

At first, the sample is submitted to a strong magnetic flux density B 0P to be polarized. Following this, the magnetic flux density switches down to a lower value B 0E that is applied during a time Δt E. Next, the field switches up to a stronger magnetic flux density B 0D during Δt E and finally the magnetic flux density switches back to the initial value B 0P after Δt D. Since the detection of the NMR signal is made when the sample is submitted to B 0D, which is larger than B 0E, the sensitivity of the quality of the NMR signal detected is independent of the evolution occurring during Δt E. As it is essential to cycle the magnetic flux density accurately, after Δt D the magnetic flux density changes to B 0P being the transition time Δt on2 [2,3,4].

In order to implement the cycle represented in Fig. 1, the current supplied to the magnet coils that produce the magnetic flux density B 0 is controlled in such a way that the transitions between the different magnetic flux densities are fast, but the magnetic field is stable during the steady states. This means that the power sourceof an FFC apparatus requires a control system that guarantees steady and stable currents during Δt P, Δt E, and Δt D and regulated transitions of the current between these steady periods of the cycle.

Classical solutions use an analog PID regulator controlling the Zeeman field in FFC-NMR experiments. A step forward in the development of FFC relaxometers is to implement a digital controller taking advantage of the features offered by low cost microcontrollers. The digital approach of a PID controller is based on a discrete algorithm.

The real implementation of the digital control is used in a pre-production NMR relaxometer prototype. This embedded system is going to replace part of the analog solution already implemented and tested in the power supply control system. With this solution, the digital control system modulates the Zeeman field of the setup as required by the FFC-NMR technique. In order to modulate the magnetic flux density, the magnet current is controlled throughout the semiconductors of the relaxometer power supply. This is achieved using the commercial Microchip dsPIC30F4013 microcontroller, which also requires the usage of additional filters and driving on-chip peripherals interfacing sensors and power semiconductors.

The developed digital solution is tested performing FFC-NMR experiments for the liquid crystal 5CB and the ionic liquid[BMIM]BF4.

2 The Apparatus

The FFC-NMR technique is a technique for applications requiring molecular dynamics characterization [2,3,4]. Cycling the magnetic flux density using mechanical systems was the earliest form of the field cycling technique.

In the latest NMR relaxometers, the magnetic flux density is controlled using up-to-date power supplies based on modern power semiconductors, allowing to control the electric current flowing in the FFC magnets [12,13,14,15,16,17,18,19]. A recent design of an FFC power supply uses IGBT semiconductors and a direct control of their gate voltage, which allows regulating the magnet current within the limits of the FFC NMR specifications. One common aspect of the control units of the power supplies developed so far is the use of analog electronics in their implementation [18,19,20].

In this paper, a digital power control unit was developed and integrated in the power supply of a new relaxometer prototype using an FFC magnet with R M = 3 Ω and L M = 270 mH [14]. The architecture of this relaxometer is presented in Fig. 2.

Fig. 2
figure 2

Main parts of an FFC relaxometer [13]

In this solution, the magnet is excited by two power sources (U 0 and U aux). The control system of the main power source of the FFC relaxometer is represented in Fig. 3. The main power source (U 0, 24 V DC power supply) supplies the magnet accordingly to perform the magnetic field cycle. In addition, a high voltage (U aux = 500 V DC) power source is switched on by the control system during theup-down (Δt on) magnetic flux density transitions. The time interval Δt on is in the milliseconds range, allowing to obtain short switching times from a low magnetic flux density level to the high polarization magnetic flux density level.

Fig. 3
figure 3

Main power source control circuit of the FFC equipment

This spectrometer directly controls the magnetic flux density feedbacking the output signal of a Hall effect sensor (u Hall(t)) placed in the sample’s cavity. The other input of the control system is the reference magnetic flux density signal r(t). The output of the control chain (u C(t)) corresponds to the command signal of the semiconductors in order to get the accurate magnetic flux density level B 0 corresponding to the reference imposed.

Without the contribution of the auxiliary power supply U aux, the behavior of the circuit is given by

$$ \frac{\mathrm{d}{i}_{\mathrm{M}}}{\mathrm{d}t}=\frac{1}{L_{\mathrm{M}}}\left({U}_0-{v}_{\mathrm{CE}}\right)-\frac{i_{\mathrm{M}}}{\tau_{\mathrm{L}}} $$
(1)

where \( {\tau}_{\mathrm{L}}=\frac{L_{\mathrm{M}}}{R_{\mathrm{E}}+{R}_{\mathrm{M}}} \).

As an IGBT semiconductor is used, the incremental changes in the control voltage (gate-emitter voltage) lead to a change in the semiconductor current as follows:

$$ \Delta {v}_{\mathrm{C}\mathrm{E}}=\beta \left({R}_{\mathrm{E}}\Delta {i}_{\mathrm{M}}-\Delta {u}_{\mathrm{C}}\right) $$
(2)

Being the factor β set according to the characteristics of the IGBT.

So that, the magnet current can be set by changing the gate command voltageu C. As referred before, the transitions between magnet current levels, i.e., magnetic flux density levels, need to be fast, but should be long enough so that the net magnetization follows the Zeeman field reorganization. Clearly, these limits depend upon the spin system in consideration. In order to fulfill the requirements of the FFC technique, transition times in the milliseconds range (≈3 ms and less) are acceptable for a wide range of compounds [5,6,7,8,9,10,11,12,13,14,15, 21].

To reach the required switching times during a down-up transition (Δt on), the auxiliary power supply is turned on. During this transition, the IGBT semiconductor operating point is forced to the saturation region as the magnet current rises, reaching its steady-state value. A PI controller is the typical solution to control the Zeeman field in FFC experiments. The PI controller changes the command voltage u C(t) of the IGBT minimizing the error e(t) between the Hall sensor output u Hall(t) and the reference signal r(t). The command voltage u C(t) is the sum of the proportional and integral correcting terms:

$$ {u}_{\mathrm{C}}={k}_{\mathrm{P}}\left[e(t)+\frac{1}{T_{\mathrm{I}}}{\int}_0^te\left(\tau \right)\mathrm{d}\tau \right] $$
(3)

where k P is the proportional gain, T I is the integral time, and

$$ e(t)=r(t)-{u}_{\mathrm{Hall}}(t) $$
(4)

Being the gain of the integral component given by \( {k}_{\mathrm{I}}=\frac{k_{\mathrm{P}}}{T_{\mathrm{I}}} \), as usual [20, 22].

A standard option is to use analog PI controllers to achieve fast switching of the current, i.e., the magnetic flux density [13]. This project aims to develop a digital PID controller, which can replace the analog version adding more flexibility in setting the control of the power supply of the relaxometer. Nowadays, it is possible to use user-friendly programmable solutions in order to change the settings of a digital control loop instead of changing the physical parts of its analog counterpart. A digital solution can be a strong contribution for spanning the specifications of the fast field cycling technique. The most promising enhancements behind the digital approach are to change the switching times and defining different magnetic field sequences, which are usually unpractical to implement with the analog approach.

3 Digital PID Controller

The implementation of a digital PID controller is based on a discrete algorithm that uses as reference the continuous time behavior of a PID controller [22, 23]:

$$ u(t)={k}_{\mathrm{P}}\left[e(t)+\frac{1}{T_{\mathrm{I}}}{\int}_0^te\left(\tau \right)\mathrm{d}\tau +{T}_{\mathrm{D}}\frac{\mathrm{d}}{\mathrm{d}t}e(t)\right] $$
(5)

Considering that the continuous time PID controller behavior can be expressed by finite differences approximations, the behavior of discrete time PID controller can be expressed by:

$$ u\left({t}_k\right){=}u\left({t}_{k-1}\right){+}{k}_{\mathrm{P}}\left[e\left({t}_k\right){-}e\left({t}_{k-1}\right)\right]{+}{k}_{\mathrm{I}}e\left({t}_k\right){+}{k}_{\mathrm{D}}\left[e\left({t}_k\right){-}2e\left({t}_{k-1}\right)+e\left({t}_{k-2}\right)\right] $$
(6)

Equation (6) is the Velocity Algorithm for a PID controller [22, 23], derived by approximating the first-order derivatives via backward finite differences, where the parameters of the controller are the gains \( {k}_{\mathrm{I}}=\frac{k_{\mathrm{P}}}{T_{\mathrm{I}}} \) and k D = k PT D.

3.1 Digital Control Chain

The digital control chain for an FFC solution needs to perform the following functionalities:

  • To read the output signal of a Hall sensor (magnetic flux density measurement).

  • To react to pulse signals (0–5 V TTL) that set the instant of the magnetic field transitions.

  • To generate the pulse signal that sets on the auxiliary power supply during the up-down magnetic flux density transition (Δt on).

  • To generate the IGBT gate signals suitable for the different operating modes of the power supply.

In this project, the PID controller is based on the Microchip ®dsPIC30F4013 digital signal controller. This processing unit incorporates several useful peripheral components, including 5 timers (16-bit resolution), 12-bit analog-to-digital converter (ADC), and an output compare module. For example, the ADC is used to acquire the Hall sensor output voltage. On the other hand, the dsPIC30F4013 does not incorporate a digital-to-analog converter (DAC) necessary to generate the analog output signal to command the IGBT. Therefore, a pulse width modulation (PWM) DAC will be implemented to overcome this issue.

However, this approach requires removing the high frequency components of the PWM signal by the implementation of an analog low-pass filter. Therefore, the control variable is the PWM duty cycle, and the analog output signal corresponds to a fraction of the pulse voltage. The digital control system configuration (with the inputs and outputs referred before) is represented in Fig. 4.

Fig. 4
figure 4

Digital control system configuration

The digital implementation requires the predetermination of the digital value of the reference signal r(t). The reference signal changes once a magnetic flux density transition is launched throughout the TTL pulses. When a TTL pulse corresponding to a down-up magnetic flux density transition is launched, the digital control system also generates the pulse signal that switches on the auxiliary power source (U aux). The power supply U aux is switched off when the magnetic flux density reaches the reference signal (measuring and AD converting the output signal of the Hall sensor feedback signal (u Hall)). During this process, the digital algorithm adjusts the PID output and therefore the IGBT gate voltage, minimizing the error between the signal u Hall and the magnetic flux density reference value r. Once an up-down TTL pulse occurs, the IGBT command voltage is set accordingly by the digital PID in order to observe a fast up-down transition and the required stability and accuracy for low magnetic field levels.

3.2 Control Operations

Generally speaking, a digital PID controller operates continuously reading signals from sensors, sampling and converting them to digital form by means of an analog-to-digital converter. The digital control signal is computed and then converted to an analog signal. The sequential operation is:

  1. 1.

    Wait for a clock interrupt.

  2. 2.

    Read the signal of the sensor.

  3. 3.

    Compute the control signal.

  4. 4.

    Update controller variables.

  5. 5.

    Send output to the actuator.

  6. 6.

    Repeat from 1.

The computation of the controller parameters must occur out of the main loop, to minimize the time delay.

The relaxometer power supply control system is implemented as an embedded application based on on-chip peripheral interrupts that initiate processes on CPU to deal with the events. For example, when an A/D conversion is completed, a signal is sent to the processor indicating that this event has occurred, demanding the interruption of the current code that the processor is executing. A timer is used to start the sampling and A/D conversion process at a desired frequency (25 kHz). Upward and downward transitions are determined by the change of state on specific input ports (RB4 and RB5), as illustrated in Fig. 5.

Fig. 5
figure 5

Field cycling sequence. Shown are the magnetic flux density B(t), the IGBT gate voltage u C(t), and the states on RB4 and RB5 pins

When a TTL pulse is detected on the input ports RB4 or RB5, a change notification (CN) interrupt request is generated and the interrupt service routine (ISR) is triggered, as represented in Fig. 6. In this interrupt handler the I/O ports are read, determining which pin was driven high. If PORTBbits.RB4=1, a down-up transition has been commanded (the magnetic flux density reference is set to high level) and the state of the RB6 pin changes to high in order to switch on the auxiliary power supply U aux. The magnetic flux density reference is set as a value corresponding to a high magnetic field. If PORTBbits.RB5=1, an up-down transition has been commanded and the output signal of the controller corresponds to a low magnetic flux density reference value.

Fig. 6
figure 6

Change notification (CN) interrupt service routine (ISR) flow chart

A transition to a high polarization field is dictated by a TTL pulse, which originates a change of state on input port RB4. Change notification ISR is executed, and it determines the digital reference value that is used in the control loop, by setting the value of γ. When RB4 pin is driven high (reading PORTBbits.RB4=1), its value is set to γ = 1.

Variable γ determines not only the control reference value used but also the PID parameters in the control calculations. CN ISR starts Timer5 and RB6 pin is driven high, leading the IGBT to the saturation region and turning on the auxiliary voltage supply. This way, a transition to a high polarization field can be accomplished within milliseconds.

Timer5 also limits the duration of the down-up transition, there is, the time interval during which high voltage is applied to the magnet in order to avoid damaging the IGBT.

Furthermore, an A/D sampling is enabled in the Timer4 ISR and the conversion of the Hall sensor analog signal starts. This interrupt handler compares the A/D converted signal to the high magnetic flux density reference value. PID control of the IGBT voltage gate starts when the control error is less than a threshold value ε 1. Otherwise, the control output signal is maintained at a high level. Consequently, the PWM duty-cycle is near 100% in the first control cycles during the upward transition.

Once the error is less than ε 1, the RB6 pin changes to the low status, switching off the auxiliary power supply U aux, and, from this point on, the PID algorithm takes into account and the control system output (i.e. the PWM duty cycle) is the output of the PID algorithm.

From the moment the high power supply is switched off, the control action is the result of the PID calculations. The control signal is the error between the magnetic flux density reference and the digital value returned by the ADC module, corresponding to the last measurement of the Hall sensor analog signal. PID controller is responsible for the adjustment of the PWM duty cycle. This action on the IGBT command signal must guarantee a fast-settling time, after an down-up field transition.

A transition to a low magnetic flux density level is dictated by a TTL pulse, detected on pin RB5. Changing the RB5 state (reading PORTBbits.RB5=1) initiates a change notification interrupt request to the processor. In the interrupt handler, variable γ is set as −1 and a constant low value is kept as the control output.

From the instant the processor executes the CN ISR, every single ADC measurement of the Hall sensor signal is compared to a low field reference value in the ADC interrupt handler.

If the value read from the Hall sensor is far from the low reference value, then the control output is kept a constant low value, allowing a fast up-down field transition. For this reason, in the first control cycles of the transition to a low relaxation field, the PWM duty cycle is constant and near the minimum value allowed in the IGBT conduction state.

Once the error is smaller than a threshold value ε 2, PID controller starts adjusting the PWM duty cycle, in order to settle the field on its final value.

After the downward transition, the control signal is formed from the error between the field reference and the digital value returned by the ADC module, corresponding to the last measurement of the Hall sensor analog signal. PID controller action on the IGBT gate voltage must guarantee a fast-settling time, after a downward field transition.

3.3 Experimental Setup

Figure 7 shows a conceptual scheme of the control system, with different conditioning stages and low pass filters necessary for this application.

Fig. 7
figure 7

Conceptual scheme simplified of the control system implemented

First, the PWM waveform is converted to an analog signal throughout a low-pass filter, followed by a conditioning stage, where amplification of the signal is done in such a way that it meets the requirements of the plant (IGBT gate). A Bessel low-pass filter was designed with a cut-off frequency of f c = 2.5 kHz for this purpose (Filter 1). On the other hand, an anti-alias low pass filter and a conditioning stage are placed between the Hall sensor and the A/D converter (Filter 2). This low-pass allows to reduce the higher-frequency noise components in the PWM analog signal. Noise components with a frequency much higher than the control system bandwidth can be aliased down, so that the closed-loop system responds to noise.

4 Experimental Results

The digital controller was tested replacing the main analog controller of the magnetic flux density in an FFC prototype relaxometer [24, 25].

As explained earlier, the duration of the upward and downward magnetic flux density transients needs to be faster compared with the relaxation times of the spin systems to reduce the energy transfer as much as possible during these time intervals. On the other hand, the duration of these transitions need to be adequately set in order to keep the alignment of the magnetization and avoid any transverse component in the magnetic field. Both conditions depend on the sample in study, but in terms of technical realization, the upward and downward switching times should be in the order of milliseconds (t on, t off ≈ 3 ms) [26].

In Fig. 8 is presented the evolution of the PWM waveform and magnetic flux density during a downward transition between high magnetic flux density level and a low magnetic flux density level.

Fig. 8
figure 8

Magnetic flux density and PWM waveform during a downward transition

As expected, the controller adjusts the PWM cycle in order to minimize the error between the magnet current level digital reference voltage and the Hall sensor feedback voltage. Figure 8 corresponds to the time instant that a downward transition is triggered and the digital reference of the controller changes to a predetermined lower value. PWM duty cycle is immediately reduced, stabilizing in a lower value corresponding to the IGBT gate voltage required, so that the magnetic flux density reaches the reference value.

Several sets of PID parameters were tested on the control system to obtain fast adiabatic field transitions to perform spin-lattice relaxation measurements. Table 1 presents the PID controller parameters for the upward and downward transitions. These parameters allowed obtaining fast and smooth magnetic flux density transitions, without changes in the magnetic flux density values in the steady-state regimes as showed in Fig. 9.

Table 1 PID parameters used for controlling the upward and downward transitions
Fig. 9
figure 9

IGBT command voltage and magnetic flux density in a complete field cycle

Several transitions of the magnet current and the magnetic field strength are presented in Fig. 10.

Fig. 10
figure 10

Magnet current and magnetic flux density during several transitions

Experimental results for a down-up and an up-down magnetic flux density transitions obtained with the proposed digital controller are shown in Figs. 11 and 12, respectively. A Bessel low-pass filter dimensioned for a cut-off frequency of 10 kHz was used in the PWM-DA converter to obtain these results (Filter 2). In these figures it is also possible to observe the IGBT gate signals during transitions between the B 0P and B 0E magnetic flux density levels.

Fig. 11
figure 11

Downward magnetic flux density transition

Fig. 12
figure 12

Upward magnetic flux density transition

These results are consistent for controlling the relaxometer power supply during the transitions. Besides being fast, the magnetic flux density transitions have to assure the repeatability of the measurements. By the results obtained (Fig. 10), these conditions are satisfied. The stability of the magnetic field and the reproducibility of the transitions are demonstrated when performing FFC experiments by observing a repetitive free induction decay signal (FID).

In order to assess the digital control system performance, the proton spin-lattice relaxation time T 1 is measured for two distinct samples using the developed solution to control the magnet current. These experiments were performed with the liquid crystal 5CB and the ionic liquid compound [BMIM]BF4. The liquid crystal 5CB is commonly used as a reference for testing and comparing the performance of relaxometer experimental setups [12]. The ionic liquid was used because it is one of the systems recently studied with this technique.

The FFC-NMR measurements quality depends on many factors other than the control system efficiency. A good adjustment of all the system components is crucial for the NMR detected signal and, overall, the FFC-NMR measurements quality. Therefore, measurements under the same conditions were performed with the same relaxometer, using both the analog and digital control systems to the power supply.

Table 2 compares the results obtained with each control system for a better assessment of the digital system performance. The analysis of the spin-lattice relaxation time measurements obtained with the analog and the digital control solutions shows that the results obtained with the digital approach are in line with the measurements performed with the analog controller.

Table 2 Results of the spin-lattice relaxation time measurements using digital and analog control systems

In the case of the 5CB liquid crystal, the slight differences are due to small frequency and temperature discrepancies between measurements with the digital control system than with the analog controller. These instabilities can produce transverse nuclear magnetization, lowering the magnitude measured, which should be the result of the longitudinal relaxation process only. Anyway, these results are compatible within the experimental error suggesting that the digital system can provide the magnetic flux density control as efficient as the analog implementation.

The experimental results obtained for the ionic liquid compound [BMIM]BF4 at a frequency of 300 kHz using the analog and digital controllers are similar, showing that the digital solution modulates the Zeeman Field as required by the FFC-NMR experimental technique.

5 Conclusions

FFC-NMR is a relaxometry technique that allows to perform spin-lattice relaxation studies in a wide range of frequencies. This technique involves having the sample in different fields B 0 at different times, which allows measuring the relaxation time T 1 related to a low field B 0E with a NMR signal sensitivity of a common high field measurement.

This technique has been developed setting strictly the dynamic characteristics of experimental setup. It requires to perform repetitive magnetic flux density cycles between with accurate steady-state regimes and with switching times within the 1–3 ms range a wide range of compounds. With this work, it is clearly demonstrated that a digital controller is capable of modulating the Zeeman field fulfilling the FFC-NMR requirements. This was accomplished using a programmable Microchip ®dsPIC microcontroller driving on-chip peripherals interfacing sensors and power electronic devices and designing additional filters. The program developed configures the microcontroller unit core and several peripherals required for the application. The sequence of control operation starts with a timer interrupt, enabling the analog-to-digital conversion of the signal from the Hall sensor placed near the sample inside the magnet. The result of this conversion is compared with a predetermined digital reference. The error difference between these two values is then minimized, as the PID algorithm adjusts the control system output.

The software and hardware designed under the scope of this work allow to fulfill the system requirements, mainly the required fast transitions between magnetic field levels. The experimental results consistently show that time duration of the transitions between magnetic field levels are within the milliseconds range.

Furthermore, the digital system developed was used to modulate the Zeeman field while measuring the relaxation time T 1 of the liquid crystal 5CB and the ionic liquid [BMIM]BF4. The exponential decay of the nuclear magnetization was observed and the related time constant was determined for each case. The results obtained show that the digital approach can be integrated in an FFC relaxometer power supply system.