# Doesn't voltage on ground make it not ground anymore?

simulate this circuit – Schematic created using CircuitLab

Beginner here, trying to learn enough to start using a microcontroller.

1. If the I/O pins are internally high, wouldn't pressing one of the buttons put voltage on the ground wire, making it no longer ground? Including Vss?

2. I added R1 = 100Ω based on the STM8S003F3 datasheet max "Total current out of VSS ground lines (sink)" = 80 mA, and R2 = 270 Ω based on max "Output current source by any I/Os and control pin" = -20 mA. Am I doin' it rite? Is an additional resistor needed to limit current through (decoupling capacitor) C1?

• Your schematic doesn't show which node you've defined to be ground. – The Photon Mar 27 '15 at 20:09
• Sorry... I actually can't find the symbol in the editor. But I thought it was always the negative terminal on the battery. – Brandon Lockaby Mar 27 '15 at 20:26
• Why on earth do you have a resistor connected to VSS? VSS/ground pins for ICs should be connected straight to ground. – Adam Haun Mar 27 '15 at 20:44
• You normally don't need a resistor on either the Vdd/Vcc or Vss/ground pins of an integrated circuit unless the datasheet says so. Digital ICs don't need any supply current limiting, and analog ICs usually have their own internal bias circuits. – Adam Haun Mar 27 '15 at 21:25
• Wow, get rid of R1. That will not help at all. – George Herold Mar 27 '15 at 22:08

Ground is not 0V.

Ground is merely a point of reference from which all other voltages can be measured.

Note: A voltage is a potential difference between two points. When you measure 5V you are measuring a 5V difference between two points.

It is entirely up to you what point in your circuit you choose as ground. Normally it is the point of "least potential" (such as the - terminal of your battery), but not necessarily.

So your "ground" is always "ground" because that is what you have chosen it to be. The voltage at ground, with respect to ground will always be 0V, since nothing can have any difference to itself.

When you press one of your buttons (with those two resistors removed, please) the lower side of the internal resistor (I assume that is what you mean in your question) is connected to ground, thus making that point measure 0V. When the button is released there is no connection to ground, so the voltage at that point is the supply voltage minus whatever is dropped by the resistor caused by any current flowing through it (typically a very small amount for an input pin).

• I agree that the 100ohm resistor should be replaced with the wire. However, the other resistor can only be removed if the uC pins are configured as inputs (and they should be pulled up or down to avoid undetermined state, unless they are internally pulled up or down). If the pins are configured as outputs, there should be a pull up / pull down resistor. This will ensure that there is no "short" when you output "HI" on the pin which is connected to "LOW" / ground. – Nazar Mar 27 '15 at 20:36
• @Naz You should have one per pin, not just one global one like that. With the single resistor, if you have one pin as output-high and another as output-low and press both buttons you will still get a short. – Majenko Mar 27 '15 at 20:38
• That's right - one per pin. And you do not need to make a 20mA current. This is the maximum it can handle. You can use 10k resistor which will give you <0.5mA. This is a very common value to use. – Nazar Mar 27 '15 at 20:43
• And to answer question 1: with current diagram, when you press one of the buttons, where will be 4.5V on the right of R2 and 0V on the left of R2 measured with respect to the negative battery terminal. Thus, pressing the button will not put voltage on ground. – Nazar Mar 27 '15 at 20:50
• You do not need a resistor in series with the capacitor. As you will learn later, the resistor will decrease the time for the capacitor to charge - thus, mitigate the initial purpose of the capacitor. – Nazar Mar 27 '15 at 21:07

One important concept that you are missing is when saying the inputs are internally "HI" is that they are not directly connected to the Vcc. Instead, they are "pulled up" which means connected to Vcc through a resistor.

So, when the button is not pressed there is no current flow and the voltage on the internal resistor on both sides is equal to Vcc. When you press the button (and if R2 is absent), you force a ground on the pin. Thus, pressing the button will put ground on the pin, and not voltage on ground. The Vcc will remain on one end of the internal resistor, and ground will be on the pin and the end of the resistor that is connected to it.