3. System Design
The proposed system is designed to support in total up to 16 user-selectable MOX sensors. To avoid parasitic capacitance, leakage current, and achieve low noise operation, it was decided to place the sensors as close as possible to the input of the measurement circuit. This key requirement leads to the design decision to create a modular ring-shaped embedded system, designed around a water-cooled measurement chamber which provides the space for up to 16 sensors. Since the measurement circuitry is slightly influenced by the surrounding temperature, it was decided to equip the chamber with an active water cooling system. It prevents the heat from the sensors from reaching the printed circuit board of the measurement circuit. The system consists of a mainboard that manages power distribution, power supervision, and communication with up to eight sensor modules, which provide the interface for a maximum of two MOX sensors.
As shown in
Figure 1, the mainbord’s shape is a circle with an outer diameter of 96 mm and an inner diameter of 64 mm wrapping around a custom-designed, eight-sided measurement chamber. The eight sockets for the sensor modules are placed along a circular path with an angle of
. A mirrored copy of the mainboard’s shape, created with a 3D printer, is used to affix the sensor modules on the backside of the system.
The core circuitry follows the same design and reliability principles as shown in our previous work [
17] and is hence not described in detail. The central power line is protected against over-voltage, under-voltage, and reverse-voltage conditions by the the commercially available supply protection chip LTC4365 [
18]. Additional continuous supervision of the system’s main voltage and current (V
SYS and I
SYS) is realized by the LTC2945 [
19] power monitor, which provides a user-programmable shutdown option on top of the hardwired absolute maximum supervision performed by the LTC4365.
The main
-controller STM32F410 [
20] connects the internal system communication (1 MHz I
2C bus), with the external USB (Virtual Com Port) communication. The controller is electronically isolated from the remaining mainboard components and sensor modules, protecting the attached computer (and vice versa the system) in the case of a critical electrical failure. Furthermore, the isolation provides a very effective protection against noise introduced by the USB bus. This isolation is implemented with the ADUM1250 chip [
21].
To keep the interface connector for the sensor modules as small as possible, only the I2C lines and the main power line VSYS and system ground GNDSYS are used. There are no additional addressing lines included, requiring each sensor board to have a unique I2C addresses coded in the firmware.
A sensor module implements the readout and heater circuit for two MOX sensors. A built prototype with a simplified block diagram that depicts the essential components is shown in
Figure 2. The heater circuit is based on a well-tested design from a previous work [
17] built with the LTC3600 [
22] buck down converter in conjunction with the aforementioned LTC2945 and is therefore not further elaborated here. Communication and data transfer to the master, measurement operation, and temperature management is coordinated by a central STM32L433CC [
23] microcontroller. The wide-range resistive readout is realized with the DDC112 [
24] current-to-digital chip from Texas Instruments.
The DDC IC series [
24] from Texas Instruments is a highly integrated current-to-digital converter, originally designed for computer tomography applications. The chip offers, depending on the model, multiple channels with selectable integration ranges connected to an internal high precision 20-Bit analog-to-digital converter (ADC). The chosen DDC112 provides two input channels, which are sampled simultaneously. Current is integrated for a user-selectable integration time
TInt and the digitized 40-Bit data word is provided by an Serial Peripheral Interface (SPI) compatible interface.
To deliver continuous measurements, each channel consists of two identical integrators: Side A and Side B. While Side A accumulates the current, the value of Side B is digitized and vice versa. The chip has seven internal integration ranges from 50 to 350 pC and can be extended by an additional range, for up to approximately 1000 pC of charge, which is achieved with four external capacitors.
The DDCs nominal analog supply voltage is 5 V, and, since it is not equipped with a dedicated digital power interface, a voltage translator for the conversion between the DDC signals and the microcontroller’s 3.3 V power supply is needed. In the proposed design, the Octal Bus Transceiver SN74LVC4245A [
25] is used for the necessary signal-level matching. Since certain (input) pins of the microcontroller are 5-V tolerant, not all signals need to be shifted.
To extend the measurement range, the chip can be connected to four external capacitors (one capacitor per channel and side). According to the manufacturer, the external integration capacitors should have low voltage coefficient, temperature coefficient, memory, and leakage current. The used 270 pF ± 2% Type AVX Corporation 06035A271GAT2A capacitors comply with these requirements and are therefore used in the design.
The integrator needs a system clock that drives all internal acquisition and conversion circuits. Depending on the chip’s model, the nominal clock speed is either 10 or 15 MHz. In the design, the 15 Mhz clock is generated by the microcontroller’s internal PLL (Phased Locked Loop) circuit and level-shifted to 5 V.
A final important component for the correct function of the DDC is an external voltage reference, with a nominal voltage of
V. The integration capacitors are charged to
at the beginning of each conversion cycle, and then depleted proportionally to the flowing current. It is very important that the reference is stable during the different operations, which are charging the capacitors and supplying reference charge to the internal ADC when converting. In the design, we decided to use a chip type REF6141 from Texas Instruments [
26] because of its high current output, very fast load regulation, and good accuracy.
The chip offers a test mode that injects roughly 13 pC of (cumulative) charge into the selected range each time the IC’s test-pin is toggled. The mode is used to check the system’s health and calibration. It is performed every time the system boots up. If the check is successful, the system switches to normal measurement operation mode. Otherwise, an error is issued using a status LED.
While the chip performs very well and can easily be used, the DDC has some shortcomings which have to be addressed before using it for the targeted application; the range cannot be individually chosen per channel and the same applies to the integration time TInt. Furthermore, the chip has a minimal integration time TIntMin of 333 s in continuous measurement mode, which results from the time needed to convert the data and additional overhead time for resetting the capacitors and side-switching. TIntMin is dependent on the chips main clock and the 333 s only apply for a system clock speed of 15 MHz. To address these shortcomings, we developed an optimized algorithm, which is presented below.
To provide the best flexibility and extensibility for future research, it was decided to implement a user-selectable sensor excitation voltage V
ex for each sensor. It is generated by an external dual-channel 12-Bit digital-to-analog converter (DAC) type AD5627R [
27]. Each of its two independent output channels is connected to an active second-order low-pass filter in Sallen-Key topology with a cutoff frequency of 5 Hz. The user can select voltages from 0.1 to 2.5 V with a 12-Bit amplitude resolution. The generated voltage is continuously read by the microcontroller’s internal ADC for regulation and self-diagnostic purposes. The AD5627’s internal high precision reference voltage is also used as an external voltage reference for the microcontroller’s analog circuitry. The excitation voltage circuit is depicted on the left side of
Figure 3.
The central microcontroller of type STM32L433 is used to generate the integration signal using a PWM signal. It generates the main 15 MHz clock for the DDC112, sets the integration range (0–7) using three general purpose input–output (GPIO) lines, reads the digitized data from the DDC112 over SPI, converts the data to the corresponding resistance, and sends them to the mainboard upon request. The controller’s firmware also implements the aforementioned measurement algorithm, which manages best range selection, integration time optimization, and channel-switching. Furthermore, it supervises and regulates the two heater power supplies and the two sensor excitation voltages, generated by the AD5627R.
The firmware implements the readout algorithm; manages the heater control and supervision; stores system parameters, e.g., calibration data, sensor descriptions, etc.; and handles the internal system communication via I2C. From the complex firmware functions, here, only the algorithms for the measurement and the calibration are described in the following.
Since the DDC chip has two independent channels, but only supports global integration time and range selection, having two possibly very different sensor values requires a dedicated algorithmic action to support such scenarios. The implemented algorithm is designed to always favor the highest possible integration time for low noise operation. This, however, directly affects the maximal sampling speed of the system if large resistances are connected. To achieve a minimal (continuous) sample rate of approximately 3 Hz, the highest integration time calculated by the algorithm is therefore limited to 100 ms.
Because of variances in absolute capacitance, variant thermal exposition, and slightly different trace lengths outside the IC package, the use of the external capacitors degrades the accuracy of the measured values and increases the noise. Hence, the algorithm tries to avoid the use of the external capacitors and only uses them if absolutely indispensable, which is the case for resistive values smaller than 100 .
Since the DDC112 has a minimal integration time (in continuous mode) of
s and its maximal internal integration range
is 350 pC, the minimal resistance that can be measured with a constant sensor excitation voltage
V is given in Equation (
1) and has to be greater than 476 k
. The minimal resistance that can be measured by using external capacitors
with ≈270 pC according to Equation (
2) has to be greater than 157 k
. The fixed factor of 0.96 in the equation is a given by the hardware and allows the front end integrators to reach fullscale without having to completely swing to ground. To guarantee that the algorithm always terminates, a resistor satisfying Equations (
1) and (
2)
= 200
is placed in series to the actual resistor that is to be measured.
Although there is theoretically no upper limit for the maximal measurable resistance, the algorithms quality settings and physical board parameters, especially current leakage, in fact impose one. A minimum charge of 20% of the smallest integration range (10 pC) is required for a valid low noise measurement. Using the default excitation voltage of 0.5 V, the effective maximal resistance is given by Equation (
3) and should be smaller than 5
. However, if required for research, excitation voltage, as well as integration time, can be manually chosen by the user, therefore reaching much higher resistances.
The measurement algorithm is presented in the flowcharts in
Figure 4 and
Figure 5. The system is initiated with the highest internal integration range (350 pC) and maximal integration time (100 ms). The continuous measurement is started by configuring the range (three GPIO lines representing a Bit pattern from 0–7), and then the first measurement is triggered by providing the integration signal (CONV) to the DDC112. It is generated by a 32-Bit timer of the microcontroller, operating in PWM (Pulse Width Modulation) mode. It produces a square wave with a fixed duty cycle of 50%, and its frequency is equal to half of the desired integration time. The PWM frequency change is encapsulated in a non-blocking subroutine called Start Measurement, which takes the desired integration time as a parameter.
After the first measurement is started, the microcontroller enters the main loop where it waits for events such as data-ready event or master-read requests.
The data-ready event indicates that the DDC finished a conversion, which can now be downloaded. It is signaled to the microcontroller by the DDC112’s DVALID line, generating an interrupt, which sets the data-ready flag. The event then triggers the data download over the SPI interface. In addition to the raw data, the integrator side (A or B) that converted the current value is stored (this information is obtained by the polarity of the PWM signal). Once the transmission completes, the DDC112 Evaluate Measurement function is called. The subroutine starts by converting the raw ADC ticks to a corresponding charge according to , where QFS is the full scale (FS) charge (Q) in picocoulomb (pC) of the currently selected range. The acquired charge is then checked against the algorithms setting for optimal range at the highest possible integration time.
If the acquired charge is larger than 95%
QFS and a larger range is available, the range is changed and the measurement with the same integration time is repeated. The algorithm only starts reducing the integration time if no larger range is possible. Therefore, it checks if the current integration time is larger than the smallest integration time. If that condition is true, it reduces the time by half and repeats the measurement. If, however, the current measurement time is already equal to the smallest integration time, the channel is flagged as erroneous and the channel is switched. This should not happen as long as Equations (
1) and (
2) are satisfied.
If the charge is smaller than 95% of QFS, the algorithm checks if a smaller stage is available and that the charge is smaller than 95% QFS of that smaller range. Further, whether the current integration time is equal to the maximal time is checked. If all these conditions are met, the range is switched and the measurement is repeated. If only one of the conditions is not met, the else clause is executed, in which the integration time is reevaluated based on the acquired charge, and, if a better time that differs to the current one by more than 500 s is found, a new measurement with that new integration time is initiated. Otherwise, the resistance is calculated, the channel marked as captured, and the non-blocking Switch Channel function called.
Following the return of the channel switching subroutine, the program checks if both channels have been captured. If this is the case, the global “Resistance Available” flag is set. If both channels have not been captured yet, the subroutine ends and returns to the main loop, where the status of the “Resistance Available” flag is checked, and, depending on its state, the new values are prepared for asynchronous transmission to the master. Following that, a new measurement is always started and the cycle begins again.
In the case of the algorithm failing, the system is flagged with an unrecoverable error and informs the user. Such a scenario, for example, is triggered by not installing a sensor element so that there is no current to be integrated.
A calibration is performed every time the system starts up, or at user request. The calibration uses the DDCs Test pin (TP), which injects a fixed charge packet of ≈13 pC each time the voltage at the pin is toggled. It should be noted that there is a slight offset of about 0.2 pC between the two integrator Sides A and B, only occurring in the test mode. Because this is well known and documented by the manufacturer, it can be corrected by a simple subtraction. With our limited number of chips, we were able to measure a deviation of ≈±0.005 pC to the specified offset. Since the multiple injections are cumulative, they can be used to create multiple charge-packets for a multi-point calibration.
The charge injection is implemented by a timer in One-Pulse mode that is triggered by the timer that generates the integration signal CONV. Using the repetition counter option, the injection can be repeated as often as needed. The calibration is performed for each integration range at three points: low, medium, and high. Starting with the low point, always consisting of a single charge of 13 pC, followed by a several accumulating packages representing about mid-scale QFS, and finally a charge of about 90% of the range’s full-scale, the calibration is performed. For each point the measured value is evaluated and correction factors, representing the deviation from the ideal injected values, are calculated and stored. These factors can later be used to correct the actual measurements. By default, the calibration and corrections are applied, this, however, can be changed by the user if desired.
In addition to the measurement, the firmware implements the I2C communication with the master. The protocol is based on simple commands with optional data structures. Depending on the user request, either a full status packet with all available debug information or a small, and therefore fast, packet containing only the two resistive values along with their respective heater voltages and currents can be downloaded.
The firmware also implements a user page, a section in the CPU’s flash memory that is kept, even if the firmware is updated. In this page, system information such as the module’s I2C address, parameters for the heater’s PID regulation algorithm, sensor information (e.g., sensor name, installation date, etc.), and various other parameters are stored. Further, the quality settings for the algorithm, e.g., maximal integration time, setting to use the external integration range, etc. are stored here.
The external communication with the complete system is based on a Virtual COM Port (VCP) over the USB interface and is implemented in the firmware of the mainboard. The VCP option enables the system to be used without specific driver software on any operating system such as Windows, Linux, or macOS and the easy-to-use protocol provides a fast and seamless integration into existing measurement management tools such as LabView.