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

How to read current instead of voltage?


  • Please log in to reply
22 replies to this topic

#1 Daniel Minnaar

Daniel Minnaar

    Advanced Member

  • Members
  • PipPipPip
  • 46 posts
  • LocationJohannesburg, South Africa

Posted 06 December 2011 - 05:13 PM

Hi there, Could someone please point me in the right direction to read current off a sensor? I have a pressure transducer which supplies me 4..20mA depending on the pressure under water, which I'd like to read with the Netduino. Do I need to convert this into volts first, somehow? Any help would be great! Thanks

#2 renatoa

renatoa

    Advanced Member

  • Members
  • PipPipPip
  • 36 posts
  • LocationRomania

Posted 06 December 2011 - 05:23 PM

You connect at the sensor output a resistor with a value computed to give you the desiredr voltage range. For 5V this should be 5V/0.02A = 250 Ohms. This way the output voltage swing will be 1..5V, assuming the sensor is powered to be able to drive this voltage.

#3 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 06 December 2011 - 05:31 PM

Do I need to convert this into volts first, somehow?

Voltage is easier to measure, you can simply add a resistor with known value to the sensor output and measure the voltage drop across it using Netduino's analog input. The current is then calculated using the Ohm's law, I = U/R (R is known). You need to choose the resistor value so the voltage does not exceed Netduino's analog input limit (3.3V) and has appropriate power rating (it has to dissipate U*I power as heat).

#4 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 06 December 2011 - 06:19 PM

Both the above indications are correct on to perform a measure, but bear in mind that the upper limit is +3.3V, not +5V. So, the actual resistor value should be: R = 3.3 / 0.02 = 165 Use a couple of 330 Ohms resistor in parallel, et voilà! Cheers
Biggest fault of Netduino? It runs by electricity.

#5 Daniel Minnaar

Daniel Minnaar

    Advanced Member

  • Members
  • PipPipPip
  • 46 posts
  • LocationJohannesburg, South Africa

Posted 07 December 2011 - 08:30 AM

Both the above indications are correct on to perform a measure, but bear in mind that the upper limit is +3.3V, not +5V.
So, the actual resistor value should be:
R = 3.3 / 0.02 = 165
Use a couple of 330 Ohms resistor in parallel, et voilà!
Cheers


Thanks Mario, but excuse my ignorance here - what is the unit of measurement for the 165? If it's ohms, then why would I need a 'couple of 330 Ohms resistors' if all I need is a resistor for 165? Or will the resistors bring it down to 165? Maybe I'm reading it incorrectly :)

Thanks again for your help

#6 CW2

CW2

    Advanced Member

  • Members
  • PipPipPip
  • 1592 posts
  • LocationCzech Republic

Posted 07 December 2011 - 08:48 AM

Thanks Mario, but excuse my ignorance here - what is the unit of measurement for the 165? If it's ohms, then why would I need a 'couple of 330 Ohms resistors' if all I need is a resistor for 165?

Yes, it is ohms. You can simply use one 165Ω resistor, if you can get it - Mario has suggested two 330Ω resistors (in parallel), because 330 is much common value than 165 (330 is in the E6 standard EIA decade values, while 165 is in E96 - but these should be rather easy to source nowadays).

#7 Daniel Minnaar

Daniel Minnaar

    Advanced Member

  • Members
  • PipPipPip
  • 46 posts
  • LocationJohannesburg, South Africa

Posted 07 December 2011 - 09:22 AM

Yes, it is ohms. You can simply use one 165Ω resistor, if you can get it - Mario has suggested two 330Ω resistors (in parallel), because 330 is much common value than 165 (330 is in the E6 standard EIA decade values, while 165 is in E96 - but these should be rather easy to source nowadays).


Thanks. So is the aim of putting two 330Ω in parallel to cut their resistance in half? How does that work?

#8 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 07 December 2011 - 09:33 AM

Thanks. So is the aim of putting two 330Ω in parallel to cut their resistance in half? How does that work?


Oh, well...the quick formula for just two resistors is:
R = (R1*R2) / (R1+R2)
More generalized, for any number of resistors in parallel, is:
R = 1 / (1/R1 + 1/R2 + ... + 1/Rn)
BTW, from the last one, you can easily get the first formula.


The resistor stands as the brake, thus you may associate the resistance to the friction between two materials.
So, the higher is the resistance, the higher will be the friction.
I'd like to imagine as the friction that the water (i.e. current) has inside a pipe. If you have just one pipe having a friction of "330", two pipes lead a better water flow...
Hope that clarify.


Cheers
Biggest fault of Netduino? It runs by electricity.

#9 Daniel Minnaar

Daniel Minnaar

    Advanced Member

  • Members
  • PipPipPip
  • 46 posts
  • LocationJohannesburg, South Africa

Posted 07 December 2011 - 09:47 AM

It does clarify. Just out of curiousity, what if I wanted the voltage to come down to 5V. If I only use one 330Ω resistor it's still 6.6V, so what other resistors out there offer the fine-tuning resistance?

#10 Dan Morphis

Dan Morphis

    Advanced Member

  • Members
  • PipPipPip
  • 188 posts

Posted 07 December 2011 - 09:59 AM

Yes, it is ohms. You can simply use one 165Ω resistor, if you can get it - Mario has suggested two 330Ω resistors (in parallel), because 330 is much common value than 165 (330 is in the E6 standard EIA decade values, while 165 is in E96 - but these should be rather easy to source nowadays).


CW2,
I think reactive wants to know how two 330 ohm resistors in parallel would magically get him to the value of 165 ohms.

To answer that questions you have to understand the difference between resistors in series and parallel. In series, resistors are additive - that is the total resistance is equal to the sum of all the resistors in the chain. So for resistor values of 10, 47, and 100 the total resistance would be 157 ohms (10 + 47 + 100).

In parallel, it divides. with the formula being R = 1 / ((1/R1) + (1/R2) + (1/R3)...). So for values of 3, 9 and 18 the resistance would be 2 ohms -
1 / (1/3 + 1/9 + 1/18) = 1 / (6/18 + 2/18 + 1/18) = 1 / (9/18) = 1 / (1/2) = 2 ohms

In the case of two 330 ohm resistors the calculations would be:
1 / (1/330 + 1/330) = 1 / (2/330) = 1 / (1/165) = 165 ohms

-dan

#11 Daniel Minnaar

Daniel Minnaar

    Advanced Member

  • Members
  • PipPipPip
  • 46 posts
  • LocationJohannesburg, South Africa

Posted 07 December 2011 - 12:09 PM

CW2,
I think reactive wants to know how two 330 ohm resistors in parallel would magically get him to the value of 165 ohms.

To answer that questions you have to understand the difference between resistors in series and parallel. In series, resistors are additive - that is the total resistance is equal to the sum of all the resistors in the chain. So for resistor values of 10, 47, and 100 the total resistance would be 157 ohms (10 + 47 + 100).

In parallel, it divides. with the formula being R = 1 / ((1/R1) + (1/R2) + (1/R3)...). So for values of 3, 9 and 18 the resistance would be 2 ohms -
1 / (1/3 + 1/9 + 1/18) = 1 / (6/18 + 2/18 + 1/18) = 1 / (9/18) = 1 / (1/2) = 2 ohms

In the case of two 330 ohm resistors the calculations would be:
1 / (1/330 + 1/330) = 1 / (2/330) = 1 / (1/165) = 165 ohms

-dan


Nailed it! Much appreciated

#12 seascan

seascan

    Advanced Member

  • Members
  • PipPipPip
  • 88 posts

Posted 26 December 2011 - 09:32 PM

Does anyone have a simple schematic of this? If I have a 4-20mA pressure transducer that is powered with 24V and the output is 4 - 20mA, does the output go to ground and the 165Ohm Resistor is connected in parallel to the AIN? Or, is the 165OHM connected directly from the output to the AIN? If the latter, can an NetDuino AIN handle 20mA? Attached File  Untitled.png   11.08KB   37 downloads

#13 seascan

seascan

    Advanced Member

  • Members
  • PipPipPip
  • 88 posts

Posted 26 December 2011 - 10:54 PM

