By 2020 it is estimated that there will be 50 billion things connected to the internet, from cows to fridges to cars. This is known as the Internet of Things. In this lesson students will build the simplest Thing - a button that lights an LED across a network.
Students will be aware of how widespread and important networks are from lesson 1. They should be comfortable with terms used in that lesson, such as IP address, server, and client. The plenary could be used as a refresher.
- Know that a computer server can send data to another computer on a network
- Know that data received over a network can cause something to happen on the client computer beyond displaying a screen message
- Explain that computers on a network can send data to each other, and that this data can make the receiving computer do something
- Use a simple program to control hardware across a network
- Hack a program to make it do something usefully different
- Adapt a program to make a Raspberry Pi control hardware on another Pi to behave in a specific way
- Introduction to physical, networked computing
- Extends Lesson 1: controls hardware on the client machine instead of screen messaging
- Control another Raspberry Pi's GPIO pins over a network
This can be done on paper or as drag and drop on an interactive whiteboard.
- Students have one minute to rearrange the Python code on the code review into the correct order.
- Show the program running. Discuss what goes where and why, e.g. importing modules, functions, while loops etc.
- Show video of PA's Raspberry Pi competition for schools and explain that all of the projects rely on a server controlling some physical aspect of a Raspberry Pi e.g. sensors, displays, pumps, camera etc.
- Explain that the students will connect two Raspberry Pis in a similar way to lesson 1, but this time they will control hardware instead of sending text.
- Students should set up the network and control LEDs on another Pi using the Student Worksheet.
- Extension ideas: add screen messages for feedback, change how the LED flashes, change the physical button (e.g. a "pressure pad" made out of foil), add another LED (advanced).
- Optional: If you will be using the SD cards again on a network, students will need to undo their changes to the
interfacesfile. Ask them to do this as per the 'Cleanup' section of the Static IP address guide given in the previous lesson.
Ask each group to stand up and explain what changes they made to their program and how they did it. Display their code on screen if you have the capability, and ask them to explain the logic and any syntax of their hacks.
- Show students the source of the "50 billion things" quotation.
- Ask them to research and prepare a speed talk (1 minute) for next lesson, either arguing that the IoT is a good thing or a bad thing (no fence sitting!). If they want to use slides they should be pictures only, no words.
- Next lesson pick several at "random" to stand up and give their talk, giving equal time to each side of the argument. The class votes on which wins.