Go Down

### Topic: Input/Output read/write without using Ground or Power/Source possible? (Read 1 time)previous topic - next topic

#### privateRob

##### Apr 25, 2012, 08:12 pm
Hi everybody!

I have a very basic (and perhaps very stupid) question about connecting two digital pins (Output and Input) without using ground or 5V/3.3V output.

So, the simplest example I can think of, is Digital Pin 9 is connected to a push button which is connected to a resistor(10kOhm) which is connected to Pin 8.

An ASCII drawing would look like this:
D9 - PushButton - Resistor(10kOhm) - D8

D8 is a digital input, D9 a digital output.

In all tutorials and examples, the guys are using the Ground or the 5V/3.3V output.
I have read in the documentation, that, if a pin is declared as output, it provides ~5V.
My assumption is, that if I declare a pin as input, it is also grounded.
Right?

And therefore my circuit diagram should be correct.
But is it really correct or do I have to connect a pin to the power source or the ground additionally (and if so, why?)?

thx!

#### DVDdoug

#1
##### Apr 25, 2012, 08:31 pm
Yes! That can work.  (You don't need the resistor.)

The input & output pins both share a common ground (which is a reference point).   So, if you connect them together, they both have the same voltage, referenced to the same ground.

Now... If you had two different Arduinos and they each were powered by separate batteries with no common ground between them, connecting the output from one Arduino to the input of another Arduino would not work.

A voltage needs a reference or a "potential difference", or the voltage needs to be "across something" to get current flow.   With no other connection, the "input" Ardino wouldn't "see" a 5V "difference" between the input pin and its ground.

#### michael_x

#2
##### Apr 25, 2012, 08:54 pm

My assumption is, that if I declare a pin as input, it is also grounded.

My assumption is, it isn't grounded.

If you deactivate the input pullup, and your button is open, the input might catch any noise via the wire to the open button.
Test it with a rather distant button and a busy power line in parallel. Connect the input wire from the open button to an analog input and see which random voltage you can measure.

If you activate the pullup resistor for the input, it's stable HIGH when the button is open, and the button can make a connection to GND or to a LOW output. A HIGH output would work as a "disable the button" function, and keep the input HIGH.

Quote
You don't need the resistor
: Agreed

#### Grumpy_Mike

#3
##### Apr 26, 2012, 10:51 am
Quote
question about connecting two digital pins (Output and Input)

This begs the question as to why on earth you would want to do this!

If you have an output your code knows what it was set at so there is no need to read this back through an input. You can even read back the output latch by reading the output pin. So there are two reasons why you would never want to do this.

#### privateRob

#4
##### Apr 26, 2012, 08:54 pm
First, thank you guys for the clear and very detailed replies. They are really easy to understand, also for a beginner like me.

Quote
You don't need the resistor

In all tutorials the guys are using a resister (10kOhm) against electric noise.

Quote
My assumption is, it isn't grounded.

Ah, i didn't know, that you also can write to an input pin. But now I do

@Grumpy_Mike
So, you also can read the output pin...

Why do I have to declare a pin as output or input at all?
Because you can read and write to an input and output pin... :|

#### privateRob

#5
##### Apr 26, 2012, 09:03 pm

Why do I have to declare a pin as output or input at all?
Because you can read and write to an input and output pin... :|

Quote
Note that the pullup resistors provide enough current to dimly light an LED

Sy, found the answer by myself :. . It doesn't provide the "full" current...

#### Grumpy_Mike

#6
##### Apr 27, 2012, 09:18 am
Quote
In all tutorials the guys are using a resister (10kOhm) against electric noise.

They might say that but they would be wrong, it makes the noise problem worst not better.

Quote
It doesn't provide the "full" current...

A bit over simplistic, it actually enables the output drivers.

Go Up