Control LED Using Raspberry Pi GPIO

Hardware components:
Pi 3 02
Raspberry Pi 3 Model B
× 1
09590 01
LED (generic)
× 1
08377 02 l
Resistor 330 ohm
× 1
12002 04
Breadboard (generic)
× 1
826 04
Male/Female Jumper Wires
× 1

Story control led using raspberry pi gpio

This is a basic project to connect an LED to RPi GPIO and control using a python script.

Step 1: Components

You'll need the following components to connect the circuit.

1. Raspberry Pi2. LED3. Resistor – 330 ohm4. Breadboard5. 2 Male-Female Jumper Wires

Except for the Raspberry Pi, you can buy a basic starter kit which will include all the other components.

Step 2: Connecting the Circuitschematic control led using raspberry pi gpio

Please keep the Raspberry Pi turned off until the circuit is connected to avoid accidentally shorting any components.

The LED has 2 legs. The longer leg, ‘anode', is always connected to positive supply. The shorter leg,'cathode', is always connected to ground.You need a resistor is the circuit to limit the amount of current in the circuit. Without the resistor the current flowing through the LED will be much larger and lead to a short damaging the circuit.You can identify a 330 Ohm resistor using the color coding on the resistor:

  • If there are four colour bands, they will be Orange, Orange, Brown, and then Gold.
  • If there are five bands, then the colours will be Orange, Orange, Black, Black, Brown.

Connect the circuit:

  • Use a jumper wire to connect the ground ( Pin 3) of GPIO to rail marked in blue on the breadboard.
  • Connect the resistor from the same row on the breadboard to a column on the breadboard.
  • Connect the LED with the cathode in the same row as the resistor. Insert the anode in the adjacent row.
  • Use another jumper cable to connect the GPIO Pin 21 ( 3.3 V) in the same row as the anode of LED.

This completes the circuit. Refer to the picture and the schematic above.

For more detail: Control LED Using Raspberry Pi GPIO


About The Author

Ibrar Ayyub

I am an experienced technical writer with a Master's degree in computer science from BZU Multan University. I have written for various industries, mainly home automation, and engineering. I have a clear and simple writing style and am skilled in using infographics and diagrams. I am a great researcher and is able to present information in a well-organized and logical manner.

Follow Us:
LinkedinTwitter
Scroll to Top