Use a Microcontroller’s Functionality to Quickly Implement Analog Signal Chains in Compact Designs

By Stephen Evanczuk

Contributed By Digi-Key's North American Editors

Many designs for the Internet of Things (IoT) rely on analog circuits to meet an application's unique requirements for sensor and actuator signal conditioning, current control, and other functionality. Although dedicated signal chain ICs can meet this need, designs with tight cost and space constraints require a way to deliver this functionality with fewer parts, while still meeting performance requirements.

To address this need, microcontrollers have emerged that have simplified the nature of this sensor and actuator interface by integrating analog peripherals such as analog-to-digital converters (ADCs) and comparators. Until recently, however, engineers still typically needed to add analog parts to provide signal conditioning or output buffering required in most designs.

With the addition of these analog signal conditioning circuits on a microcontroller, developers now have an effective way to configure these components to meet a broad range of analog interface requirements for wearables and other IoT devices by manipulating only a few lines of code.

This article will discuss the need for front-end analog signal conditioning requirements for connected IoT devices. It will then introduce a class of microcontrollers with highly integrated analog functionality and show how to apply them.

Interfacing a sensor to a microcontroller

Sensor designs typically require one or two amplifiers to condition transducer output signals before reaching the microcontroller's ADC input. More complex devices such as pulse oximeters for heart rate monitoring require multiple signal chains to generate LED excitation waveforms, convert photodiode output, and finally extract the pulse data (Figure 1). Even the simple current loop circuit routinely used to connect sensors to programmable logic controllers in industrial applications requires additional devices to drive and control current output. However, by using the internal analog components in the Texas Instruments MSP430FR2355 MCU, developers can implement more compact versions of these designs, typically with only a few additional passive components.

Diagram of Texas Instruments MSP430FR2355 MCU

Figure 1: User expectation for additional sophisticated features in more compact products means that developers need to dramatically reduce parts count in implementing complex signal paths, such as this one for pulse oximeters. (Image source: Texas Instruments)

Integrated analog components

Based on a 16-bit RISC processor core, the Texas Instruments MSP430FR2355 MCU provides the full set of features typically required in many IoT device designs. A member of the TI MSP430 FRAM family, the MSP430FR2355 integrates 32 Kbytes of low-power ferroelectric RAM (FRAM). Well suited to IoT designs, FRAM provides the nonvolatile storage advantages of flash memory, as well as the write speed and endurance of RAM. As a result, developers can take advantage of FRAM's RAM-like performance qualities to store data and program code during active operation, while relying on FRAM's nonvolatile features to retain values during sleep mode or other operating states required to conserve power. The MSP430FR2355 supports several low-power modes designed to meet the low-power requirements typical of these designs.

Along with its low-power features, the MSP430FR2355 supports IoT interface requirements with several integrated analog peripherals including a 12-channel, 12-bit ADC; analog comparators with integrated digital-to-analog converters (DACs); and multiple on-chip voltage references. The most unique analog feature of the MSP430FR2355 MCU lies in its four Smart Analog Combo (SAC) modules, which developers can configure programmatically to meet their specific requirements.

Each SAC module includes a 12-bit DAC, a rail-to-rail operational amplifier (OA), and a feedback resistor ladder that turns the OA into a programmable gain amplifier (PGA). Dedicated registers for each component control its configuration and operating mode. For example, developers can simply load bits 0:1 in a SAC (SACx) module's OA register (SACxOA) to set the OA's positive input to some external source, to the DAC output, or to a paired SAC source (described below).

TI's driver library abstracts these bit manipulations to an intuitive set of application programming interface (API) calls. As a result, developers need only a few lines of code (Listing 1) to program a SAC module as a general purpose amplifier that can fully replace a sensor signal conditioning amplifier, with corresponding savings in parts count and design size (Figure 2).

Copy
//Select external source for both positive and negative inputs
SAC_OA_init(SAC0_BASE, SAC_OA_POSITIVE_INPUT_SOURCE_EXTERNAL, SAC_OA_NEGATIVE_INPUT_SOURCE_EXTERNAL);
 
//Select low speed and low power mode
SAC_OA_selectPowerMode(SAC0_BASE, SAC_OA_POWER_MODE_LOW_SPEED_LOW_POWER)
 
// Enable OA 
SAC_OA_enable(SAC0_BASE);
 
// Enable SAC 
SAC_enable(SAC0_BASE);

Listing 1: To implement a general-purpose amplifier, developers need only a few calls to the Texas Instruments driver library to initialize the SAC OA inputs (SAC_OA_init), set its power mode (SAC_OA_selectPowerMode) to low power in this case, and finally enable the OA and SAC itself. (Code source: Texas Instruments)

Diagram of Texas Instruments MSP430FR2355 MCU

Figure 2: Developers can replace an external op amp with one implemented internally in the Texas Instruments MSP430FR2355 MCU using one of the MCU's four Smart Analog Combo (SAC) modules. (Image source: Texas Instruments)

To serve as an output waveform generator, a SAC module needs to engage more of its components (Figure 3). In this case, the developer controls the waveform by programmatically loading data into the dedicated data register (SACxDAT) that sets the internal DAC's output. In turn, the DAC output provides the reference voltage to the OA. In this configuration, developers would enhance OA drive strength by setting bits 0:1 (MSEL) in the PGA register (SACxPGA) to buffer mode (01b), which corresponds to a floating input. To configure this operating mode, developers need only a few more API calls (Listing 2) compared those needed for the general purpose configuration described above.

Diagram of Texas Instruments SAC module's digital-to-analog converter

Figure 3: Developers can implement a programmable waveform generator using the SAC module's digital-to-analog converter and op amp components. (Image source: Texas Instruments)

Copy
//Select internal shared reference as DAC reference voltage
SAC_DAC_selectRefVoltage(SAC0_BASE, SAC_DAC_SECONDARY_REFERENCE);
 
//Select the load trigger for DAC data latch
//DAC always loads data from DACDAT at the positive edge of Timer output TB2.1 
SAC_DAC_selectload(SAC0_BASE, SAC_DAC_LOAD_DEVICE_SPECIFIC_0);
 
//Enable DAC Interrupt 
SAC_DAC_interruptEnable(SAC0_BASE);
 
//Write data to DAC Data Register SACxDAT
//DAC_data is an unsigned int type variable defined by user SAC_DAC_setData(SAC0_BASE, DAC_data);
 
//Enable DAC 
SAC_DAC_enable(SAC0_BASE);
 
//Select internal DAC for positive input and PGA source for negative input 
SAC_OA_init(SAC0_BASE, SAC_OA_POSITIVE_INPUT_SOURCE_DAC,
     SAC_OA_NEGATIVE_INPUT_SOURCE_PGA);
 
//Select Buffer Mode
SAC_PGA_setMode(SAC0_BASE, SAC_PGA_MODE_BUFFER);
 
//Enable OA 
SAC_OA_enable(SAC0_BASE);
 
//Enable SAC 
SAC_enable(SAC0_BASE);

Listing 2: To configure a SAC module as a waveform generator, developers need only a few additional API calls beyond those required for its use as a general purpose amplifier. (Code source: Texas Instruments)

Multiple stages

In many cases, developers need signal condition or output chains built with more than one amplifier. For example, sensor system designers typically cascade amplifiers to buffer transducer output and then to amplify the buffered signal to match the full-scale response of the ADC sitting at the end of the signal chain. Similarly, developers of output interfaces often need to cascade amplifiers to generate waveforms and control gate drivers. For example, to build a current loop interface, developers can use one SAC module configured in DAC mode to provide the modulating signal voltage. Configured in OA mode, the second SAC module converts the signal voltage into a current using an external transistor (Figure 4).

Diagram of Texas Instruments one SAC module in DAC mode and a second SAC in OA mode

Figure 4: To build a current loop interface, engineers use one SAC module in DAC mode to generate the modulated signal voltage and a second SAC in OA mode to drive a transistor, generating a loop current, ILOOP (I1 + I2). (Image source: Texas Instruments)

The MSP430FR2355 MCU provides an even more efficient method for cascading amplifiers. For designs that do not require additional external components, developers can take advantage of built-in routing that internally interconnects SAC modules into two pairs: SAC0 is internally connected to SAC2, and SAC1 to SAC3.

