USD

Use a Low-Power Sensor AFE to Implement a High-Precision Chemical Or Biological Sensing System

By Stephen Evanczuk

Contributed By Digi-Key's North American Editors

Facing a growing demand for more precise biological or electrochemical sensing, developers have found few effective sensor signal chain solutions able to provide both the accuracy and flexibility to support diverse requirements. The need to deliver these capabilities in compact form at low power further complicates matters and undermines design schedules.

Without accurate sensor signal acquisition and conditioning, efforts to measure noisy, small-signal sources associated with biological and chemical sensing applications can result in significant errors. In biological applications such as monitoring human vital signs or chemical applications such as toxic gas detection, false positives or false negatives due to measurement errors can have disastrous consequences.

This article will show that with its support for a wide range of 2, 3, and 4-wire sensing applications, an Analog Devices precision analog front-end (AFE) provides a simple, effective solution. By simply programming its configuration and operational capabilities, developers can use the AD5940 to rapidly implement ultra-low-power designs able to meet diverse requirements for accurate biological or electrochemical sensing.

Applications for biological and chemical sensing systems

Measuring changes in impedance, voltage, or current across the human body or from an electrochemical source has emerged as an important capability for many applications. The ability to identify stress indicators through measurement of electrodermal activity (EDA), previously called galvanic skin response (GSR), provides an important clue to health professionals about an individual's psychophysiological states. If left untreated, chronic stress and anxiety can lead to cardiac problems and other serious physiological pathologies.

Other types of measurement such as bioimpedance analysis (BIA) are also finding increased application in consumer products for health and fitness as well as medical grade analysis. Used for years in body composition devices, BIA is finding increasing interest from medical experts for its use as a non-invasive technique for blood pressure measurement. Using a related method that measures small current changes in electrochemical sources, medical device specialists are using these measurements to provide more effective blood glucose monitors and other devices. Similarly, industrial engineers can use these same electrochemical measurement methods in applications such as toxic gas monitors and water quality testers.

These measurement techniques and others share common features such as the use of electrodes placed on the skin or within a fluid specimen. Yet, the details of their implementation are sufficiently different to complicate a developers' ability to find one solution able to span the breadth of requirements.

EDA measurement, for example, requires a low-frequency excitation source, typically no more than 200 hertz (Hz), designed to limit penetration of the excitation signal to deeper layers of human tissue. Usually implemented with a two-wire circuit, the source voltage across a patch of skin between a pair of electrodes induces a small current that fluctuates with changes in epidermal conductivity.

In contrast, a BIA measurement usually requires a four-wire circuit that combines low frequency excitation with high-frequency excitation (typically 50 kilohertz (kHz)) to reach deep tissue layers.

Electrochemical measurements typically require yet another configuration. These measurements combine a working electrode which is involved with some chemical reaction of interest, with a reference electrode used to maintain a constant potential, and a counter electrode that completes the current loop.

Various solutions for these different measurements have emerged over the years, yet few efficient alternatives provide the ability to support the varied requirements of these techniques. Using the Analog Devices AD5940BCBZ-RL7 AFE, developers can more easily implement biological and electrochemical sensing systems able to combine demand for high accuracy, small size, and low power consumption.

Integrated AFE

The AD5940 is a low-power, multifunction AFE that can be programmatically configured to support a wide variety of applications requiring 2, 3, or 4-wire sensor measurements. By combining the AD5940 with a suitable complement of electrodes, high-precision devices able to meet the diverse measurement requirements of applications in health, medical, and industrial segments can be rapidly developed.

Along with its configurability and accuracy, the AD5940 consumes less than 80 microamps (µA) at an output data rate of 4 Hertz (Hz), enabling developers to build its measurement capabilities into emerging ultra-low-power products such as wearables and other battery-powered devices. At the same time, the AD5940 simplifies design by integrating a full complement of subsystems required for high-precision voltage, current, and impedance measurement (Figure 1).

Diagram of Analog Devices AD5940Figure 1: The Analog Devices AD5940 combines a complete set of subsystems required to generate excitation sources and measure current, voltage, and impedance. (Image source: Analog Devices)

The AD5940 functional architecture comprises three primary subsystems for excitation output, input signal measurement, and control.

As an excitation source, the AD5940 provides two separate high-precision excitation loops. For applications such as BIA that require high-frequency excitation up to 200 kHz, developers can use a high-bandwidth loop that is able to produce an excitation signal at the desired frequency and waveform shape. Within this loop, a waveform generator drives a high-speed, 12-bit digital-to-analog converter (DAC), whose filtered output in turn passes through a programmable gain amplifier (PGA) that drives the excitation output amplifier, which combines the AC excitation signal with the sensor's required DC bias voltage (Figure 2).

Diagram of Analog Devices AD5940 high-speed signal chainFigure 2: For high-frequency excitation requirements, developers can use the Analog Devices AD5940 high-speed signal chain to generate waveforms of different shapes and frequencies up to 200 kHz. (Image source: Analog Devices)

For applications such as EDA or electrochemical measurements that require low-frequency excitation from DC up to 200 Hz, developers can use a low-bandwidth excitation loop. In this loop, a low-power, dual-output 12-bit DAC drives the non-inverting input of a low-noise potentiostat amplifier (PA), typically connected to the counter electrode (CE) in a 3-wire sensor configuration (Figure 3).

For this configuration, the measurement loop completes with the reference electrode (RE) driving the PA's inverting input, while the sense electrode (SE) drives the inverting input of a low-power transimpedance amplifier (TIA), whose non-inverting input is driven by the other output channel of the dual-output DAC.

Diagram of Analog Devices AD5940 low-bandwidth loopFigure 3: For 3-wire sensor configurations that require low-frequency excitation, the Analog Devices AD5940 low-bandwidth loop includes a PA whose output connects to the CE and whose input connects to the RE, while a low-power transimpedance amplifier (LPTIA) receives input from the SE. (Image source: Analog Devices)

Like the low-bandwidth loop, the high-bandwidth loop complements its high-frequency excitation signal chain with a high-speed TIA for converting the SE input current to voltage. Both loops in turn drive their respective outputs to the AD5940's integrated analog multiplexer that serves the input signal measurement subsystem.

At the heart of the signal measurement subsystem, a high-performance analog signal chain combines a signal conditioning stage comprising a buffer, a PGA, and a 2nd order filter that feeds a 16-bit successive approximation register (SAR) analog-to-digital converter (ADC) (Figure 4).

Diagram of Analog Devices AD5940 signal-measurement subsystemFigure 4: Within the AD5940 signal-measurement subsystem, an analog multiplexer enables developers to drive different voltage sources through a signal conditioning stage for conversion by a high-performance 16-bit ADC. (Image source: Analog Devices)

Using the analog input multiplier, developers can feed the ADC signal chain with different signal sources including the internal temperature sensor, supply and reference voltages, and other external sources. For a typical application, the primary signal sources for sensor data collection will remain the low-power TIA and high-speed TIA outputs from the low-bandwidth and high-bandwidth loops, respectively.

After conversion, separate functional blocks provide further post processing including digital filtering and automatic calculation of average, mean, and variance from a sample set. Beyond those more basic functions, the AD5940 post-processing hardware includes a discrete Fourier transform (DFT) unit. With this DFT capability, developers can configure the AD5940 to automatically calculate magnitude and phase values needed in impedance measurements.

The third major subsystem controls operation of the device including generating specific excitation sources, converting different voltage sources, and performing post-processing functions. At the foundation of this control subsystem, a programmable sequencer enables developers to generate excitation and perform sensor measurements without involvement of the host microcontroller or microprocessor.

After using the host processor to load a sequence of commands into the AD5940, developers simply issue a command to start the AD5940 sequencer and then immediately place the host processor in a low-power sleep state using a Wait for Interrupt (WFI) instruction or other method. From that point, the sequencer takes over further control of the AD5940, independently performing a series of measurements and even placing the device in a low-power mode between measurements (Figure 5).

Diagram of Analog Devices AD5940 programmed to operate independently even after a power-on-resetFigure 5: Developers can program the AD5940 to operate independently even after a power-on-reset by loading values during a boot process, initializing the device, loading a sequence of commands, and finally running the sequencer. (Image source: Analog Devices)

During autonomous operations controlled by the sequencer, the AD5940 reads commands from a first-in, first-out (FIFO) command buffer and writes resulting data to a FIFO data buffer. Both the command and data FIFO buffers share the same block of 6 kilobytes (kB) allocated from the AD5940's integrated static random-access memory (SRAM), but the two FIFO buffers remain operationally separate. As the command FIFO buffer empties or the data FIFO buffer fills, the AD5940 can be programmed to generate an interrupt to the host processor to load additional sequences or unload data as appropriate.

System design

From both hardware and software perspectives, development with the AD5940 is straightforward.

Because it fully integrates the required hardware subsystems, the AD5940 enables developers to implement complex designs such as 4-wire BIA measurement loops with only a minimal set of external components. Developers can configure the AD5940 low-bandwidth loop to handle the required low-frequency measurements using two of the device's analog input (AIN) ports, AIN2 and AIN3 (Figure 6). At the same time, they can use the device's CE0 and AIN1 ports to implement the high-frequency excitation and measurement also required for BIA applications.

