Netduino home hardware projects downloads community

Jump to content


The Netduino forums have been replaced by new forums at community.wildernesslabs.co. This site has been preserved for archival purposes only and the ability to make new accounts or posts has been turned off.
Photo

Circuit example for 4-20mA measurement


  • Please log in to reply
10 replies to this topic

#1 Novice Alex

Novice Alex

    Advanced Member

  • Members
  • PipPipPip
  • 59 posts

Posted 26 July 2012 - 11:44 PM

Hi Guys, Separately, do you have any sample circuit to connect to N+ for measuring 4-20mA Analog input? Together with sample code will be great. Currently I am using VB.net to handle the 12V pulse input through opto-coupler circuit. Thanks in advance.

#2 Nobby

Nobby

    Advanced Member

  • Members
  • PipPipPip
  • 70 posts

Posted 27 July 2012 - 03:28 AM

Hi Guys,

Separately, do you have any sample circuit to connect to N+ for measuring 4-20mA Analog input?
Together with sample code will be great. Currently I am using VB.net to handle the 12V pulse input through opto-coupler circuit.

Thanks in advance.


I don't think you can measure current with a microcontroller. You need to transduce the current to a voltage.

The most accurate method is getting a transducer which uses electromagnetic coupling. It's also the most expensive method.

The easiest method is to use a really small series resistance (1-5 ohms, whatever you can get your hands on) with the circuit you are measuring current. Measure the voltage across the resistance and divide that by the series resistance in your netduino code. The result has errors obviously. Adding resistance to the circuit changes the current. You might also get non-negligable current flow into the analog pin even if it has a high impedence characteristic during analog sampling.

The other consideration you need to be aware of is that 4-20mA is a rather small current to transduce. Mostly because ADC(Analog to Digital Conversion) usually has a precision relative to the operating voltage of the microcontroller(AVR/Netduino) and the value of AREF(usually set to zero volts or Vcc/2). A current that small will produce a voltage so small it will appear as zero after ADC. You'll need to amplify the transduced current signal significantly, especially if you are working in a narrow measurement range (4-20mA).

You can make a simple voltage amplifier with two resistors and an op-amp package.

#3 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 27 July 2012 - 05:17 AM

For me is not clear enough what is your goal. Could you explain better what do you need?
Biggest fault of Netduino? It runs by electricity.

#4 caEstrada

caEstrada

    Advanced Member

  • Members
  • PipPipPip
  • 84 posts

Posted 27 July 2012 - 04:40 PM

Hello Alex, Sound a typical field instrumentation problem. Use a 250ohms in parallel to 4-20mA signal. Remember V=IR .... V=(4/1000)(250) = 1V...do similar operation for 20mA and you get 5VDC...right in the acceptable voltage range of the Analog inputs... Hope helps.

#5 Nobby

Nobby

    Advanced Member

  • Members
  • PipPipPip
  • 70 posts

Posted 28 July 2012 - 01:21 PM

Hello Alex,

Sound a typical field instrumentation problem.

Use a 250ohms in parallel to 4-20mA signal. Remember V=IR .... V=(4/1000)(250) = 1V...do similar
operation for 20mA and you get 5VDC...right in the acceptable voltage range of the Analog inputs...

Hope helps.


You can't measure the current of a circuit using a parallel impedence, that's only appropriate for voltage measurements(scale conversion). Parallel impedence splits the current through branched paths and it also alters the characteristics of the circuit in a large way(unless the impedence is essentially infinite, 250ohms is very low).

The current transducer circuit has to run in series and have a negligable impedence.

#6 nakchak

nakchak

    Advanced Member

  • Members
  • PipPipPip
  • 404 posts
  • LocationBristol, UK

Posted 28 July 2012 - 01:37 PM

you could use something like a maxim max133 or max134 digital multimeter chip? They are often used in the displays of bench power supplies etc. Pretty sure all you need with one of those is a current shunt for current measurement, although you may be able adapt the circuit in the datasheet for your needs as all those chips are essentially are adc's and a display driver... Nak.

#7 carb

carb

    Advanced Member

  • Members
  • PipPipPip
  • 352 posts
  • LocationCrystal River, Florida

Posted 28 July 2012 - 03:29 PM

Alex,

