Pages: [1]   Go Down
Author Topic: Input/Output read/write without using Ground or Power/Source possible?  (Read 687 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Offline Offline
Edison Member
*
Karma: 33
Posts: 1290
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Germany
Offline Offline
Faraday Member
**
Karma: 56
Posts: 2983
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

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

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

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 smiley

@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... smiley-neutral
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 12
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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... smiley-neutral

Quote
Note that the pullup resistors provide enough current to dimly light an LED
Sy, found the answer by myself smiley-small . It doesn't provide the "full" current...
Logged

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

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

Pages: [1]   Go Up
Jump to: