Arduino Forum

Using Arduino => General Electronics => Topic started by: kevin567890 on Feb 09, 2014, 08:23 am

Title: Need Help with Open Collector Output
Post by: kevin567890 on Feb 09, 2014, 08:23 am
I have been working on attaching a fuel meter with an open collector output to my arduino uno to be able to electronically meter the amount of fuel I put through my gas pump. So far I am totally stumped as to how to get any type of signal on the arduino. I have tried to use a pull up resistor as was suggested to me, but this only causes the pin to remain in the "high" state no matter what flows through the meter. According to the guide, the output signal is an "Open Collector Output."

Here are the two options laid out in the meter guide to collect a signal: http://imgur.com/a/jQ1WR

Here is some further info about the meter I am trying to connect: http://catalog.gpi.net/item/g2-electronics/g2-meter-modules/conditioned-signal-output-module

Here is a diagram and pictures of what my current (failed) attempt looks like: http://imgur.com/a/ClMxq#5

Sorry to be such a noob, but I am very excited about the potential of this project and would appreciate any help anyone can give.
Title: Re: Need Help with Open Collector Output
Post by: larryd on Feb 09, 2014, 08:35 am
Attach the Arduino sketch.
I assume the 9V battery can supply enough power to the module, (it may not).
If there is no fuel flow will there be any output, if no output, Arduino will see a HIGH.
Title: Re: Need Help with Open Collector Output
Post by: kevin567890 on Feb 09, 2014, 09:02 am
Right now I have not created any specific sketch other than a basic trouble shooting sketch to see if I am getting any change from high to low. In this case it is just a serial read of the state of the pin via the Red Bear Labs bluetooth application http://redbearlab.com/bleshield/

Once I know I am getting a good signal, I will create the sketch to convert the pulses into gallons.
Title: Re: Need Help with Open Collector Output
Post by: Paul__B on Feb 09, 2014, 09:55 pm
Always a good idea to post the exact sketch you are using - in its entirety.
Title: Re: Need Help with Open Collector Output
Post by: Grumpy_Mike on Feb 09, 2014, 10:17 pm
Quote
Here is a diagram and pictures of what my current (failed) attempt looks like:

No it is not a diagram it is a photograph. It is a photograph that shows very little.
Can you post a diagram.

All an open collector output needs is a pull up resistor between 1K and 10K to 5V and a common ground.
Title: Re: Need Help with Open Collector Output
Post by: kevin567890 on Feb 10, 2014, 12:19 am
There are multiple photographs and a diagram in the album. If you click the images on the right you can see the diagram.

Thanks.
Title: Re: Need Help with Open Collector Output
Post by: Grumpy_Mike on Feb 10, 2014, 12:32 pm

If you click the images on the right you can see the diagram.

Sorry no diagram. There is a Fritzing abortion that is totally wrong in so many ways it is hardly possible to tell you but this is not a diagram it is a physical layout.

What is the transistor? Type and number.
What are the connections, emitter base and collector?
What are you trying to do with it. It has little to do with your original question.

An open collector output needs to be connected to an arduino input pin. Then that pin also needs to be connected to +5V through a resistor. Then the ground of the open collector output needs to be connected to the ground of the output device.
No transistors need to be harmed in interfacing this.
Title: Re: Need Help with Open Collector Output
Post by: lar3ry on Feb 10, 2014, 01:50 pm

Right now I have not created any specific sketch other than a basic trouble shooting sketch to see if I am getting any change from high to low. In this case it is just a serial read of the state of the pin via the Red Bear Labs bluetooth application http://redbearlab.com/bleshield/

Once I know I am getting a good signal, I will create the sketch to convert the pulses into gallons.


"a serial read of the state of the pin"  makes no sense. If you are interfacing this thing through a Bluetooth shield, and just want to do basic troubleshooting, get rid of the shield and connect directly to the Arduino. Then do digitalRead() to look at the pin.

Mike, that "transistor" is the way he is showing the fuel flow sensor, as there was no Fritzing part available for it. He should have explained that as he did in his other thread.
Title: Re: Need Help with Open Collector Output
Post by: kevin567890 on Feb 10, 2014, 07:20 pm
Sorry, for not clarifying that. Yes, the transistor takes the place of the meter outputs I am using. I don't mean to be so stupid about these things. I'm just doing my best to learn. thanks again for the help.
Title: Re: Need Help with Open Collector Output
Post by: Grumpy_Mike on Feb 10, 2014, 07:36 pm
Quote
as he did in his other thread.

So is this a cross post?

Quote
the transistor takes the place of the meter outputs I am using.

Great still makes no sense as you have not labeled what signal is what.
I can't conceive if even if the transistor is supposed to be the transducer how it could possibly be right.
Are you reading what I tell you here about connecting up an open collector output or are you just ignoring it?
Title: Re: Need Help with Open Collector Output
Post by: kevin567890 on Feb 10, 2014, 08:48 pm
I am doing my best to understand and follow your advice, honestly not trying to ignore anything you say. Again, Thank for taking time to help.

To try and clarify, the transistor in the image is supposed to represent the meter I am using as there was no appropriate image I could find in the simulation software. The meter has three wires going out of it. The Open Collector Output (White), the +9v - 35v (red), and the Common Ground (Black).  (does that clarify what signal is what? If not, I think I must not be understanding exactly what you are asking about, my fault for being a noob)

http://i.imgur.com/eJih1vb.png

I have tried to follow your advice as best as I understand.

Quote
An open collector output needs to be connected to an arduino input pin. Then that pin also needs to be connected to +5V through a resistor. Then the ground of the open collector output needs to be connected to the ground of the output device.


In the image I have the Open Collector Output attached to the breadboard then to digital input 7. I then used a 10K resistor to create a pull up resistor to the +5V. The open collector ground is connected to the arduino ground also. Have I misunderstood something?
Title: Re: Need Help with Open Collector Output
Post by: MarkT on Feb 10, 2014, 09:03 pm
The first thing to do is use a multimeter on this sensor, connect the 9V to
the appropriate pins, a 1k pullup from the open collector to the +9, and
also measure the voltage with a multimeter and play with the flow to see
what's happening.

Once that's working try moving the pull-up to +5V and check it still
works (the info for the sensor didn't recommend that, note, it
should work but be paranoid). 

Then connect everything to the Arduino having first tested a sketch can read a pin...

In other words to find a problem divide and conquer, don't keep bashing away
at the whole system, break it into parts and check each one independently.
Title: Re: Need Help with Open Collector Output
Post by: michinyon on Feb 11, 2014, 02:39 am
The explanation of connecting that device is one of the worst I have ever seen.      It seems to generate some kind of output signal,   without any power input.    Maybe there is some plutonium in there.
Title: Re: Need Help with Open Collector Output
Post by: kevin567890 on Feb 11, 2014, 05:17 am
I tried to follow Mark T's advice but was a bit concerned about getting the 9V too close to the board. So instead I broke out the multimeter and started testing continuity and voltage. It appears that while the meter is still the resting voltage is 0.6V when the meter begins to spin, the voltage drops. The faster it spins the closer to 0 it gets. I don't know if that is a helpful observation or not.
Title: Re: Need Help with Open Collector Output
Post by: kevin567890 on Feb 11, 2014, 05:52 am
Also, here is the code I am using. I keep getting a return of "1" no matter how fast the meter runs.

Code: [Select]
int MeterRead = 7;


void setup() {
 
  Serial.begin(9600);

  pinMode(MeterRead, INPUT);
}


void loop() {

  int MeterState = digitalRead(MeterRead);

  Serial.println(MeterState);
  delay(1);        // delay in between reads for stability
}
Title: Re: Need Help with Open Collector Output
Post by: Grumpy_Mike on Feb 11, 2014, 07:26 am

I tried to follow Mark T's advice but was a bit concerned about getting the 9V too close to the board. So instead I broke out the multimeter and started testing continuity and voltage. It appears that while the meter is still the resting voltage is 0.6V when the meter begins to spin, the voltage drops. The faster it spins the closer to 0 it gets. I don't know if that is a helpful observation or not.

If that is truly what you did and you included a pull up resistor to 9V then your meter is broken.
However given your track record to date it is hard to tell so how about some photographs of the meter with the wiring you tested.
Title: Re: Need Help with Open Collector Output
Post by: kevin567890 on Feb 11, 2014, 06:31 pm
I did not use a pull up resistor to the 9V. That was my concern also. Was the info I was able to gain from the multimeter helpful in understanding the OCO at all?
Title: Re: Need Help with Open Collector Output
Post by: Grumpy_Mike on Feb 11, 2014, 07:55 pm
Quote
I did not use a pull up resistor to the 9V.

If you do not use a pull up resistor you will measure nothing from an open collector output.
Title: Re: Need Help with Open Collector Output
Post by: TomGeorge on Feb 12, 2014, 01:40 pm
Hi, question, are you doing all this testing on a protoboard like in your fritzing?
If so, check that the positive and negative supply lines that run down the side of the protoboard are continuous for the entire length.
There are some out there that have a break in continuity half way down, in your case it would mean that the Black and battery negative are connected together but not connected to the arduino ground.

Tom...... :)