Author Topic: How to capture 4-20mA current loop from a sensor  (Read 4994 times)

0 Members and 1 Guest are viewing this topic.

Offline roogadgetTopic starter

  • Contributor
  • Posts: 27
  • Country: au
How to capture 4-20mA current loop from a sensor
« on: October 07, 2018, 12:11:42 pm »
I have an industrial sensor (4-20mA) and want to capture this using my STM32 F1 ADC pin.

Do I need a "receiver" to do this? Or can I simply use a 250 ohm resistor?? ( 4mA * 250 = 1V & 20mA * 250 = 5V )

(Precision 4mA to 20mA CURRENT LOOP RECEIVER)
http://www.ti.com/lit/ds/symlink/rcv420.pdf

 |O

The second image is an update of my setup (passive)..
« Last Edit: October 07, 2018, 11:48:03 pm by roogadget »
 

Offline Benta

  • Super Contributor
  • ***
  • Posts: 6420
  • Country: de
Re: How to capture 4-20mA current loop from a sensor
« Reply #1 on: October 07, 2018, 12:21:12 pm »
Is it an active or a passive 4...20 mA sensor?
In the first case, you just need a resistor to ground from the output.
In the second case, you need to supply a voltage to one end of the sensor (normally 12...24 V). The other end of the sensor goes to the ADC input, with a resistor to ground. 250 ohms is a good value in both cases.
 
The following users thanked this post: roogadget

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20357
  • Country: gb
  • 0999
Re: How to capture 4-20mA current loop from a sensor
« Reply #2 on: October 07, 2018, 01:48:14 pm »
Yes, a resistor in series with the 0V side is all that's needed. It's possible to put it on the positive side but it will complicate matters, unless the 0V rail on the mictrocontroller circuit is isolated from the 12V to 24V rail.

A 250R resistor would be dissipating 0.022*250 = 0.1W, which is too much for a 0402 surface mount part. Although there are 0402 parts rated to 100mW, I wouldn't recommend it. Use 0805 or larger parts. It would be better to use two smaller parts in series, such as 120R and 130R and spread the power dissipation between them.
 
The following users thanked this post: roogadget

Offline roogadgetTopic starter

  • Contributor
  • Posts: 27
  • Country: au
Re: How to capture 4-20mA current loop from a sensor
« Reply #3 on: October 07, 2018, 11:49:07 pm »
Danke sehr!
I have updated my original post with a new image. Is this what you described??
 

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20357
  • Country: gb
  • 0999
Re: How to capture 4-20mA current loop from a sensor
« Reply #4 on: October 08, 2018, 08:13:29 am »
There's still the issue of the 0402 surface mount resistor.  Did you just use the default symbol and are going to use a through hole resistor when you build the circuit? If so please make that clear, otherwise it's confusing.

Attached is a circuit showing what I meant. The 250R resistor can be 120R and 130R or 100R and 150R in series, if you can't find 250R.
 
The following users thanked this post: roogadget

Offline Arznei

  • Contributor
  • Posts: 32
  • Country: de
Re: How to capture 4-20mA current loop from a sensor
« Reply #5 on: October 08, 2018, 09:47:37 am »
I would recommend using a resistor value slightly below 250R to accommodate for the resistance/current source tolerance. Having the maximum (planned) output at something a little below 5V would also allow for some further protection of the ADC input by means of a zener-diode for example.

You will however loose some digits of resolution by that if you don't go the extra mile of putting an OpAmp frontend in place to handle that stuff. I guess this depends on your desired resolution (and the possible resolution given your sensors datasheet) and how much effort you are willing to go through to protect your micro.
 
The following users thanked this post: roogadget

Offline Karlo_Moharic

  • Regular Contributor
  • *
  • Posts: 100
  • Country: hr
Re: How to capture 4-20mA current loop from a sensor
« Reply #6 on: October 08, 2018, 10:06:16 am »
Does this sensor have some sort of information/application sheet that you can refer to ?
 

Offline langwadt

  • Super Contributor
  • ***
  • Posts: 4857
  • Country: dk
Re: How to capture 4-20mA current loop from a sensor
« Reply #7 on: October 08, 2018, 11:08:30 am »
you need smaller resistor value, the max adc input is 3.3V and I'd recommend some clamping and a polyfuse on the input or a current limiter because with a wire short you get the full 24V input
 
The following users thanked this post: roogadget

Offline Zero999

  • Super Contributor
  • ***
  • Posts: 20357
  • Country: gb
  • 0999
Re: How to capture 4-20mA current loop from a sensor
« Reply #8 on: October 08, 2018, 12:42:01 pm »
I've just Googled and the power supply voltage range is 2V to 3.6V.
https://www.digikey.co.uk/product-detail/en/STM32F100C4T6B/497-10501-ND/2259219?WT.z_slp_buy=stm_stm32f1

Unless an external reference is used, presumably the maximum ADC input voltage is equal to the power supply. I agree about using a slightly lower value resistor so there's some leeway for component tolerances. 160R will give a voltage range of 0.64V to 3.2V.

Yes some protection of the ADC pin is a good idea, but it doesn't have to be hugely complicated. A resistor and capacitor will probably do, for most applications.

A PTC resistor (polyfuse) will provide little protection against the sensor being short circuited, unless the resistor is sufficiently overrated, as PTC resistors are slow. An active current limiting circuit might be more effective.

EDIT:
See attached schematics. As the resistance of the sensor is swept, the current varies in accordance with Ohm's law, up to about 22mA, then the voltage across the sensor is reduced and even if its resistance falls to 10 Ohms, the current drops to just under 23mA. The ADC voltage is of course directly proportional to the current and is limited at just over 3.6V, which will pose no problem, as R3 will limit the current into the ADC to a very low level.

V2 must be able to sink all the current flowing through R2, which will be just under 2.8mA, assuming the worst case supply voltage of 28V. A 1k2 resistor, a TL431 circuit, or zener across the 3.3V supply could be used, if the supply voltage rises.
« Last Edit: October 08, 2018, 02:29:16 pm by Hero999 »
 
The following users thanked this post: roogadget


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf