Go Down

Topic: How can i read pulse ,or 4-20 mA output from Arduino?  (Read 4543 times) previous topic - next topic

Adam212

i'm new with Arduino ,may anyone help me to know  how can i read pulse ,or  4-20 mA output? 
i have this sensor (micronics flow meters U1000) , it's working fine, but i don't know how to read the output from Arduino.
here is the manual of flow meters sensor:
http://www.micronicsflowmeters.com/newestpdfs/Micronics-U1000-Issue2-1.pdf
Thanks in advance

larryd

Quote
how can i read pulse
Use the pulseIn() function
http://arduino.cc/en/Reference/pulseIn

Quote
4-20 mA output
Use a 250 ohm resistor with an analog input. Gives 1-5volts
No technical PMs.
If you are asked a question, please respond with an answer.
If you are asked for more information, please supply it.
If you need clarification, ask for help.

KenF

Read down further.  It can produce a pulse.  THIS is the ideal interface for the arduino.  This can easily be used to drive an opto issolator that can then be read by one of the digital input pins.  Timing the pulses can then give a flow rate.

The device is even configurable for what flow is represented by each pulse.


Adam212

Thanks LarryD
Thanks KenF
i already tried pulseIn() function ,but its not working i got only 0 value in the result ,may be i did something wrong with he connection.

The polarity of the wires is as follows:
Brown wire: 24V Input
Blue wire: 24V Return
white wire: Pulse Output
Green wire: Pulse Return
Red wire: 4-20mA Output (+)
Black wire: 4-20mA Return (-)

i connected white wire(Pulse Output) to pin number (2) and Green wire(Pulse Return) to Arduino GND between pin 13 and AREF , but i got only 0 as a result.

here is a sample code:

int pin = 2;
unsigned long duration;

void setup()
{
  pinMode(pin, INPUT);
  Serial.begin(9600);
  Serial.println("Started");
}

void loop()
{
  duration = pulseIn(pin, HIGH);
  Serial.println(duration, DEC);
}

but i got only 0 as a result in my hyper-terminal, so may you help me to get the correct pulse?
and how can i get pulse count from the duration ?

once again thanks in advance.

KenF

I never mentioned the pulsein function.  I was talking about the pulse signal on your device. 

Adam212

Thanks Kenf , yes so sorry i miss understood , i already set the configuration of (Micronics flow meters U1000) to give me pulse output , and it's working fine , and i can see the water level in the display , but when i try to use  pulseIn() with pin 2 like this code i got only 0

unsigned long duration;

void setup()
{
  pinMode(pin, INPUT);
  Serial.begin(9600);
  Serial.println("Started");
}

void loop()
{
  duration = pulseIn(pin, HIGH);
  Serial.println(duration, DEC);
}

robtillaart

moderator: cross-post in sensors deleted. 
Please keep your questions in one thread, saves time for everybody.
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

Adam212

Sorry robtillaart ,I'm new and i don't know which thread i need to put my question , because it's programming and sensor issues , that is why i put my question in both of programming and sensor thread.
once again , I'm sorry.

KenF

Looking at the diagram on page 9 of the datasheet shows the "pulse" connections as the grey and green wires.  (not the red and black)

Grey is "pulse output" whereas Green= "pulse return"

Then on page 21 we have a rather useful looking table that tells us that the "pulse output" is "Opto-isolated MOSFET volt free normally open contact"

So what we have is a pair of wires that are connected to the mosfet side of an opto issolator.  It will not have any signal on it unless your circuit provides the power.

What I think you need to do is provide 5v from your arduino to the silver wire via a a suitable resistor (say 4.7K) and connect the green wire to your arduino GND.  You can then take your reading from the silver wire (at it's junction with the resistor)


Adam212

Thanks KenF , i will test it and comeback to you.

dlloyd

Quote
... but when i try to use  pulseIn() with pin 2 like this code i got only 0
The pulseIn() is a blocking function and is not required for this very capable and accurate instrument, as your U1000 has both analog and pulse outputs.

The output is a MOSFET relay type and the electronic normlly-opened contacts are "dry" (high impedance) when open. At the Arduino end, I would connect one end of a 1K resistor to the white wire and the other end to GND. Also, the green wire needs to be connected to GND. You should now get pulses 0-5V on pin 2. EDIT: (as per KenF diagram) These pulses are ideal for totalizing (counting) to record accumulated volume.

The isolated 4-20mA signal can be monitored by using one of the analog inputs of the Arduino. This signal will provide the same information as the digital signal, however you can get accurate and near instantaneous readings which is ideal for monitoring flow rate, data logging, creating flow profiles, etc.
To connect to the Arduino, connect a good quality (temp stable) 250Ω resistor across the red and black wires. Connect the red wire to an analog input and the black wire to GND of the Arduino. This will give a 1-5 volt signal.

Disclaimer: I have never used this device.

Adam212

Thanks a lot dlloyd, i will test it and comeback to you.

Adam212

Thanks guys ,i tested but still not working. how i can take the reading of U1000  pulse? or in current loop 4 to 20mA? the u1000 is being powered but unfortunately i can't obtain any reading of both output.

UKHeliBob

Can you please post a schematic of how the device and the Arduino are wired.
Please do not send me PMs asking for help.  Post in the forum then everyone will benefit from seeing the questions and answers.

Adam212

Thanks UKHeliBob,

find below the schematic  image :

http://s23.postimg.org/ylht43xjf/schematic.jpg


and here is the sample code:

int pin = 2;
unsigned long duration;

void setup()
{
 pinMode(pin, INPUT);
 Serial.begin(9600);
 Serial.println("Started");
}

void loop()
{
 duration = pulseIn(pin, HIGH);
 Serial.println(duration, DEC);
}


Go Up