LED Light - Things Needed

For this instructable I will show you how to make a LED light turn on and off with the use of a Raspberry Pi, and some Python programming. The things that you will need for the project are as followed: LED light, Jumper leads, breadboard, USB power supply(to turn on the RaspberryPi), Micro SD card, and Raspberry Pi. You will also need things that will allow the user to maneuver around the Raspberry PI graphic user interface like a HDMI and monitor to see whats going on, and a mouse and keyboard to maneuver around.

Step 1: Set Up - Raspberry PI

I will not go into step by step specific on how to set up the Raspberry PI since that could be a Instructable all on its own. Instead I will just give you a quick run down. you will need to go to https://www.raspberrypi.org/downlaods/noobs and download a file called Noobs which has Raspbain(the operating system) in it. Noobs is a easy to setup version of the operating system that will help explain the system for new users. You will then extract the file that has been downloaded and place it onto a Micro SD card, that will then be injected onto the Micro SD slot in the Raspberry PI. When you Turn on the Raspberry PI it will then run the Noobs program, and teach you how to use the operating system.

Step 2: 1. Getting Started

You will need to take out your Raspberry Pi(is a series of small single-board computers) and your breadboard(a solder less device for temporary prototype with electronics and test circuit designs). You will need place one of your LED lights into two of the pins that are in the breadboard. It doe not matter which two holes you place your pin, the only requirement is that you place the pin in to adjacent holes.

Step 3: 2. ALWAYS Use a Resistor

You will sometimes see people connect the LED directly onto the GPIO ports of the Raspberry PI, this is very bad since it could cause damage to the ports, or damage to the Raspberry Pi altogether. In this Project we will be using a 470 ohms Resistor(resistors are used to reduce current flow), which will allow the LED to be visible without running the chance of damaging the Raspberry Pi. You want to place the one of the resistor pins next to the top pin of the LED, and the other pin at the top of the row.

Step 4: 3. Connecting to the Raspberry Pi

We will now connect the breadboard to the Raspberry PI, we will do this by using jumper leads. We will want to use two different color leads so that we do not confuse yourself. It is suggested that we use the colors blue and red for leads. The red signifies positive connections, and the blue signifies negative connections. Next we will use the blue lead (ground connection) and place our pin in the hole that is next to the bottom pin of the LED, The other side of the blue lead will then be connected to the Raspberry PI we can place the lead anywhere that it says ground (look at diagram ), we will place it on third down from the top of the right hand side. The red lead will be placed on the same row as the resistor( so the current is regulated), and the other side will be place onto the GPIO port 18 (six down from the top of the right hand side)

Step 5: 4. Using Python

Now we will jump over to the Raspberry PI graphical user interface and open up Python. the First thing we want to do is type Sudo python, this will allow us to the GPIO pins (normal python doesn't allow us to do this). Next we will want to import the Rpi.GPIO library that allows us to interface onto the hardware of the Raspberry pi we will rename Rpi.GPIO to just GPIO for easier typing. We will now have to set the mode so that the program knows which pins are located where. For the program to run we will also need to declare what pin will do what, so we will declare that pin 18 will be a output. Lastly we will tell the program to output current on pin 18 and write True so that it allow for current to pass through. If we put false instead of true it will cause the led to turn off.

Step 6: The END

What I have shown you here in this Instructable is only a fraction of what you can do with a Raspberry Pi and python. For the combination of these two the sky is the limit, even for what I have shown you there are many things that you could add to it. For example it is possible to had a switch that will allow for the LED to turn on every time that you press down the switch. Many things are possible as long as you have the time, and desire to do it.

Share

    Recommendations

    • Arduino Contest 2019

      Arduino Contest 2019
    • Trash to Treasure

      Trash to Treasure
    • Tape Contest

      Tape Contest

    Discussions

    0
    None
    Penolopy Bulnick

    5 weeks ago

    Lots of great information on using LEDs :)