eli5: when a 5V signal is attached/applied directly to an input pin on an arduino, does that input pin act as ground?

278 views

For example, when a push button is pressed. The 5V supply connects to the signal cable, which is attached to Pin 2, for example.

But where does the current ‘sink’ into? Doesn’t it need an explicit ground pin? If it goes right into Pin 2, is that the ground pin in disguise?

Or is the signal pin (pin 2) the one applying the current through the push button..?

In: 0

6 Answers

Anonymous 0 Comments

Arduino pins can either be set to drive a voltage on a line (output) or be de-coupled from the line (input).

In the latter case, all you’re doing is detecting the voltage on the pin. There’s no circuitry connecting the pin and the rest of the Arduino.

So now let’s use a simple switch. When it’s closed, current doesn’t flow. When it’s open, current flows.

On one side of our switch, we’ll connect to 5V. On the other side of the switch, we’ll connect to ground.

We’ll also need to connect a resistor (otherwise when our switch closes we get ‘infinite’ current). We can put it anywhere in this circuit, but we’ll put it before the switch in this example.

Now, let’s connect the Arduino pin between the resistor and the switch.

When our switch is open, the near side of the switch – including our Arduino pin – is charged up to 5V. Once it hits 5V, it just stays there because it can’t go any higher (it’s only being driven at 5V) and there’s nowhere for the charge to drain.

Now close the switch. Suddenly there *is* somewhere for it to drain – through the switch and to ground. The result is that everything beyond the resistor rapidly falls to ground (0V) while everything before the resistor stays at 5V. Since our Arduino pin is on the far side of the resistor (from the 5V source), it goes to ground.

However, at no point does any current flow *into* the Arduino. There’s no path for it to do so. It just changes the voltage on the pin itself.

Note: I’ve idealized the description here. With real world electronics, enough power would let you arc across the non-conducting gap in the Arduino and blow it up.

You are viewing 1 out of 6 answers, click here to view all answers.