I think this is it.... Attached File  Untitled.png   11.07KB   37 downloads Can anyone confirm? Also, any recommendations for 'ground loop isolation'? Thanks! Terry

#14 Mario Vernari

Mario Vernari

    Advanced Member

  • Members
  • PipPipPip
  • 1768 posts
  • LocationVenezia, Italia

Posted 27 December 2011 - 06:13 AM

Terry, the last pattern is the right one. Also, referring to the first picture, the first approach does not measure anything than zero. While the second is very dangerous for the Netduino health, because you are exposing the Netduino input at very high voltages, let's say around 20-24V). This is a good way to blown your board. Not sure about what you man for "grounding loop". Is the probe cable very long? On what are you worried about?
Biggest fault of Netduino? It runs by electricity.

#15 seascan

seascan

    Advanced Member

  • Members
  • PipPipPip
  • 88 posts

Posted 27 December 2011 - 03:20 PM

Not sure about what you man for "grounding loop". Is the probe cable very long? On what are you worried about?


Thanks Mario.

I have been reading different information on-line about multiple 4-20mA sensors being run from the same power supply. It seems that multiple sensors with the same power source will effect each other through what is known as a "ground loop". The universal solution (again from what I've been reading) is to use a "ground loop isolation module". These are small boards that are connected in-line with the sensor and removes the ground loop effect. The problem is that they are about $175 each for two channels. If I had say.... 48 sensors this would get costly.

Terry

#16 mikepo

mikepo

    Member

  • Members
  • PipPip
  • 29 posts

Posted 27 December 2011 - 04:44 PM

Hi Terry,
I think what they mean by ground loop is that if the sensors are far apart or not grounded close to each other, there may be a voltage differential that affects the measurement due to the fact that ground is not actually 0 Ohms.

If you have the 165Ohm resistors close to your netduinos, i.e. all the sensors are grounded in the same spot, that should take care of it. This is also referred to as "star ground" and is very important in audio amplifier applications, since there you actually "hear" any ground loop problems as the 50/60Hz hum in your speakers.
Here's some additional detail if you are interested: Star Grounding

HTH,
Mike

#17 renatoa

renatoa

    Advanced Member

  • Members
  • PipPipPip
  • 36 posts
  • LocationRomania

Posted 27 December 2011 - 04:56 PM

The constant current 4-20mA standard is an industry one and was developed exactly with these issues in mind. So, you have two long wires, preferably twisted, at one end you have the sensor, at the other end you have the 165ohm resistor. Nothing else... there is no such thing as ground ! with netduino you measure the voltage on the resistor, and the minus of this voltage should go to netduino ground, but this not mean that that wire is ground for the sensor too ! The sensor is completely floating, and if any shielding is required it must be grounded at sensor side/location, not using the measurement wires !!! The 4-20mA wires should be used to transport only measurement current, not sensor power or anything else !

#18 seascan

seascan

    Advanced Member

  • Members
  • PipPipPip
  • 88 posts

Posted 27 December 2011 - 07:16 PM

Renatoa, What about sensors that only have two wires (http://www.transduce...ew/TDH30_(10.11).pdf)? The power for the sensor is over the same wires as the output. For multiple sensors, instead of connecting the minus side to the NetDuino ground would it be better to read the negative side with one AIN and the positive side with another and subtract the difference? I am planning on getting a mux shield (http://www.sparkfun.com/products/9832) so I can read a number of sensors.

#19 renatoa

renatoa

    Advanced Member

  • Members
  • PipPipPip
  • 36 posts
  • LocationRomania

Posted 27 December 2011 - 07:48 PM

I see in that document two possible connections, using two and three wires. For two wires you can use a circuit as in this drawing, without an op-amp to read differential: http://www.arduino.c...=1292955787/3#3

#20 seascan

seascan

    Advanced Member

  • Members
  • PipPipPip
  • 88 posts

Posted 27 December 2011 - 07:53 PM

Thank you for the link... good discussion there. Unless I am reading the spec wrong, it looks like the you can buy either a 0-5V output (3 wire) or 4-20mA output (2 wire).




1 user(s) are reading this topic

0 members, 1 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.