In this lesson the students will learn how to follow a diagram to build a circuit that lights a single LED. They'll also learn how to write and run a Python program. They'll be using the SD card they installed from last time. It's a good idea to have a few spare SD cards that have already been installed in case something went wrong in the last lesson.
Students will learn:
Last time the students stuck on the breadboard and the rubber feet to the holder. Now they're going to attach the Pi to the holder. Finish following the instructions to mount the Pi. Gently tighten the screws with the screw driver or do it by hand.
Load your stopwatch python program and tell the students they're going to try and beat the best records from last lesson. Read out the times and when everyone is ready start the clock.
Record the results and ask what takes the time, and how it can be shortened. Try and get the students to start working to share best practice as this will be extremely useful later.
Explain how a breadboard works using the glossary.
Explain that the students should follow the diagram in their handout to build a simple LED circuit. For now, the Raspberry Pi is just powering the LED using its internal power supply. We are unable to switch the LED on and off with this circuit.
It doesn't matter what colour wires students use.
While the students start building the circuit, look around the room to check that the Pis have all booted to the desktop. If not then turn off the power, and replace the SD card with one you know works.
Use a button to switch the LED. Show this picture for advanced students to follow:
Tell students to start Idle (not Idle3), and create a new program by clicking
Ask students to explain how the stopwatch program works. Make some predictions.
Then ask the students to copy out the stopwatch program from the handout into this new window.
When everyone has finished, they need to save their files. Ask them to save their file as
After all students have saved, ask them to press
f5 to run the program. If they've correctly typed the program they should see the stopwatch counting up in seconds.
Check everyone's screen to see this has happened. If student's predictions were wrong, discuss what is happening when the code runs.
Ask them to time themselves taking apart the circuit and putting the parts away in the correct bags.
Ask students to change the stopwatch so it counts in tenths of a second instead of quarters.
Pack away the Pi as before.
Come up with a project that requires 2 or more LEDs. Explain what will happen and draw a circuit diagram.