Pages: [1]   Go Down
Author Topic: How to read a sensor help needed  (Read 728 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 5
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
« Last Edit: October 04, 2010, 04:53:10 pm by lemonbblee » Logged

Hyderabad , India
Offline Offline
God Member
*****
Karma: 6
Posts: 621
can't help not to think arduinaizing something !
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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

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
Logged

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

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.

Lefty
« Last Edit: October 04, 2010, 03:19:02 pm by retrolefty » Logged

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

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?
Logged

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

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
Logged

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

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....
« Last Edit: October 04, 2010, 06:42:57 pm by lemonbblee » Logged

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

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.
Logged

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

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.
Logged

Pages: [1]   Go Up
Jump to: