cancel
Showing results for 
Search instead for 
Did you mean: 

How can I measure 4mA with a ADC from STM32? How to achieve 4mA -> 0 ADC?

DMårt
Lead

Hi!

I know how to measure 4-20mA sensor with STM32 by using a 160-165 Ohm resistor as a shunt resistor between ground and analog input of the STM32, and then apply 4-20mA into the analog input.

But at 4mA, I gout about 0.6V into the ADC and then I losing about 20% of the ADC due to the 4mA initial power.

Is there any way in STM32F373 to change so when I got 4mA in over the shut of 160-165 Ohm resistor, then I read about 5-20 in ADC, and not 20%(819) of 12-bit (4095) ADC?

The problem with STM32F373 is that Vref- is bounded to VSSA and VSSA must be 0V according to the datasheet. But is there any walk around for this?

STM32MP151AAC3 custom board with STM32-OS as operating system: https://github.com/DanielMartensson/STM32-Computer
5 REPLIES 5
Ozone
Lead II

An opamp to shift & amplify the signal ?

> But at 4mA, I gout about 0.6V into the ADC and then I losing about 20% of the ADC due to the 4mA initial power.

This is a matter of perspective.

My company uses some 4..20mA sensors as well, but convert a full range of 0...24mA.

Not only do we accept sensor signal slightly off-limits, we can also detect wire breaks.

I have tried opamp to shift and amplify the signal, without success.

STM32MP151AAC3 custom board with STM32-OS as operating system: https://github.com/DanielMartensson/STM32-Computer

Than you did it wrong.

The opamp circuit would basically be a summing amplifier.

Like that: https://www.electronics-tutorials.ws/opamp/opamp_4.html

You add an "offset" voltage at the input to shift your amplified signal up/down in range.

Hello

Proposed design accepts a voltage drop 0.66- 3.3v to 160 ohm shunt resistor that influences the whole circuit. Check first if total resistance of the loop allows the current rise to 20ma.

IMO is not so bad to accept an 0,5 MS-bit reduced dynamic range (819-4095).

For accurate measurement and fully adjusted dynamic range, there are current sense amps, eg, tsc210 , max9922, ina185 etc

So how much precision does I lose when I begin at 819 ADC?

STM32MP151AAC3 custom board with STM32-OS as operating system: https://github.com/DanielMartensson/STM32-Computer