Diagram of Analog Devices AD5940 to implement four-wire configurationsFigure 6: Using the Analog Devices AD5940, developers need only a few external components to implement four-wire configurations with both low-frequency and high-frequency excitation required in body impedance analysis applications. (Image source: Analog Devices)

A set of Analog Devices evaluation boards lets developers skip this minimal hardware interface design step for rapid development projects. Designed with the Arduino UNO form factor, the Analog Devices EVAL-ADICUP3029 evaluation kit base board provides a host platform based on the Analog Devices ADUCM3029 microcontroller. By attaching the AD5940 bio-electric shield, developers can immediately begin using the AD5940 to perform biological measurements like BIA. Alternatively, developers can attach the AD5940 electrochemical shield and add external sensors such as gas sensors to perform toxic gas analysis based on AD5940 electrochemical measurements.

Developers can just as quickly use available resources to evaluate different AD5940-based software applications. Along with its open-source C-language AD5490 firmware library, Analog Devices provides an open-source repository containing a number of C-language application examples including a body impedance analysis sample application.

As shown in Listing 1, the main routine, AD5940_Main(), in the BIA module calls a series of initialization functions:

  • AD5940PlatformCfg() is an AD5490 firmware library function that sets up AD5940 hardware subsystems including the FIFO, clock and GPIOs.
  • AD5940BIAStructInit() is a BIA application function that instantiates a structure with values that developers can modify to easily change application parameters such as sample output data rate (BiaODR) in hertz (Hz) and number of samples (NumOfData).
  • AppBIAInit() is a BIA application function that resets parameters, performs calibration, and initializes the sequencer with a call to another BIA application routine, AppBIASeqCfgGen().
Copy
/* !!Change the application parameters here if you want to change it to none-default value */
void AD5940BIAStructInit(void)
{
  AppBIACfg_Type *pBIACfg;
  
  AppBIAGetCfg(&pBIACfg);
  
  pBIACfg->SeqStartAddr = 0;
  pBIACfg->MaxSeqLen = 512; /** @todo add checker in function */
  
  pBIACfg->RcalVal = 10000.0;
  pBIACfg->DftNum = DFTNUM_8192;
  pBIACfg->NumOfData = -1;      /* Never stop until you stop it mannually by AppBIACtrl() function */
  pBIACfg->BiaODR = 20;         /* ODR(Sample Rate) 20Hz */
  pBIACfg->FifoThresh = 4;      /* 4 */
  pBIACfg->ADCSinc3Osr = ADCSINC3OSR_2;
}
 
void AD5940_Main(void)
{
  static uint32_t IntCount;
  static uint32_t count;
  uint32_t temp;
  
  AD5940PlatformCfg();
  
  AD5940BIAStructInit(); /* Configure your parameters in this function */
  
  AppBIAInit(AppBuff, APPBUFF_SIZE);    /* Initialize BIA application. Provide a buffer, which is used to store sequencer commands */
  AppBIACtrl(BIACTRL_START, 0);         /* Control BIA measurment to start. Second parameter has no meaning with this command. */
 
  while(1)
  {
    /* Check if interrupt flag which will be set when interrupt occured. */
    if(AD5940_GetMCUIntFlag())
    {
      IntCount++;
      AD5940_ClrMCUIntFlag(); /* Clear this flag */
      temp = APPBUFF_SIZE;
      AppBIAISR(AppBuff, &temp); /* Deal with it and provide a buffer to store data we got */
      BIAShowResult(AppBuff, temp); /* Show the results to UART */
 
      if(IntCount == 240)
      {
        IntCount = 0;
        //AppBIACtrl(BIACTRL_SHUTDOWN, 0);
      }
    }
    count++;
    if(count > 1000000)
    {
      count = 0;
      //AppBIAInit(0, 0);    /* Re-initialize BIA application. Because sequences are ready, no need to provide a buffer, which is used to store sequencer commands */
      //AppBIACtrl(BIACTRL_START, 0);          /* Control BIA measurment to start. Second parameter has no meaning with this command. */
    }
  }
}

Listing 1: In the Analog Devices body impedance analysis (BIA) sample application, the main routine demonstrates the basic design pattern for initializing the AD5490, setting custom parameters, defining a command sequence, and finally collecting measurement results within an endless loop that waits for an interrupt from the AD5490. (Code source: Analog Devices)

When it is called by the AppBIAInit() function, AppBIASeqCfgGen() does the heavy lifting in configuring the AD5940 subsystems required to perform the desired sequence (impedance measurement in this case). This routine instantiates a series of structures defined in the AD5940 firmware library header file, ad5940.h, that set the specific configurations and parameters required for each application.

Finally, AD5940_Main() calls AppBIACtrl() to start the measurement process before entering an endless loop used to collect data. As data becomes available (as indicated by an interrupt signal), a call to AppBIAISR() pulls data if available from the device and invokes another routine, AppBIADataProcess(), which processes the raw data to generate the results required by the application (Listing 2). In a production application, developers can use the AD5940's extensive interrupt features to create more efficient data collection methods.

Copy
/* Depending on the data type, do appropriate data pre-process before return back to controller */
static AD5940Err AppBIADataProcess(int32_t * const pData, uint32_t *pDataCount)
{
  uint32_t DataCount = *pDataCount;
  uint32_t ImpResCount = DataCount/4;
 
  fImpPol_Type * const pOut = (fImpPol_Type*)pData;
  iImpCar_Type * pSrcData = (iImpCar_Type*)pData;
 
  *pDataCount = 0;
 
  DataCount = (DataCount/4)*4;/* We expect RCAL data together with Rz data. One DFT result has two data in FIFO, real part and imaginary part.  */
 
  /* Convert DFT result to int32_t type */
  for(uint32_t i=0; i<DataCount; i++)
  {
    pData[i] &= 0x3ffff; /* @todo option to check ECC */
    if(pData[i]&(1<<17)) /* Bit17 is sign bit */
    {
      pData[i] |= 0xfffc0000; /* Data is 18bit in two's complement, bit17 is the sign bit */
    }
  }
  for(uint32_t i=0; i<ImpResCount; i++)
  {
    iImpCar_Type *pDftVolt, *pDftCurr;
 
    pDftCurr = pSrcData++;
    pDftVolt = pSrcData++;
    float VoltMag,VoltPhase;
    float CurrMag, CurrPhase;
 
    VoltMag = sqrt((float)pDftVolt->Real*pDftVolt->Real+(float)pDftVolt->Image*pDftVolt->Image);
    VoltPhase = atan2(-pDftVolt->Image,pDftVolt->Real);
    CurrMag = sqrt((float)pDftCurr->Real*pDftCurr->Real+(float)pDftCurr->Image*pDftCurr->Image);
    CurrPhase = atan2(-pDftCurr->Image,pDftCurr->Real);
 
    VoltMag = VoltMag/CurrMag*AppBIACfg.RtiaCurrValue[0];
    VoltPhase = VoltPhase - CurrPhase + AppBIACfg.RtiaCurrValue[1];
 
    pOut[i].Magnitude = VoltMag;
    pOut[i].Phase = VoltPhase;
  }
  *pDataCount = ImpResCount; 
  /* Calculate next frequency point */
  if(AppBIACfg.SweepCfg.SweepEn == bTRUE)
  {
    AppBIACfg.FreqofData = AppBIACfg.SweepCurrFreq;
    AppBIACfg.SweepCurrFreq = AppBIACfg.SweepNextFreq;
    AD5940_SweepNext(&AppBIACfg.SweepCfg, &AppBIACfg.SweepNextFreq);
    AppBIACfg.RtiaCurrValue[0] = AppBIACfg.RtiaCalTable[AppBIACfg.SweepCfg.SweepIndex][0];
    AppBIACfg.RtiaCurrValue[1] = AppBIACfg.RtiaCalTable[AppBIACfg.SweepCfg.SweepIndex][1];
  }
  return AD5940ERR_OK;
}

Listing 2: Included in the Analog Devices body impedance analysis (BIA) sample application, the AppBIADataProcess() routine illustrates how developers can use AD5940 measurement data in custom post-processing routines such as this one, which calculates voltage magnitude and phase. (Code source: Analog Devices)

For a more feature-rich solution for health and fitness wearables, for example, developers can combine the AD5940's impedance measurement capabilities with the Analog Devices’ AD8233 heart rate monitor (see "Specialty Heart-Rate Monitor ICs Overcome ECG Noise and Power Challenges").

Conclusion

With its support for a wide range of 2-, 3-, and 4-wire sensing applications, the Analog Devices AD5940 AFE provides a simple, effective solution to the problem of accuracy and flexibility for precise biological or electrochemical sensing. By simply programming its configuration and operational capabilities, developers can use the AD5940 to rapidly implement ultra-low-power designs able to meet the needs of diverse applications.

Disclaimer: The opinions, beliefs, and viewpoints expressed by the various authors and/or forum participants on this website do not necessarily reflect the opinions, beliefs, and viewpoints of Digi-Key Electronics or official policies of Digi-Key Electronics.

About this author

Stephen Evanczuk

Stephen Evanczuk has more than 20 years of experience writing for and about the electronics industry on a wide range of topics including hardware, software, systems, and applications including the IoT. He received his Ph.D. in neuroscience on neuronal networks and worked in the aerospace industry on massively distributed secure systems and algorithm acceleration methods. Currently, when he's not writing articles on technology and engineering, he's working on applications of deep learning to recognition and recommendation systems.

About this publisher

Digi-Key's North American Editors