Thursday, January 30, 2014

How To Turn ON An LED light with a Rasberry Pi

After teaching computer programming to high school students for a few years, I realized  students need more tactile examples to keep them motivated. Therefore, I decided that with my Intermediate programming class, I would start teaching Python using Raspberry Pi's. It has turned out to be a great experience and a perfect motivator since they are having fun learning. Since Python can control functions on their Raspberry Pi's, I have seen students get very excited about learning how to code. 

My class started out with this easy light up an LED project since most of my students didn't know anything about electronics or circuits. Below I have listed the basic items, vocabulary and steps you can use with your students. In the next tutorial I will show you how to program the GPIO software on the Raspberry Pi to make the LED light blink. 





Class Time Needed
45 - 50 minutes (students did the vocabulary the day before)


Vocabulary
Solderless Breadboard, Basic Circuit, LED (Light Emitting Diode), Volts, Amps, Ohms, Negative v. Positive charge, grounding cables

Classroom Setup


I have a class of 21 and almost every student has purchased their own Raspberry Pi but I allow my students to work in groups of 2-3. Each group needs all of the materials below. My students turn in a video of their LED lighting up digitally on Edmodo for a grade, therefore, I have added a digital video camera (most used their phones) to the list but this is optional. I have also included links to all the materials so you can get more information or to purchase these.

Materials

Raspberry Pi Model B
Breadboard
LED light bulb 
2 Wires preferably different colors
Header Pins to make the wires male
2 small jumper cables
Power Supply for the Raspberry Pi
Digital Video camera (optional)

Assembly (see video for explanation)
1. Power your Raspberry Pi (see above link for recommended power supply)
2. Connect your 2 wires to the Raspberry Pi. Starting from the bottom closest to SD card  
connect pin 1 with the black wire on right 
- connect pin 3 with red cable on left
3. Connect your jumper cables to the breadboard 
- grey cable to the blue line on the breadboard (this is the ground cable)
- red cable to red line on the breadboard
4. Connect your LED light to the breadboard 
- the longer end will go where the grey cable is connected
- the short end of the LED light will go the where the red cable is connected
5. Connect your red and black cable to the breadboard. 
- the black cable will go into any area of blue line and the red cable to any area of the red line
- the red and blue lines on the breadboard let electricity flow straight so if you put the cable anywhere on that row it will make the entire row active
6. If you connected everything correctly you should immediately see the LED light up.
7. If it doesn't light up check your LED light (go back to step 4), check your red and black cables are in the right pins and areas on the breadboard (go to step 5), etc.



Programming and Software
No programming is needed for this lesson just power and the supplies to make the LED light up. The Raspberry Pi will light up without any modifications to your operating system or any need for software.

Resources
Where to buy A Raspberry Pi
101science.com - Good Electronics Explanations
Introduction to Basic Electronic Concepts - This site helped my students learn how to draw a circuit and the basic needs of assembling a circuit.
My Rasberry Pi Pintrest Bookmarks - inspiration and good resources on what to do with your Rasberry Pi

Alternate Assessment
Students in my class turned in videos of their lighting up LED's via Edmodo. A small quiz was posted on Edmodo the day after to check student learning.

Questions
Feel free to post questions or comments.