Posts: 1
Joined: Wed Jun 28, 2017 4:55 pm

4-20 mA output

Wed Jun 28, 2017 5:00 pm

I just bought a Raspberry Pi and I am wanting to use it kind of as a simulator. I have a PLC that has code but no signals to do anything with. What I am wanting to do is write code on my Raspberry Pi that outputs several random 4-20 mA outputs to my PLC which would simulate the signal that is coming from sensor

Posts: 840
Joined: Tue Dec 15, 2015 4:55 pm
Location: Detroit, MI USA
Contact: Website

Re: 4-20 mA output

Wed Jun 28, 2017 6:27 pm

The Pi cannot do that directly - you'll have to build an interface circuit or find a module that takes what the Pi speaks and spits out 4-20.
Robotics tips, hacks, book extras

Posts: 9771
Joined: Fri May 31, 2013 9:28 pm
Location: Mansfield UK

Re: 4-20 mA output

Wed Jun 28, 2017 6:54 pm


Have a read of this post last entry links to output board.
you cant did this with software only.

you could have found this just as I did by googling it.
We want information… information… information no help
The use of crystal balls & mind reading are not supported

Posts: 1488
Joined: Fri Nov 23, 2012 3:30 pm
Location: Selby. North Yorkshire .UK

Re: 4-20 mA output

Wed Jun 28, 2017 10:53 pm

Usaly 4-20 ma is feed back from a motor controller, to a PLC that is controlling the motor.
The 4-20 ma feed back lets the PLC know what speed the motor is running at , also what
Current it is taking , This is very handy if the motor controller is of the Inverter type
BoyOh ( Selby, North Yorkshire.UK)
Some Times Right Some Times Wrong

User avatar
Posts: 1453
Joined: Wed Jan 09, 2013 3:05 pm
Location: thailand
Contact: Website

Re: 4-20 mA output

Thu Jun 29, 2017 2:22 am

4 .. 20mA signals are used as analog signals on long 2 wires
from sensors in the industrial world ( prior to fieldbus... )
there is expected a final resistor on the A-IN ( ADC ) board
so it usually can read 4 .. 20mA OR 1 ..5V ( or even ..10V ) when the resistor is removed ( but only used on short distances and low noise environment).
keep in mind that all the digital and analog signals in that world
have to do with a 24VDC power system.
so a 2 wire sensor will get 24VDC on one wire and "allow" 4 .. 20mA to flow
( back on the second wire ) as the measuring result.

what allows one of the best features of that ( high supply voltage of 24VDC ) system to place diodes in the wire ( without changing the measuring current )
and if you want you press a mA meter over that diode and can read/check the signal because the current will commute from the diode to the meter.
so the instrument engineer can work local/read on the wire without disturbing the loop.

for you that means:
-a- check if there is a removable 250ohm resistor on the A-IN
-b- expect that you need equipment above the 3v3 and 5v0 supply voltage level ( like RPI or ARDUINO.. ).
( as you can not drive 20mA from a 5V supply making 5V on that 250ohm )

you need a cheap hack? build a "motor poti"
-c- but if 1..5V signal ( removing resistor ) possible,
you can use a POTI (?10kohm?) powered by the RPI 5VDC pin
- first move manually to check PLC can read it,
- run/move the POTI by a 5VDC servo ( via servo hat.. ) from RPI.

Posts: 20
Joined: Thu Apr 05, 2018 4:49 am

Re: 4-20 mA output

Wed Apr 11, 2018 11:57 am

I understand your point you wanted to use 4-20mA sensor output to be interface it with raspberry pi and make a GUI (like a software) for doing modifications as per your requirement and send the signal to PLC for to perform accordingly if this is right
then you will require the Hardware as mentioned below

4-20mA current loop receiver to for to read the signals and send it to raspberry pi in digital form with the help of code ... ni-module/

DAC to convert digital output into analog from raspberry pie and connect it with PLC ... ni-module/

hope this will help you

Return to “Beginners”