This interconnection finds application in sensor systems such as smoke detectors that need to convert current output from a photodiode to a voltage level for conversion. Developers can implement this signal chain using a pair of SAC modules with only a few lines of code (Listing 3). Here, SAC2 is configured as a transimpedance amplifier to convert photodiode current output to a voltage, which the paired SAC0 amplifies for a downstream ADC (Figure 5). As shown in Listing 3, the internal connection between SAC2 and SAC0 is created simply in the API call (SAC_OA_init) to initialize SAC0 (SAC0_BASE) using the PGA as the OA's negative input source (SAC_OA_NEGATIVE_INPUT_SOURCE_PGA) and the paired OA as the positive input source (SAC_OA_POSITIVE_INPUT_SOURCE_PAIR_OA).

Copy
    //Configure Op-Amp functionality
    GPIO_setAsPeripheralModuleFunctionInputPin(GPIO_PORT_P3,
                                               GPIO_PIN1 | GPIO_PIN3 | GPIO_PIN2,
                                               GPIO_TERNARY_MODULE_FUNCTION);
 
    //Select external source for both positive and negative inputs
    SAC_OA_init(SAC2_BASE, SAC_OA_POSITIVE_INPUT_SOURCE_EXTERNAL,
                SAC_OA_NEGATIVE_INPUT_SOURCE_EXTERNAL);
 
    //Select low speed and low power mode
    SAC_OA_selectPowerMode(SAC2_BASE, SAC_OA_POWER_MODE_LOW_SPEED_LOW_POWER);
 
    SAC_OA_enable(SAC2_BASE);                  // Enable SAC2 OA
    SAC_enable(SAC2_BASE);                     // Enable SAC2
 
    //Select external source for both positive and negative inputs
    SAC_OA_init(SAC0_BASE, SAC_OA_POSITIVE_INPUT_SOURCE_PAIR_OA,
                SAC_OA_NEGATIVE_INPUT_SOURCE_PGA);
 
    SAC_OA_enable(SAC0_BASE);                  // Enable SAC0 OA
    SAC_enable(SAC0_BASE);                     // Enable SAC0

Listing 3: Developers can create a two-stage signal chain simply by initializing a pair of the MSP430FR2355 MCU's SAC modules and specifying that the downstream stage's input uses the paired OA as its source (SAC_OA_POSITIVE_INPUT_SOURCE_PAIR_OA). (Code source: Texas Instruments)

Diagram of Texas Instruments one SAC module in DAC mode and a second SAC in OA mode

Figure 5: Developers can effectively eliminate the need for external analog ICs in a smoke detector design by configuring the MSP430FR2355 MCU's paired SAC modules to implement the transimpedance amplifier (TIA) and programmable gain amplifier (PGA) required in a typical smoke detector input signal chain. (Image source: Texas Instruments)

Using this approach, developers can implement nearly the full set of analog input and output circuits required in IoT designs and wearables. For example, developers can use MSP430FR2355 SAC modules to condense complex analog designs such as the pulse oximeter shown in Figure 1 to a significantly more compact version (Figure 6). Besides from the LEDs, photodiode, and associated resistors, designers need only the MCU to deliver the same functionality.

Diagram of Texas Instruments MSP430FR2355 MCU and its SAC modules

Figure 6: Developers can use the MSP430FR2355 MCU and its SAC modules to dramatically reduce parts count in designs such as pulse oximeters that require multiple output excitation sources and a multi-stage input signal chain. (Image source: Texas Instruments)

To evaluate use of the MSP430FR2355 MCU and its SAC modules, developers can take advantage of the Texas Instruments MSP-EXP430FR2355 LaunchPad development kit. Designed to speed prototyping, the board includes a complete MSP430FR2355-based system with a light sensor, LEDs, and pushbuttons for interacting with simple sample applications, and onboard debug probe for software development.

A Grove connector provides access to the broad array of available Grove-based add-ons, and a TI BoosterPack connector lets developers easily extend the base platform with RF BoosterPacks for wireless connectivity. TI also provides a set of sample software applications designed to run immediately on the LaunchPad kit. Besides exercising the LaunchPad board, the sample software demonstrates basic design patterns such as the method for interconnecting SAC modules shown in the Listing 3 code snippet.

Conclusion

Analog interfaces are commonly required in any device that interacts with the real world. In many designs for wearables and IoT devices, however, the additional devices needed to build those interfaces runs counter to the requirements for more compact designs and reduced parts count.

By configuring analog components integrated in the Texas Instruments MSP430FR2355 MCU, developers can implement the signal chain functionality required for these designs, often with only a few additional passive components.

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