The main reason you might want to use a 4 - 20 ma sensor is for distance between the location of the sensor and the device reading the signal (Netduino), also a 4 - 20 m sensors are not effected by interferance as much. The sensor will give a constant current output for the measured parameter value.

If the distance is not to great a sensor that give a voltage output of 0 to 3.3 volts is easier to use. Also accuracy should be considered the ADC for the Netduino Classic, Mini & Plus is 10 bit, so that the value is divided into 1024 parts. The Netduino Go shield base has a 12 bit ADC so that the value is divided into 4098 parts, so it has a better precision.

There are a lot of ways to use sensors with a 4 - 20 ma constant current output. You can search the internet for a variety of ways.

One of the more common ways is to use a 250 ohm resistor in series with the 4 - 20 ma signal (not Parallel), for 4 ma this will give you a voltage drop measured across the resistor of 1 volt. For 20 ma you get a voltage drop of 5 volts.

% volts is to high to read with the Netduino ADC (0 to 3.3 volt) directly. But you could build a serial / parallel network that would give an output that you can read and then scale in software.

See drawing (may be crude , first try with fritzing)

You will need to make sure that the current flow is in the proper direction to give a positive voltage on the Netduino Analog pin. Then scale in software so that 0.5 volt is minimum (zero) reading and the 2.5 volts is full scale reading. The closer the resistors are to the proper values the better, but if you have a good multimeter you
can still calibrate the readings of the sensor.

Chuck

Attached Files



#8 caEstrada

caEstrada

    Advanced Member

  • Members
  • PipPipPip
  • 84 posts

Posted 03 August 2012 - 05:16 AM

Alex,

The main reason you might want to use a 4 - 20 ma sensor is for distance between the location of the sensor and the device reading the signal (Netduino), also a 4 - 20 m sensors are not effected by interferance as much. The sensor will give a constant current output for the measured parameter value.

If the distance is not to great a sensor that give a voltage output of 0 to 3.3 volts is easier to use. Also accuracy should be considered the ADC for the Netduino Classic, Mini & Plus is 10 bit, so that the value is divided into 1024 parts. The Netduino Go shield base has a 12 bit ADC so that the value is divided into 4098 parts, so it has a better precision.

There are a lot of ways to use sensors with a 4 - 20 ma constant current output. You can search the internet for a variety of ways.

One of the more common ways is to use a 250 ohm resistor in series with the 4 - 20 ma signal (not Parallel), for 4 ma this will give you a voltage drop measured across the resistor of 1 volt. For 20 ma you get a voltage drop of 5 volts.

% volts is to high to read with the Netduino ADC (0 to 3.3 volt) directly. But you could build a serial / parallel network that would give an output that you can read and then scale in software.

See drawing (may be crude , first try with fritzing)

You will need to make sure that the current flow is in the proper direction to give a positive voltage on the Netduino Analog pin. Then scale in software so that 0.5 volt is minimum (zero) reading and the 2.5 volts is full scale reading. The closer the resistors are to the proper values the better, but if you have a good multimeter you
can still calibrate the readings of the sensor.

Chuck



#9 caEstrada

caEstrada

    Advanced Member

  • Members
  • PipPipPip
  • 84 posts

Posted 03 August 2012 - 05:19 AM

Alex, Chuck is correct, I was wrong about parallel. The shunt should go in series. Yes, N+ do not accept 5VDC, so then we can find a resistor to apply. It is common practice on instruments like flowmeters and pressure transducers to change from 4-20 to 1-5VDC... Again, sorry for the error. The 0-3.3 span would be splited in 1023 subdivisions.

#10 caEstrada

caEstrada

    Advanced Member

  • Members
  • PipPipPip
  • 84 posts

Posted 03 August 2012 - 05:55 AM

Chuck, 12bit----4096...regards,

#11 carb

carb

    Advanced Member

  • Members
  • PipPipPip
  • 352 posts
  • LocationCrystal River, Florida

Posted 03 August 2012 - 10:27 AM

Chuck,

12bit----4096...regards,

Your right, got in a hurry and didn't check what I had typed. Thanks for the correction.

Chuck




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

home    hardware    projects    downloads    community    where to buy    contact Copyright © 2016 Wilderness Labs Inc.  |  Legal   |   CC BY-SA
This webpage is licensed under a Creative Commons Attribution-ShareAlike License.