Many embedded systems require precise current measurements, and different applications can be implemented by different sensors. Now the more current measurement sensors are used: light-emitting diodes, fuel sensors (output range from 10nA-20mA). Currently, current output sensors are more popular than voltage output sensors due to their higher noise range and the ability to use longer cables. This article describes a method for measuring multi-channel input current using an analog multiplexer.
There are many ways to measure current. One way is to use the current through a Resistor to measure the Voltage. The voltage across the Resistor can be obtained by Ohm’s law:
Here I is the current value of the current known resistance. The output voltage of the resistor can be converted to a digital value using an analog-to-digital converter ADC. There are different ADC types such as Delta sigma, single-ended or differential successive approximation (SAR). Figure 1 shows a simple way of measuring the voltage across a shunt resistor with a microprocessor and analog-to-digital converter. If the ADC input voltage range is limited, and precision measurements are required, then a more accurate Amplifier is required.
The current value is obtained by dividing the voltage measured by the ADC by the resistance. The tighter the resistance tolerance, the higher the resolution of the analog-to-digital converter, and the more accurate the measured current.
Figure 1: Multichannel current measurement
When it is necessary to measure or monitor current from multiple sensors, a single ADC multiplexer can be used. The output of the multiplexer is connected to multiple differential amplifiers. The differential amplified output of the amplifier is connected to the ADC for conversion.
Figure 2 shows the composition of the multiplexer: amplifiers, ADCs, microprocessors, analog devices, peripheral components such as timers and memory. Different current sources can be sensed and measured. The microprocessor can record the measured values.
Figure 2: Multi-channel current measurement structure
There are four current sense shunt resistors in the picture – Rs1 Rs3 and Rs4 (through which the current can be measured). Shown here is just an example, it is also possible to connect other sensor outputs such as Hall sensors or analog sensors that output current. The ideal channel for current measurement can be selected by a multiplexer. These are controlled by the processor. The analog multiplexer output is connected to a differential amplifier that provides signal gain. During runtime, both the differential amplifier and the analog-to-digital converter are configurable through the microprocessor system control. This is advantageous when different input channels are switched through the multiplexer, and when each channel signal needs to have a different gain. The gain signal is input to the ADC and then the ADC data is processed by the microprocessor system.
Below is the equation to calculate the current of the ADC conversion result
Measurable input current: 4mA
Differential Amplifier Gain: 10
ADC supply voltage: 5V
Multiplexer Input Voltage
ADC input voltage range
Mv/8-bit resolution ADC count
16-bit resolution ADC counts
The current I can be calculated from the ADC reading as:
Current I = (voltage count x (mv/count)/resistance)/amplifier gain
There are a fair number of microprocessors ON the market with on-chip ADCs that can be configured via firmware at runtime. The ADC should meet the usage requirements, have an appropriate input voltage range, meet operational requirements, resolution, gain control, etc. If the ADC is differential and can control the gain to the input signal, then the differential amplifier shown in the figure can also be omitted.
Microprocessor systems have timers that are configurable at runtime. A timer can be set to generate an interrupt at a specific time interval. These interrupts are used to interrupt the microprocessor and connect the desired multiplexer input channels to the outputs. Read the ADC conversion result reading, process the measured data and then store it in memory or transfer it to a PC for data analysis. By changing the timer period, it is easy to vary the time each channel is monitored. To monitor only one channel, simply turn off the timer interrupt after selecting the desired monitoring channel.
Care must be taken in this case, when switching from one channel to another through the multiplexer, while the ADC is still processing the conversion, which may result in inaccurate measurements. The ideal approach would be to stop the ADC, clear any previous conversion results, and then switch to the desired input channel, after which the ADC can resume operation.
Usually the application generally requires the signal to be sent as fast as possible, which is based on the switching time of the multiplexer (for example: the time it takes for the multiplexer to switch from one channel to another), this time should be as small as possible, because long Switching of time may result in loss of signal. All multiplexers should be disconnected before a new connection is made, this is to avoid short-circuiting with the previous channel’s signal.
Parameters Affecting Current Measurements
There are several parameters that determine the accuracy of induction and current measurement
Some parameters are very important for accurate current measurement. First of all, a resistor with an appropriate resistance value must be selected, and a suitable rated power, allowable deviation, and temperature coefficient must be selected. Take the temperature coefficient, which defines the change in resistance for each degree change in temperature.
If the sense resistor (Rsense) value is very small, the voltage drop across the sense resistor will also be very small. This would require significantly higher levels to achieve accurate current measurements. Conversely, if the Rsense value is large, then a large amount of power (I²R) will be dissipated, which will cause a temperature change, and the resistance will eventually change when the resistor heats up. Excessive power dissipation can also lead to power loss and thus reduced system efficiency.
The amplifier used should have high input impedance, low output impedance, high CMRR, and low input offset voltage. The input offset voltage varies linearly with temperature.If the input offset voltage is large, then the amplified output voltage will not be very accurate, resulting in inaccurate current measurements
For example: if the amplifier gain is 10 and the input offset voltage is 1 mV, then the output voltage will be amplified to 10 mV. If a small shunt resistor is used, with only a few millivolts across it, the offset error (10 mv) at the output of the amplifier will appear very large, which will result in inaccurate current measurements.
As discussed earlier, the switching time of the multiplexer needs to be as small as possible, otherwise it will cause signal loss. The high on-resistance of the multiplexer will affect the input signal voltage, which can be beneficial to the overall performance of the system. The channel capacitance and impedance of the multiplexer can also affect the output signal, potentially introducing erroneous currents when switching between channels.
The role of the ADC is to accurately convert the input voltage to a digital signal, which is just as important as any other factor. For example: an ADC with 8-bit resolution, operating with an input voltage range of 0-5 volts, will account for approximately 19.60 millivolts per count. For the entire measurement voltage range, if the ADC has a 1 LSB error, this will introduce an error of about 20mv. For the same operating voltage range, a 16-bit ADC with 1 LSB error will introduce only 76 microvolts of error. More accurate analog-to-digital conversion is given when the ADC has higher resolution and smaller range, but the cost increases proportionally.
Programmability of Microcontrollers
Some microcontrollers such as Cypress’s PSoC (Programmable System-on-Chip) are quite suitable for such applications (runtime configuration is required). PSoC is programmable to add differential analog multiplexers, PGAs (for signal amplification), Delta-Sigma ADCs (can be set to single-ended or differential), timers, and many other components that require very little to use with PSoC additional hardware. Figure 3 shows an example of a multi-channel current measurement.
Figure 3: Multi-channel current measurement system
The multiplexer can be configured for up to 32 channels, the programmable gain amplifier can provide a gain of 50, and the ADC is a delta sigma ADC that operates in single-ended or differential input mode and can be configured for 8 to 20-bit resolution.
The multiplexer can have a choice of single-ended or differential inputs, which aids analog engineers in their sensor application selection. The analog multiplexer has a “break-before-make” feature that completely disconnects the current input before connecting a new input, which also avoids on-board interference.
Current measurement requires a precision resistor
Board-to-board device deviation can cause measurement differences
Only one channel can collect data at the same time, the data of other channels will be lost
As the number of input channels increases, the time to monitor each channel increases
It is necessary to put a source matched impedance such as an op amp in the amplification stage to avoid mismatch of input impedance from the output to the next stage.
Because analog switches only handle voltages between certain voltages during overvoltage or undervoltage conditions, the switch has the potential to be damaged and, therefore, additional protection circuitry is required at the multiplexer input.
Because system performance will vary according to supply voltage changes, hardware noise, and temperature changes, calibration is required to achieve accurate measurements.
Tips for getting good performance
Using an input noise separation method can help improve overall system performance
Use a noise-free power supply for accurate measurements
Avoid Mutual Interference at the Input of the Analog Multiplexer
The channel switching time of the analog multiplexer should be as short as possible
Try to do the best possible routing to ensure the performance of the ADC, multiplexer, and PGA.