How To: Control LED using Raspberry PI GPIO

In this post I will take you through the fairly simple task of getting your Raspberry PI to control an LED via the GPIO interface, the task is simple however it lays a great foundation of knowledge for any further projects where you want to interface with an external electronic device.

So the first step is to install some software on to the Raspberry PI operating system via terminal or a remote SSH session. We actually want to install “wiringPi” however to do that we are going to use the very popular version control tool “git”, which should explain the following commands.How To Control LED using Raspberry PI GPIO

1. Software Setup

First we will install the core software required for git to work:

sudo apt-get install git-core

Next it’s aways best to ensure that our device is on the lastest version of software, so we will do an update and upgrade, depending on how long until you last did this it could take a while, coffee anyone?

sudo apt-get update
sudo apt-get upgrade

Ok so your back after the software update, now we are going to download the latest release of wiringPi;

git clone git://

Now go into the directory and just double check with the pull command that you have all the required files.

cd wiringPi
git pull origin

Now time to build the software with a command that’s fairly easy to remember:

How To Control LED using Raspberry PI GPIO schematic

For the physical setup you will need an LED of your preferred colour, a small 270 ohm resistor and some wire to connect everything together. I would recommend using a breadboard as well it makes all this cabling and prototyping far easier to setup and tweak.

Below is a very simple diagram on how to setup your circuit.


For more detail: How To: Control LED using Raspberry PI GPIO

© 2015 Powered By Engineering Projects Team, Raspberry Pi Projects

Scroll to top