Yesterday I tried to make my first physical computing application with python on the Raspberry Pi 3. This app was suppose to simply light an LED. I couldn't get the thing to light.

The problem I'm having is not understanding Pi wiring conventions and terminologies.

In the picture below, I have an red wire(which would be the ground wire in pure elecronics) hooked up to Pi pin #4, which is 5 volts. The other end of the red wire is hooked up to the anode(which should provide infinite resistance, and thus o current flow) of the led.

The black wire, which would be hot in pure electronics, is connected to the cathode(which should be the forward-bias), the other end of the back-wire is connected to pin 6, which is ground.

This setup lights the led, which completely confuses me, a person used to pure electronics.

What is pin 4 actually then, because if the current in my led has to be flowing towards/or into pin 4, which makes me think that its not outputing 5v, but accepting 5v across it and another point.

Pin-6 is referred to as ground, but in my set up, it is obviously the highest point of potential, and all voltage drops succeed from it, so how could it be ground?

This is making it hard for me to understand what are inputs and outputs in pi.

  • First, what is pure electromics? Second, where did you get the color scheme of red=ground (convention is black is ground). Finally, you should edit your question and add photos that show your connections. – Steve Robillard Oct 24 '17 at 21:28
  • 1
    Would be helpful if you updated your original post raspberrypi.stackexchange.com/questions/74216/… – CoderMike Oct 24 '17 at 21:29
  • @SteveRobillard can’t add photos right now, my web drowned stopped working. – Iam Pyre Oct 24 '17 at 21:40
  • I’ve connected an LED to a battery at least one hundred times by now, plus, I’m from the USA so maybe that’s another barrier of communication. When I connect the cathode(shorter end) of my LED to a battery’s black lead(negative terminal) and the the longer pin(anode) of the led to the positive terminal of the battery, I get power, a complete circuit. I don’t use conventional current, so current flow must be from the black wire(which can’t be ground) to red wire. Maybe it’s because I’m American, I don’t know, but thanks for the feedback, I think it’s an issue of conventions that I don’t use. – Iam Pyre Oct 24 '17 at 21:52
  • 1
    Thinking in terms of electron current will get you nowhere closer to understanding electronics. For example, in your battery the charge carriers may be anions or cations depending on chemistry. In a transistor the charge carriers are often a "virtual" positively charged particles. In electronics current flows from positive to negative , colors have no set meaning, in your house wiring black is hot (Line), white is Neutral and Green is Earth. Ground is only meaningful because it is a common reference potential shared across all nodes of your circuit. – crasic Oct 24 '17 at 22:43

I have no idea what you mean by pure electronics.

Pins 2 and 4 are connected to the 5V power rail. Pin 6 is connected to the ground power rail.

The power rail pins are NOT GPIO. They have power while the Pi itself is powered.

The pins connected to GPIO are switchable between off (0V) and on (3V3).

In the conventions I have seen (and use myself) a black wire is typically used for ground and a red wire for a positive supply voltage.

  • But how could power be flowing from the anode to the cathode? Anode is positive terminal, hooked up to pin 4, which you said is the 5V voltage source. Cathode, the negative terminal, is hooked up to ground. This makes no sense, the LED should be provide infinite resistance, but it’s lighting up. The polarity of the pins isn’t making any since. – Iam Pyre Oct 24 '17 at 21:32
  • 1
    @IamPyre To light a LED you connect ground to the cathode and a positive voltage to the anode. Normally you also use a current limiting resistor. LEDs only work when connected the correct way. – joan Oct 24 '17 at 21:38
  • Where are you from? if you don’t mind me asking. – Iam Pyre Oct 24 '17 at 21:53

Thinking in terms of electron current will get you nowhere closer to understanding electronics.

In the end, however, it really doesn't matter. Everything works out even if you reverse conventional current.

In electronics current flows from positive to negative, this is a rule of thumb observed world-wide to keep everyone sane. You can reverse this if you like, it won't change anything in your analysis, but you will confuse everyone you ask for information.

So, to answer your question, it doesn't matter what you consider "out" (source) and what is "in" (sink) in terms of current. A diode still needs a positive voltage across it for current to flow, conventional or otherwise.

Electron Current

It is incorrect to think of electron current as "proper current", because it very much depends on the nature of the device.

For example, in your battery the charge carriers may be anions or cations depending on chemistry. In a transistor the actual charge carriers can be thought of as "virtual" positively charged particles.

What about Transformers and Capacitors? surely current "flows" through these devices, but there are no electrons (or any other charged particle) moving across the gap!

You can, if you like, analyze every component of your circuit in terms of the real charge carriers that produce the current, however this would be an insane thing to do, extremely confusing, error prone, but ultimately provides no benefit to you as a circuit designer

Input vs Output

However, there is a very big difference between a pin that is configured "output" vs one that is configured "input". An "output" pin presents a very low resistance vs an input pin presents a very large resistance.

That is, an output pin can "source" or "sink" current much like a power supply , whereas a pin configured as input has almost no current at all to fulfill its function

Confusingly, using this analysis, both "ground" and "+5V" are output pins, meaning, they both are used to source or sink current and present a very small resistance to anything connected to them.


Colors have no set general meaning, it is very much dependent on context. for example in your house wiring (USA) - Black is hot (Line), White is Neutral and Green is Earth.

Assuming any wire is "ground", red black purple or orange, without verifying is a good way to get hurt.


Ground is just a special name given to the common reference point in a circuit. A complex circuit can have one ground or many grounds, it can even have virtual grounds. Grounds can be isolated or coupled.

Ground has nothing to do with where the electrons come from, its basically just a necessary coincidence that ground is the "source" of electrons with conventional current. All that matters is that is a "fixed point" that you use as a reference.

"Ground" is only meaningful because it is a common reference potential shared across the nodes of a particular circuit, meaning every component has a "leg" on the ground.

This means You could use a -5V power supply, relabel -5V to "Ground" and "0V" to "+5V" Everything will still work exactly as if you used a +5V power supply where "0" is Ground, assuming that the physics of the -5V supply is OK with "reverse" current.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.