Skip to content

RPi GPIO: Wiring LED

Authors: Keptan, Chester

Authors: Keptan, Chester

What can you do with the 40 pin connector and just an LED?

On top of the Raspberry Pi are a row of pins that can be given specific tasks to collect or send out data. These are called GPIO (General Purpose Input Output) pins and can be hooked up to a variety of components that either take in or send out data.

These pins are a physical interface between the Pi and the outside world. At the simplest level, you can think of them as switches that you can turn on or off (input) or that the Pi can turn on or off (output). Of the 40 pins, 26 are GPIO pins and the others are power or ground pins (plus two ID EEPROM pins which you should not play with unless you know your stuff!)

 

Usually you’ll see them like this, with our pinout overlay ontop.

You can tell what some of the pins do based on the description, 3.3V and 5.5V pins provide current. Most of the others are programmable input and output, software running on the rpi can grab these pins and turn them on and off at will; or monitor their state. In this curriculum we’ll be using node-red for this most of the time, which is a easy to use and powerful graphical programming software.

Lighting an LED

Instead of using the programmable pins, we’ll first be using 5V and GND to power the LED (Light Emitting Diode) directly:

Usually we’d program one of the GPIO pins to turn on and off, to make the RGB LED flash or change colors, but wiring it like this should make it turn on no matter what.

The 5V pin always provides a 5V current as long as your rpi is plugged in, wiring it like this diagram should turn your red light on.

What if you try connecting 5V to the G (green) or B (blue) pin?

What’s next:

Now that you’ve been introduced to what GPIO pins are you can move on to learning about controlling the LED with a software program called Node Red:

RPi Node-Red: RGB LED

Back To Top