0

Looking at the schematics of the Pro Micro, the LED in PD5 (bottom-right) is connected to VCC instead of GND, same for PB0. Why? Shouldn't they connect to GND?

enter image description here

isar
  • 485
  • 1
  • 4
  • 8
  • 1
    Why do you think they should be connected to GND? – Hearth Oct 06 '18 at 15:47
  • 1
    In order to better answer your question, could you elaborate on why you think this would be a problem? – brhans Oct 06 '18 at 15:47
  • @Felthry normally I connect a pin to a LED, then to a resistor, then to GND. – isar Oct 06 '18 at 15:55
  • @isar Having \$V_{CC}\$ at the bottom makes you an [upside-down person](https://youtu.be/XPdlrOP22NM?t=24). – Harry Svensson Oct 06 '18 at 15:58
  • 1
    As an aside. This is an example of a schematic which has an okay topology, but is poorly drawn and isn't easily readable. Higher voltages should be drawn towards the top, lower voltages towards the bottom. More on that [here](https://electronics.stackexchange.com/a/28255/7036) and [here](https://electronics.stackexchange.com/a/126427/7036). – Nick Alexeev Oct 06 '18 at 16:13

4 Answers4

2

It works perfectly fine as is.

The output of a microcontoller can be set to high or low.

High is just connecting the output to Vcc through a transistor inside the processor.

Low is just connecting the output to ground through a transistor inside the processor.

All it changes is what value you have to write to the output pin.

If the LED is connected to ground, then you write a high to the output to make the LED light up.

If the LED is connected to Vcc, then you write a low to the output to make the LED light up.

No difference in function, you just have to use a different output value.


That said, some chips are better at sourcing current (better for output high) and some are better at sinking current (better for output low.)

If you need to get maximum brightness without damaging the chip and without using external transistors, then it matters which is which.

When in doubt, use an external transistor.

JRE
  • 67,678
  • 8
  • 104
  • 179
2

Instead of having the switch on the "high" (VCC) side, these LEDs have their switch on the GND side:

schematic

simulate this circuit – Schematic created using CircuitLab

The left circuit shows the more "traditional" solution where the LED is grounded.

In both cases the switch is a transistor inside the microcontroller.

In case of "high side switching" (left) a PMOS will do the work.

In case of "low side" switching (right), an NMOS will do the work.

The LED doesn't care what you do. The LED cannot tell the difference. If you apply enough voltage across it, it will light up.

Bimpelrekkie
  • 80,139
  • 2
  • 93
  • 183
2

enter image description here

Figure 1. LEDs can be connected to positive supply or to ground. Image source: 1 GPIO - multiple LEDs.

Note the direction of the arrow in the diode symbol. This is the required direction of current (from positive to negative).

With the circuit shown in Figure 1:

  • If the GPIO is switched high (+5 V) there will be no voltage across L1 but there will be 5 V across R2, L2 so current will flow through L2 and it will light.
  • If the GPIO is switched low (0 V) there will be no voltage across L2 so it will turn off. Instead, current will flow from the +5 V through R1 and L1 to ground and it will light.

Your circuit is the same as Figure 1 but with R2 and L2 left out.

Transistor
  • 168,990
  • 12
  • 186
  • 385
  • I know the error is initially on the schematic, but the diodes really shouldn't be referred to as L1 and L2. – user3190797 Oct 07 '18 at 08:14
  • That's the default designation for LEDs on Digi-Key's [Scheme-It](https://www.digikey.com/schemeit/) that I use for illustrations on my website. They also use 'L' for inductors so it is confusing. There is no way to change the default designation as far as I can see and I would have to manually edit each LED component. Maybe I should. Thanks. – Transistor Oct 07 '18 at 08:35
0

There is no real reason that those LEDs need to connect to GND. It is a design choice as to how to connect them. In the case shown the design choice may have been to be able to light the LEDs when a low logic level was commanded to the output pin. Another consideration may have been related to the default operational state of GPIO pins so as to manage power up and power down behavior.

Michael Karas
  • 56,889
  • 3
  • 70
  • 138