Skip to main content
Lead
March 16, 2021
Question

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

  • March 16, 2021
  • 5 replies
  • 4459 views

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?

This topic has been closed for replies.

5 replies

Ozone
Principal
March 16, 2021

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.

DMårtAuthor
Lead
March 16, 2021

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-ComputerSTM32MP257FAK3 custom board with STM64-OS as operating system: https://github.com/DanielMartensson/STM64-Computer
Ozone
Principal
March 16, 2021

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.

Vangelis Fortounas
Associate II
March 16, 2021

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

DMårtAuthor
Lead
March 16, 2021

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-ComputerSTM32MP257FAK3 custom board with STM64-OS as operating system: https://github.com/DanielMartensson/STM64-Computer