Go Down

Topic: How to read a sensor help needed (Read 998 times) previous topic - next topic


Oct 04, 2010, 07:33 pm Last Edit: Oct 04, 2010, 11:53 pm by lemonbblee Reason: 1
My flow  sensor's output is 4-20mA which present 1-55GPM. How could I read it with arduino?
Let me add more info here.
I use a 250 omh resistance to get a 1-5V output. I use voltage meter measure the output is 1.212V where the flow rate is 3.07 GPM. How could I use arduino acquire data and program to show the flow rate?


you will need to provide more information buddy !
wat kinda sensor etc etc
a random answer i can give is use analogRead  command
but remember always give the full information even i used to popup with such stupid questions but now i've learnt you'll to doo good


Well, let's start with this circuit and see if it meets your needs.

The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, light sensor, potentiometers, pushbuttons


Oct 04, 2010, 10:16 pm Last Edit: Oct 04, 2010, 10:19 pm by retrolefty Reason: 1
I've worked with industrial 4-20ma current loops for decades and they can be somewhat tricky to wire up if you haven't worked with them before. First a 250 ohm resistor is the normal resistor used that results in a 1-5vdc measurement range representing a 0-100% of the sensor's measurement range. Second you need to know if the sensor is 'loop powered' or not. If the sensor does not have it's own source of power then it's expecting an external voltage source to power the two wire current loop, normally a 24vdc in the most common loop voltage to use, however sometimes you can go as low as 12vdc if the loop is short. A link to the data sheet should help answer on how the loop needs to be powered wired up.



I get the data. the voltage is stable at a small range from 0.991-0.996. However my reading data is changing at a huge range. I just read the data in 180 - 205 range, which the total scale range is 0-1023. Is there a noise from the main board, or something wrong with my code?


Frankly it sounds right. If the sensor is sending 4mA, I would expect 0.004*220=0.88V. So you're getting about 0.994V, or 4.5mA. Pretty reasonable.

Converting this to an A/D reading:

0.994 / 5 * 1023 --> 203

Again, pretty reasonable compared to what you're getting.

As for the variation, there could be noise in the current signal. Do you expect/know that it's relatively noise-free? Did you put the 10k/0.1uF components in?

The Quick Shield: breakout all 28 pins to quick-connect terminals


Oct 05, 2010, 01:39 am Last Edit: Oct 05, 2010, 01:42 am by lemonbblee Reason: 1
Just as you said, 203 is right. However, the numbers are like 182, 179, 190, 204, 206....Then the voltage I measured is staying at 0.994. Is that still right? Also, if I increase the flow rate, like the output increases to 1.212V, the numbers I read are like 210, 249, 208, 257, 242, 225, 248, 198, 232, 196...
I mean when the output from my sensor is increased, the data I read is more unstable....


Frankly, those readings could be correct. I can imagine a flow sensor being somewhat variable in its readings, flow being what it is.

Need a custom shield? Let us design and build one for you.


The question you must ask yourself is what variations were you expecting? It looks like the sensor has a much greater range of flow that you are giving it. What is the maximum flow rate it can indicate and are you anywhere close to that? Flow meters are often at there most inaccurate at low flow rates.

Go Up