How to capture 4-20mA current loop from a sensor - Page 1
Forum section: electronics / beginners

author: roogadget
author_rank: Contributor
timestamp: October 07, 2018, 12:11:42 pm
content: 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.pdfThe second image is an update of my setup (passive)..

author: Benta
author_rank: Super Contributor
timestamp: October 07, 2018, 12:21:12 pm
content: 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.

author: Zero999
author_rank: Super Contributor
timestamp: October 07, 2018, 01:48:14 pm
content: 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.

author: roogadget
author_rank: Contributor
timestamp: October 07, 2018, 11:49:07 pm
content: Danke sehr!I have updated my original post with a new image. Is this what you described??

author: Zero999
author_rank: Super Contributor
timestamp: October 08, 2018, 08:13:29 am
content: 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.

author: Arznei
author_rank: Contributor
timestamp: October 08, 2018, 09:47:37 am
content: 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.

author: Karlo_Moharic
author_rank: Regular Contributor
timestamp: October 08, 2018, 10:06:16 am
content: Does this sensor have some sort of information/application sheet that you can refer to ?

author: langwadt
author_rank: Super Contributor
timestamp: October 08, 2018, 11:08:30 am
content: 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

author: Zero999
author_rank: Super Contributor
timestamp: October 08, 2018, 12:42:01 pm
content: 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_stm32f1Unless 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.