Pages: [1]   Go Down
Author Topic: Interfacing with 24v 4-20ma analog devices  (Read 15185 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 43
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello
I am new to Arduino, but I'm a very experienced programmer.
A couple of years ago, I made my own PLC controller for my induction wind turbine.  I am now interested in making a microcontroller for my wind turbine and so I have a few questions:

I would like to interface with industry standard 24v 4-20ma sensors (basically converting them to 0-5v for the analog input pins of the Aurduino). Does anybody have an idea where to start on this?

thanks!
Logged

0
Offline Offline
Edison Member
*
Karma: 0
Posts: 1103
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You place a 220 ohms resistor between + and - of the line current. Connect - to ground and + through a 10k resistor to an analog pin.

You can also leave out the 10k.
If the signal is quite slow you can also add a 100nF cap parallel to the 220 Ohms resistor.

In rare cases you might want to decouple the line current from the Arduino ground. This is more tricky but hardly ever needed....

Note: The 24V have nothing to do with the interface, it is the support voltage you have to provide for the sensor. In many cases this need not be very precise; 15 or 18 volts generally work fine...
« Last Edit: September 07, 2010, 01:13:02 pm by mpeuser » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 43
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thankyou very much

For the sake of my learning, can you explain how you came to those values?

Also, I'm having a hard time picturing this. Could you show a simple example schematic that includes the arduino analog in pin, an external 24v power supply and a 4-20ma sensor?

thanks again!
« Last Edit: September 07, 2010, 01:25:15 pm by jondecker76 » Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 597
Posts: 33295
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Its is a sensor that produces current from a minimum of 4mA to a maximum of 20mA. When it is at its maximum you want the arduino to see 5V. So ohms law says that if you have 20mA trough a 220R resistor then it has to have a voltage of 20 * 220 = 4400 mV or 4.4V across it.
Logged

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset



--
Check out our new shield: http://www.ruggedcircuits.com/html/gadget_shield.html
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 43
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

First, thank you very much for the schematic

Unfortunately, I don't fully understand it..  I'm guessing that the loop + and loop - are from the 24v power supply?  Where is the actual sensor located in this example?

Logged

0
Offline Offline
Edison Member
*
Karma: 0
Posts: 1103
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

@RC
thank you so much for this professional sketch - it would have taken me 20 minutes to do it - and most likely you as well....

@jondecker
No, (+) and (-) are the connection to the sensor signal interface; they are generally marked so...
You have 24V somewhere else at the sensor, it might be marked as 24V, Vcc or such.
You also have "ground".
Connect 24V and ground to your 24V power supply.

If the 24 volt power supply and the arduino power supply are connected in some way, you might also explicitely connect ground of the sensor (and thus of the 24V supply) and Arduino ground.

This is a hot discussion topic where to exactly do that connection.... The easiest - but not best - way is to connect ground and (-) directly at the sensor. Low price sensors might not even have a different connector for ground and (-)

Attention! Do not use a 24V power supply for the Arduino - the limit there is 12 volts...
« Last Edit: September 07, 2010, 03:13:28 pm by mpeuser » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 43
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

...Thats a another long term goal for me, to have the arduino run off of the same 24v power supply - so somewhere down the line I will have to learn to make a circuit to drop the voltage down to 5v.

Thanks alot guys for the help, I guess my next step is to try it out on my board when it arrives!
Logged

0
Offline Offline
Edison Member
*
Karma: 0
Posts: 1103
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Much luck!

Quote
.Thats a another long term goal for me
Well, it will just need 5 parts..

Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 597
Posts: 33295
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Just a historic note. The first time I came across a 20mA current loop was in driving the old teleprinter terminals. The current actually drove a relay (carpenter relay) that engaged mechanically with the print mechanistic. In this case it was 20mA in one direction for a mark and 20mA in the other for a space. Also the maximum voltage output was about 150V so while it was safe when it was connected up, when it was open circuit it would byte you.
What Mr Circuits drew was known as a passive receiver. This is fine as long as you have an active transmitter (sensor). However two passives are just resistors so won't work.
Logged

0
Offline Offline
Faraday Member
**
Karma: 16
Posts: 2857
ruggedcircuits.com
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

If you can give us some specs/datasheets on the sensor perhaps some of these "could be" issues will clear up.

I prefer the designation "RC prime" over RC2.

--
Check out our new shield: http://www.ruggedcircuits.com/html/gadget_shield.html
Logged

0
Offline Offline
Edison Member
*
Karma: 0
Posts: 1103
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Of course if you change the loop power voltage, then you must scale the sense resistor at the Arduino analog input pin.  For example, if you were using a 24V loop voltage, you would use a 1200 ohm resistor between ground and the Arduino input (which would also be the sensor - side). The 1200 ohms would develop 5V when in a 24V loop with 20mA flowing (Ohm's Law again).
This is not really how current loops work (and also a little bit confusing...)
24V can be the "open circuit" voltage, but will drop down to match the resistor (and not vice versa).
I included the10k for safety reasons if the loop would not close..
This can easily happen when you screw the wires to the board and the (-) has a bad connection...
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 361
Posts: 17259
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Keep in mind that if the current loop is ever opened, by mistake or error is some ways, that the total loop source voltage (24v in this example) can be applied to the Arduino input pin, so some form of voltage or current limiting is required to protect the Arduino.

In the schematic posted by RC there is a 10k ohm series resistor to limit the current when the clamping diode conducts, to 2.5ma or so. I don't know if that is sufficient protection as the question of what the safe clamping diode current limit is has been raised before and not nailed down in my opinion. The datasheet seems to be somewhat silent or confusing on that issue. Perhaps some AVR application note would answer that better?

Lefty
« Last Edit: September 07, 2010, 07:56:09 pm by retrolefty » Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 43
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

retrolefty:

thanks for this important bit of information - I do want to protect against such errors and mistakes!
Logged

Manchester (England England)
Offline Offline
Brattain Member
*****
Karma: 597
Posts: 33295
Solder is electric glue
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I do want to protect against such errors and mistakes!

In which case add a 5v1 zenner diode from the analogue input of the arduino to ground. The 10K will limit the current through the diode and protect the input.
Logged

Pages: [1]   Go Up
Jump to: