# pull up and down resistor and known state

Hello! In many sensors implementation circuits like the water flow sensor

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1283065018

on the eletrical schema a pull up or down resistor is used.
I use pull up or down resistor when my circuit should go in an undefined state. For example an open circuit listened by an input pin give a random value. An easy example of this problem is the switch.
But, thinking about the flow sensor his output can be only GND or VCC. So if we supply it from arduino its can assume only 0 or 5v. So why not to connect it directly to digital in pin? I agree that using a pull up or a pull down everything works fine but what's the problem without them? I think arduino input pins calculate values subtracting input voltages on them and gnd.

I'm no expert, but I don't use pull resistors with digital logic when the output is either high or low, because as you said, there's no need. Maybe the designer of that schematic was being redundant, didn't realise there didn't need to be a resistor or it's just how he/she designs things, but I wouldn't have included a resistor there. If it works reliably without the resistor, then there's no need for it.

thanks. I have heard somewhere (I do not remeber where) that connecting Vcc or gnd directly to the input pin make this pin unable to detects fast value changes, do anyone knows if it's true and why? May be this is the reason to put a resistor?

But, thinking about the flow sensor his output can be only GND or VCC

But there you are making an assumption that may not be reality. Output signals from some sensors sometimes use what is called an open collector (or open drain) output signal. That is a transistor that will pull the signal to ground in one state (low) but just disconnect on the other (high) state. Such a signal requires a pull-up resistor to the Vcc voltage of the input pin the signal is being wired to. In the case of an Arduino input pin, one can simple enable the internal pull-up resistor to satify the requirement.

So without detail from a datasheet showing if the signal is a open-collector output or not, I would recommend you do use a pull-up, it will do no harm and may not work without one.

Lefty

"I have heard somewhere (I do not remeber where) that connecting Vcc or gnd directly to the input pin make this pin unable to detects fast value changes"

That's for sure - you will not see ANY changes that way!
There is not sufficient data available on that flow sensor to tell what its internals are. If the example works, go with it.
You could try just the internal pullups on the ATMega pins, if results are erratic then go with the external 10K.

Thanks to everyone!
"That's for sure - you will not see ANY changes that way!"
Can you explain me why please?

Some of the basic concepts of pull up / pull down resistors are discussed at...