LED - Let there be light

In this activity you will connect a Light Emitting Diode (LED) to your Raspberry Pi's GPIO (General Purpose Input Output) Pins.

Warning!

  • Make sure your circuit on your breadboard is not connected to your Pi

  • Double check you circuit before you connect it to your Pi

After you have created the circuit you need to write a simple Pyhon program controlling the LED state being on or off.

Your program will introduce the concepts:

  • importing modules

  • setting GPIO pins

  • variables

  • user input from screen

Equipment Used

  • One LED

  • Breadboard

  • Male to Female Breadboard Wires

Raspberry Pi

The model Raspberry Pi we use is the Pi 3 Model B V1.2. Older models are compatible with our programs and electronic diagrams provided you use GPIO.Board for the pin numbering.

Creating the circuit

The LED has to be connected in the right way. The electricity can only flow one way through a diode and a LED (a Light Emitting Diode). For the sake of this activity we assume the flow of electricity is from positive to negative. For a more correct explanation look at this article in WikipediA.

The anode (+) is the larger pin on the LED and the cathode (-) is the shorter pin. Also on the housing of LED is a flat part on the rim on the side of the cathode.

Pin 11 will supply the 3.3 volts to the LED when activated in your Python program.

Pin 6 is the ground pin completing the circuit when Pin 11 is turned on.

Make sure your Pi is turned off from the power when you connect the LED circuit to your Pi!

Check the circuit before connecting the Pi to the power

A bit more about breadboards

The five holes on a Terminal Strip are connected.

Please note!:

  • The four Power Rails are separate and NOT inter-connected.

  • All Terminal Strips are separate and NOT inter-connected.

  • The Terminal Strips are NOT connected across the Divider

The Divider is used for IC chips and to straddle parts such as switches, LEDs and chips.

This site provides a more detailed explanation on the use of a breadboard.

Last updated