Computer Says Go – Demystify Programming For Your Pupils By Grabbing A Piece of the Raspberry Pi

Is the inside of a computer more mysterious than that thing under your car bonnet? With a Raspberry Pi, says Sway Grantham, you and your class will fathom its secrets in no time… Computing is a creative subject at heart. It allows someone to take ideas that exist in their head and make them real. […]

Sway Grantham
by Sway Grantham
Data handling KS2 lesson plan
DOWNLOAD A FREE RESOURCE! Data handling KS2 – Use Battleships to introduce spreadsheets

Is the inside of a computer more mysterious than that thing under your car bonnet? With a Raspberry Pi, says Sway Grantham, you and your class will fathom its secrets in no time…

Computing is a creative subject at heart. It allows someone to take ideas that exist in their head and make them real. Capturing this in the primary classroom can seem impossible, but with just a few simple steps and a Raspberry Pi, a great deal can be achieved. The Raspberry Pi computer is modern, affordable and flexible. It has offered my school’s computing curriculum the variety to keep the children wanting more, and it extends the cross-curricular nature of the subject. While using a Raspberry Pi, the children have loved the fact they are working with relatively new technology and that their programs can interact with physical objects outside of the virtual world. Many students have even asked for one as a present, allowing them to continue their school learning with family and friends. How many other school resources can you say that about?

What is a Raspberry Pi?

A Raspberry Pi is a credit-card sized computer which costs around £30. It has four USB ports that you can use to plug in a mouse and keyboard, and a slot for an SD card for its memory. This small computer is surprisingly powerful for its size, but it’s not designed to replace your laptop. Instead, it offers a simple and accessible way for people to learn programming and other aspects of computing. If you buy a starter set, which is strongly recommended for first-time users, the SD will come pre-installed with everything you need to get started, including a free, programmable version of Minecraft.

The Raspberry Pi is a great tool for learning, even before you plug it in. When I first introduce the Pi to a class, I start with the declaration of “This is a computer!” – which generally leads to the children either staring in disbelief, or waiting to hear what the joke is. Intrigue and curiosity are always great ways to start a lesson. What is it? How does it work? What can I do with it? As soon as these questions start, you’ve got that class where you want them – eager to learn. Exploration is an important part of computing. If children are curious, give them time to look and think. While they are investigating, give them ways to focus their attention such as making a ‘map’ of the different ports on the Raspberry Pi and what they think each might be for. Get them to generate a list of questions too – you’ll be surprised with what they come up with. Here are some from my class:

• Why isn’t the Raspberry Pi in a case? • Does my laptop look like this on the inside? • Why does the SD card stick out? • Is it safe to have it out of the case? • How is it so much smaller than other computers?

As the teacher, you shouldn’t feel that you need to be able to answer all of their possible questions. Sometimes it can be just as powerful to redirect the question to the class and open the floor for discussion about what the children themselves think.

In the end, if you don’t know, explain this to the children and either appoint a child to research the answer on the internet or look it up yourself. The Raspberry Pi Foundation website has some great resources for getting started including introductory videos explaining the different ports on the Pi.

Getting creative

There are several reasons why the Raspberry Pi is unique from other computers, but one of the most exciting is its set of GPIO (General Purpose Input/Output) pins. These allow you to build circuits with the Raspberry Pi, plugging things like lights, buttons, buzzers and sensors straight into the computer, which can then be programmed using Scratch, or a programming language for more advanced users called Python.

Controlling physical, real-world items like these allows children to see the practical applications of learning programming – when can you remember a light showing you something? When your dishwasher has finished or your speakers are on? What about programming a button to start something? Nearly every electronic device we have responds to button presses. What about sensors in automatic doors? The children’s imaginations are the limit, as they use basic LED lights and sensors to create everything from reaction games to a light show for a fairground ride they’ve designed. The Raspberry Pi’s size also means that it can be integrated into a variety of DT or art projects as well many other curriculum areas. Let’s say that you wanted to make a car out of Lego – the Raspberry Pi could sit inconspicuously within the car and be used to program the motors to make it move, or a lighting system to turn it into a police car with a siren. Equally, the Raspberry Pi could be mounted on a display to make children’s artwork interactive. You could use a motion sensor so that every time someone walks past, the Pi could play a sound connected to the subject on display. Or how about a button which, when pressed, told the user what the children in your class had been learning?

Perfectly composed

Another creative piece of software specifically designed for the Raspberry Pi, is Sonic Pi. This is a programming environment that allows the user to program a piece of music. Sonic Pi uses written commands such as ‘play 75’ and ‘sleep 1’ to allow you to compose you own music by adding in notes and pauses with numerical values.

It also offers the challenge of ‘debugging code’, which in a piece of music is essentially a case of listening to it and deciding what sounds wrong – a lot simpler than reading a long program you’ve written and searching for bugs. Perhaps the children could program a soundtrack for a movie trailer, or some fairground music to go with flashing lights and buttons they might have programmed earlier in Scratch using the GPIO pins.

Furthermore, the latest version is compatible with Minecraft, so you can write code in Sonic Pi, or in Python, and use it to control objects and actions in the Minecraft world. The Minecraft you get is a special version unique to the Raspberry Pi that can be programmed by users, which provides kids with a great motivation for learning programming. You can write a program that builds a house without you having to tiresomely lay each block, or even make a whole street in seconds by running the same code over and over again. You can also design your own games within Minecraft, such as hiding a diamond block at a random location and getting a friend to find it. On-screen text could show how far away or close they are to it. As the children become more experienced, they can begin to use their newly learned skills to combine the different aspects of a Raspberry Pi. They could program a button to cause an explosion in Minecraft. They could program soundscapes in Sonic Pi and set them to play as they explore different Minecraft areas and landscapes. Or they could combine all these to create a warning system for when someone or something enters their Minecraft house. The lights could flash as a warning when someone gets close, and music programmed in Sonic Pi could play when the intruder steps inside. With the Raspberry Pi you don’t need a great deal of specialist knowledge – just a level of intrigue and curiosity. There are many resources already in existence for worksheets, help videos and project suggestions to get you started. From there, pursue your pupils’ interests.

As well as its range of resources, The Raspberry Pi Foundation’s website provides free teacher CPD called ‘Picademy’ which is a two-day course where you can build up your own confidence and try new things with groups of other educators.

Ok computer

Get inspired with these exciting Pi projects…

Pi in the Sky A Raspberry Pi with PiCam, was attached to a weather balloon which floated up and took photos from the edge of the Earth’s atmosphere

Weather station Using a Pi and some extra bits and pieces, monitor the amount of rain, wind direction and much more

Spy Bear Hide a Raspberry Pi inside a teddy bear and add a PiCam pointing out of somewhere (an eye is quite a discreet place). Either put a button in a paw which can take a photo, or program the bear to take a photo at specific intervals

Junk model hybrid Combine traditional junk modelling and add your own buttons, lights and sounds to make it seem alive

Robots Motors, sensors, lights and sounds can make for a very impressive robot

Sway Grantham is a primary school teacher and SLE for computing and ICT; for more information, visit or follow @SwayGrantham

You might also be interested in...