Download as pdf or txt
Download as pdf or txt
You are on page 1of 20

FREE RESOURCES FOR THE CLASSROOM

EDUCATOR
’S
EDITION

The official Raspberry Pi magazine Education special issue raspberrypi.org/education

RASPBERRY PI
FOR
EDUCATION
FIND OUT HOW THE RASPBERRY PI FOUNDATION HELPS EDUCATORS
AROUND THE WORLD TEACH COMPUTING IN SCHOOLS

FROM THE MAKERS OF THE OFFICIAL RASPBERRY PI MAGAZINE


Contents
Education special issue raspberrypi.org/education

> WELCOME TO THE COMMUNITY 03 FREE


Foundation CEO Philip Colligan introduces Raspberry Pi
TEACHER
> THE DIGITAL REVOLUTION 04 TRAINING
Explore the digital making revolution in education

> PICADEMY: FREE TRAINING 06


Helping educators deliver computer science

> SKYCADEMY: THE SKY’S NO LIMIT 07


Take your pupils to the edge of space with our free training
The Raspberry Pi Foundation offers free teacher training. 06
> ASTRO PI: YOUR CODE IN SPACE 08 Find out how to become a Raspberry Pi-certified educator today!

How pupils are working with ESA astronaut Tim Peake

> CODE CLUB 10 ADVANCING ASTRO PI: YOUR


Learn about the nationwide network teaching kids aged 9-11
COMPUTER
12 CODE IN SPACE!
> ADVANCING COMPUTER SCIENCE 12 SCIENCE WITH
Get free learning resources for kids and teachers
RASPBERRY PI 08
WELCOME
TO THE
COMMUNITY

The Raspberry Pi Foundation


produces free resources for Find out how a collection of school

CEO Philip Colligan introduces the UK tech 03 learners and educators all over
the world. Learn more here…
coding projects from around the
country found their way onto the ISS
charity, the Raspberry Pi Foundation

FREE COMPUTING RESOURCES

MAKE MUSIC HACK & CODE


14 WITH CODE WITH MINECRAFT

THE MAGIC 16 18 CODE CLUB


10
8 BALL Learn more about our nationwide
Help your students build Learn how Sonic Pi Ten-year-old Jasper is a coder and network of volunteer-led after-
their own soothsayer crosses the line between writer. Here he demonstrates a simple school coding clubs for children
step-by-step on the Pi music and code but fun project for Minecraft on the Pi aged between 9 and 11

2 Educator’s Edition raspberrypi.org/education


Welcome

WELCOME
TO THE RASPBERRY PI
COMMUNITY
Find out how the Raspberry Pi Foundation
supports a global community of educators
and how you can get involved.

he chances are that you’ve heard about


T Raspberry Pi; the low-cost, credit card-sized
computer that was developed to encourage kids
to learn how to code. We launched the world’s first $25 A global community of educators
computer in 2012. By the end of 2015, we’d sold over At the heart of Raspberry Pi is a global community
seven million and helped kick-start a global movement of educators who are working inside and outside
to create the next generation of digital makers. the classroom to inspire kids to get creative with
What’s perhaps less well known is that The technology. Our job is to provide that community
Raspberry Pi Foundation is much more than a computer with the support they need. One of the ways we
company. We are a UK-based educational charity with do that is by developing high quality teaching
a mission to put the power of digital making into the resources and projects, many of which don’t require
hands of people all over the world. One of the ways that a Raspberry Pi computer, all of which have been
we pursue that mission is by providing low-cost, high- designed by educators, and which are all available
powered computers, but it isn’t all we do. for free.

We’re proud to be part of a movement which


aims to empower people to shape their world
More than a computer company Over the past three years we’ve also trained
Because we’re a charity, we’re able to use any and all hundreds of Raspberry Pi Certified Educators
profits that we generate from our commercial activity through our Picademy programme of free
to invest in educational programmes and outreach, professional development. It has been amazing
resources, training and support for educators, and for us to see so many of those Certified Educators
building a global community that shares our mission. go on to support other educators to develop their
Through our network of Code Clubs (see page 10), practice, whether as CAS master teachers, by
we’re making sure that opportunities to get involved organising meet-ups, or by creating and sharing
in digital making are as widely available as possible, their own resources. This is the most exciting part
mobilising a huge community of volunteers and of our work: seeing the community of educators grow
educators in the process. and support each other. We’re constantly inspired by
Through programmes like Astro Pi (see page 8), what they do.
we’re helping to make computing more relevant We’re proud to be part of a movement which aims
to young people who might not have thought that to empower people to shape their world through
digital making was for them, but who are excited by digital technologies. If you’re not already, then
human space exploration. We’re doing the same with I hope you’ll get involved.
music, nature, and the arts, taking a deliberately
cross-curricular approach that engages young people Philip Colligan,
with very different interests. CEO, Raspberry Pi Foundation

raspberrypi.org/education Educator’s Edition 3


Feature

DIGITAL
MAKING
REVOLUTION
IN EDUCATION
The digital maker movement, a mix of traditional artisan arts and crafts
combined with computer programming and electronics, has been taking
the world by storm. Its ethos of tinkering and inventing is being used
in the classroom to inspire a whole new generation of makers.
Making lessons more engaging
and relevant for learners
Raspberry Pi computers, and other similar devices,
are unlike the traditional computers you would find
in classrooms up and down the country. Rather than
a hermetically sealed box, designed specifically to
prevent a student from poking and prodding around
with the internal components, you are presented
with a single board computer with all the parts
exposed. This design decision is not an accident:
We want to demystify computers, to allow children
to see that there is nothing to be afraid of, to show
them exactly where the operating system can be
found, and to let them experiment with controlling
electronics using the General-Purpose Input/Output
(GPIO) pins.
HACKATHONS The design also poses questions for teachers who
wish to deploy Raspberry Pi computers in their
Hackathons are events at which groups of individuals will build a classrooms. Do you have them as fixed pieces of
digital product from scratch, often over a single twenty-four hour equipment, permanently attached to power supplies,
period. Fuelled by pizza and cola, as well as by their own enthusiasm, keyboards and mice? Do you use cases, and, if so,
students can work together to build anything from internet-connected which one? Do you give students their own SD card, or
Christmas trees to the next great social networking app. The events should they share? How do you keep the software up-
are competitive but very supportive, and always lots of fun. to-date and ensure that students can always access
Hackathons are a great way to encourage creativity, problem- their work?
solving and teamwork within the sphere of computing and digital These are all natural concerns, especially if you
making. There are plenty of student hackathons organised all over come from a traditional teaching background, but
the country, and mlh.io is a good place to start if you’re looking maybe the first question you should be asking yourself
for an event near you. is: How do I make computing more engaging and
relevant for my students?

4 Educator’s Edition raspberrypi.org/education


DIGITAL MAKING REVOLUTION IN EDUCATION Feature
Invent to learn
A recent Nesta report found huge positivity towards
digital making: 82% of young people say they are
interested in digital making and that parents are
overwhelmingly supportive. 89% of parents think it is a
worthwhile activity for their children and 73% encourage
their children to make things with technology.
So how can you tap into this wealth of enthusiasm
in your classroom? The first step is not to worry too
much about the practicalities of using hardware such
as the Raspberry Pi, Arduino or a Microbit. Things are
going to get messy, no matter which platform you use,
but that’s part of the learning process for you and your
students. In recent years, much has been made of the
long-forgotten art of tinkering. Children have been
encouraged to not break anything, but this is essential
to discovering what works and what doesn’t. The word
RASPBERRY JAMS
‘fail’ in digital making is used as an acronym for ‘first
Raspberry Jams are community-organised events with a focus on digital
attempt in learning’.
making and the Raspberry Pi computer. Jams are filled with talks, show
By bringing physical computing devices into the
and tell sessions, and workshops, all showcasing the wonderful, useful
classroom, students gain from learning how to set kit
and often wacky projects that can be created with a Raspberry Pi, a little
up themselves, including monitors, keyboards, and
skill, and a lot of creativity.
mice. Playing with breadboards, buttons, and other
If you’re interested in attending a Jam near you, then check out
electronic components teaches students to not be afraid
raspberrypi.org/jam for a list of up-and-coming events.
of technology.

Tackling the digital divide


Computing skills can provide opportunities for social How the foundation supports makers
mobility. A recent Naace report on Computing in the Bringing the maker movement into the classroom is one
National curriculum discusses this, noting that: “those of the charitable aims of the Raspberry Pi Foundation.
who excel...are in high demand across large parts of Our team of experienced educators write fun, engaging,
the economy”. The report advises that it is important and flexible learning resources, all of which are linked
to ensure that all pupils have the opportunity to study to curriculum objectives. They are published under a
outside the classroom. Free and/or open-source Creative Commons license that allows you the flexibility
software and low-cost hardware massively lower the to adapt them to suit your needs (see pages 12 & 13).

82% of young people say they are interested in digital


making and their parents are overwhelmingly supportive
barriers to participation in computing. Raspberry Pi We provide free professional development for teachers
Certified Educator James Robinson explains: worldwide through our Picademy programme. You can
“We asked our GCSE class to purchase Raspberry Pi learn more about our training initiatives on page 6.
computers to use both at home and at school and, where We have sent two Raspberry Pis and Sense HATs
appropriate, we were able to use pupil premium funds to to the International Space Station as part of British
support students. This meant that our entire cohort had ESA Astronaut Tim Peake’s Principia mission. In
their own general-purpose computer they could use for 2015 we also gave away 1000 Raspberry Pi weather
classwork, but more importantly their own projects. stations worldwide for students to build, program, and
“Once all the students had access to identical collect data. We also work closely with developers and
hardware, we were able to set much more challenging, academics to build education-tailored applications like
open-ended and engaging tasks...We used some Sonic Pi, a cross-platform programming and music
lessons to cover the basics of programming a making tool.
Minecraft world while students worked on project- Fired up to find out more and get involved? Visit our
based homework. The results were fantastic: each education web page for access to news, events, free
student interpreted the brief differently and used resources, our educator community, maker project
varying techniques to solve the problem.” articles, and much more! www.rpf.io/edu

raspberrypi.org/education Educator’s Edition 5


News PICADEMY

MANY
USEFUL
IDEAS
“Picademy’s
Continuing
Professional
Development
was excellent
and it gave me
many useful

PICADEMY:
ideas to go back
to school with,
particularly the
use of Minecraft
Pi. It was a great
experience to
spend time with
like-minded
people who
could see how

TEACHING THE TEACHERS


the Pi can be
of benefit in
supporting
the computing
curriculum. I
use the Pi in my Picademy is the Raspberry Pi Foundation’s FREE teacher training
school, and I
teach workshops initiative, and aims to give educators the skills they need to begin
on Minecraft
Pi and Python teaching computing with confidence.
programming.”
Sarah Zaman,
primary Why Picademy? Picademy aims to give teachers On day two, the teachers have
computing Getting started with the computing the skills and knowledge they need free rein to come up with their
teacher and
curriculum can be daunting. There’s to get creative with computing, own project ideas. Previous
Raspberry
Pi Certified a host of hardware and programming no matter what their level of projects have included killer
Educator languages, and a baffling array of experience. It’s a two-day course robots, Christmas jumpers with
technical terminology. However, that allows educators to experience twinkling LEDs, bespoke games in
the barrier to getting started rarely some of what can be achieved with Minecraft, and many more. They
has much to do with technical a little help and a lot of imagination. reinforce the skills they learned
proficiency or programming We are regularly blown away by what on day one, and also practice
Below Teachers knowledge. Confidence is typically educators create. decomposing problems, testing,
graduate as
the main issue, and early setbacks debugging, and building resilience.
Raspberry Pi
Certified Educators can have a huge impact on this. What’s Involved? Our attendees leave as Raspberry
Day one involves running through Pi Certified Educators, ready to
a series of workshops introducing share their newfound enthusiasm
our teachers to physical computing with other educators and children.
using the General-Purpose Input/ Thanks to the generosity
Output (GPIO) pins on the Raspberry and support of our friends at
Pi computer to control electronic Google, teachers can now apply
components like LEDs and buttons. for Picademy hosted at Google’s
All programming is done either in new venue, the Digital Garage in
Scratch or Python. There are also Manchester in February and March
sessions based around using add- before we hit the road and set up
on boards like the camera module in another city in the UK. To find
or Sense HAT, coding music with out when and where our next
Sonic Pi, or terraforming the world Picademy event is running, visit
of Minecraft. rpf.io/train.

6 Educator’s Edition raspberrypi.org/education


SKYCADEMY News

24 teachers took to the outdoors to launch some high-altitude


balloons in a brand-new Picademy

itching a ride on a Soyuz second day the teams launched It’s really important to us that
H rocket is not the only way
to get a Raspberry Pi into
their own payloads following
a demo launch by seasoned
it’s not just a bit of fun for a few
days, it’s a great opportunity to
ANATOMY
OF A FLIGHT
the stratosphere. High Altitude professional Dave Akerman. Our explore the power of project- > A large helium
Ballooning involves sending a educators then had the task of based learning using a range of balloon lifts a
small electronic device or ‘tracker’ tracking their flight by car in the disciplines including science, small (<500g)
payload up to
into the upper atmosphere using a hope of recovering their payload technology, engineering, and 35km, where the
meteorological balloon. That’s what as it landed. The payloads reached computer science.” balloon bursts.
our recent Skycademy course was heights of around 35km, capturing We’ve since seen several > After the burst,
all about: a Picademy designed to images throughout their flight. launches by our educators, the payload falls
show educators how to deliver their At the apex people could view the including a flight from PyCon UK using a small
parachute to
own near space project. curvature of the Earth and the in which teachers sent trinkets like slow its descent.
James Robinson, who leads the black of space! Lego figures up with the payload.
> The payload
project, explains: “Having run a Bourne Grammar School ran our contains a
[HAB] launch myself in school, I’d Skycademy Continues first entirely student-led flight, flight computer
seen how engaged and inspired my Skycademy wasn’t just those three with pupils managing everything (Raspberry Pi)
connected to a
students were, seeing that reaching days though, the attendees will including the chase and recovery. GPS antenna, a
near space was within their grasp. report back over the next several Glebe House School captured radio transmitter
We wanted to share that experience months about their own launches. amazing images of the Norfolk and camera.

with other educators and, while the James explains: Coast during their flight. > The payload
project involves several disciplines, “The event marks the beginning We’re looking forward to seeing continually
collects GPS
getting to grips with each is not of a year-long project where what the rest of our educators do data and images
too difficult.” The initial goal was we’ve funded each of the newly- over the coming year. To find out and transits
simple: give some enthusiastic qualified educators to run a launch more about Skycademy, visit them via its
radio.
educators the hands-on experience themselves with their students. rpf.io/skycademy.
>O
 n the ground
and confidence to do their own
listeners can
supervised launch, and then hope receive the GPS
they return to their students fired data and use it
to predict the
up to run their own projects.
landing site.

Teacher Training
After juggling the places and
managing a waiting list, on 24
August 2015, four teams of six
teachers from around the UK met
Left High above
to begin their training. Over three
the Earth, our
days the teams learned how to intrepid weather
balloons take
build, configure, and track their
shots of the
High Altitude payload. On the world below

raspberrypi.org/education Educator’s Edition 7


News FEATURE

The first picture of the


Astro Pi flight unit in
space taken by Tim

ASTRO PI:
Peake in early January.

FOLLOW US
ONLINE
YOUR CODE IN SPACE
The Astro Pi units Find out how your students can code software for British ESA
will remain on the
ISS until 2022 and Astronaut Tim Peake to use on the International Space Station
we hope to run
many more Astro
Pi competitions,
What is Astro Pi? Tim Peake to run aboard the Python programs, written and tested
challenges, If you’re looking for a way to International Space Station (ISS). by the school pupils using their own
and interactive inspire your students to learn Two augmented Raspberry Sense HAT boards and Raspberry
activities
about computer programming you Pi computers (called Astro Pis) Pis. The winning programs, now
between now
and then. If you won’t struggle to get them excited have been flown to the ISS as the part of the Astro Pi payload, blasted
follow us on about this! Simply say: “Do you platform on which to run these off from Cape Canaveral Air Force
social media
want your code in space?” and experiments. They include a Base in Florida back in December
you can keep
up to date on watch as their mouths hang open special sensor board, a Raspberry and arrived at the ISS a few days
everything that while they take in the scope of Pi peripheral called the Sense HAT. before Tim. They range from fun
is happening!
what you just said. This can measure the environment reaction time games to serious
Twitter Computer programming is inside the ISS, detecting how science experiments looking
@astro_pi an incredibly important skill the station is moving through at space radiation.
@astro_pi_vis
and one that is in high demand space, and measuring the Earth’s During his mission Tim Peake
@astro_pi_ir
within the UK’s space industry. magnetic field. will deploy the Astro Pis inside the
Facebook So, back in 2014, Raspberry Pi What would you do with a piece of European Columbus module and
rpf.io/apfb
joined forces with the UK Space equipment like the Sense HAT? Look run each of the student programs
Agency, the European Space for cosmic rays? Make a timelapse of in sequence. Finally, the results
Agency and the UK Space Trade the Earth through a hatch window? will be downloaded back to Earth,
Association to run a competition. Maybe just give Tim games to play? returned to the students that took
This gave school-age students This was the premise of the 2015 part, and made available online for
in the UK the chance to devise Astro Pi student competition which everyone to see.
computer science experiments produced seven winning teams. Want to learn more? Visit
for British ESA Astronaut Their experiments are in the form of astro-pi.org for more information.

8 Educator’s Edition raspberrypi.org/education


ASTRO PI: YOUR CODE IN SPACE News
What age is this for? also have a variety of free
Astro Pi is aimed at both primary educational resources to introduce
and secondary level. The primary students to using each sensor,
school competition was aimed at followed by examples of how
students aged 11 and under. They the hardware can be used in
were required to submit an idea space. Check them out here:
for how they would use the Astro astro-pi.org/resources
Pi computers on the ISS. These The code that won the Astro
were then judged based on their Pi competition can also be
originality, creativity, practicality, downloaded and run by your
and usefulness. Two winners were students as an example of
chosen who then worked with the what can be achieved with the
Raspberry Pi Foundation to code, hardware: github.com/astro-pi
test and prepare their software. Alongside the competition
The secondary competition was winners’ programs, Tim will be educational outreach. Depending Above Hannah
Belshaw’s program
for students aged 11 to 18. Phase using the Astro Pis to run a long- on his available time, we hope records sensor data
one was identical to the primary term ISS environmental monitoring he will invite more students to from the Astro Pi
and represents it in
competition and ran in parallel; in program which will produce a CSV write programs for him to run a Minecraft world.
phase two, students were required file full of time-stamped sensor in space. So there could be yet She appeared
alongside Tim
to code their experiments on their readings which can be downloaded more opportunities to get your Peake on The One
own Raspberry Pis with Sense Show broadcast on

Get your code running on


the BBC on the 6th
HATs and to submit the completed of November 2015
software. These were judged again

the ISS during Tim’s mission!


against a number of space themes
set out by the UK Space Trade
Association companies. You can find
out about all the winners here: and analysed. Look for evidence of code running on the ISS during
rpf.io/apwinners the crew being near the Astro Pi, the Tim’s mission!
effect of the South Atlantic anomaly There is even a friendly web
Can I get involved? or changes in the accelerometer forum that you can post on should
Yes! The project has, for the first when the station’s thrusters are you have any questions. This is
time, made it possible for students fired and much more. The resource frequented by lots of experienced
to have access to the exact same for this is online here: Raspberry Pi users who are eager
computer hardware being used by rpf.io/apfda to help you.
the crew of the ISS. Everything apart Tim is also planning to Go to raspberrypi.org/forums
from the aluminium flight case is devote some of his free time and you’ll find the Astro Pi forum
available to buy online. We on Saturday afternoons to listed under Education.

FLIGHT SAFETY TESTING


To be allowed on a rocket, you need a flight safety
certificate for your device, and these can only be
obtained by presenting a whole host of measurements
and test results to a panel of experts at the European
Space Agency in Holland.
The expertise and equipment to carry out many
of these tests was well outside the capabilities of
the Raspberry Pi Foundation. Without the facilities
and personnel available through our UK Space
partners this would not have been possible. We had
to use facilities and partners all over Europe to get
the work done.
If you want to find out about the process we had to go
The thermal radiation test
proves that the device will through to get the Astro Pis certified for space flight you
always stay below 45C at can read about it on the main Raspberry Pi blog here:
maximum performance
for extended time periods rpf.io/ap5

raspberrypi.org/education Educator’s Edition 9


Feature CODE CLUB

START A
CODE CLUB
IN YOUR SCHOOL
Are you a teacher interested in setting up a Code Club in your school?
Find out how simple it is to get started.
t’s easier than you think to for children to follow to create said. “It taps into their problem
I run a Code Club yourself:
you don’t need existing
animations, games, websites, and
much more. Children build up their
solving skills and enables them to
develop critical thinking skills.”
coding skills, just a can-do attitude programming skills as they move “Programming and coding is an
to get stuck in learning alongside through the projects. There are also area of the curriculum that many
your students for an hour a week! challenges to provide opportunities staff can find intimidating. Knowing
If you haven’t yet heard about to apply what they’ve learnt. that the children have some
Code Club, they are a UK-based not- Caroline Harding, a Year 4 experience of the program can help
for-profit organisation offering free teacher who helps to run a Code ease some anxieties and enables
learning materials and support for Club at her school in Croydon, that ‘have a go’ attitude!”
Below teachers, volunteers and parents told us about the benefits the By starting a club at your school
Code Club
allows children running after-school coding clubs club has brought the children. you’ll be joining a huge community
to experiment for children aged 9-11. “Making Code Club available to the of teachers who do the same thing -
and invent,
using different Code Club’s specially designed children in our school has helped around 50% of Code Clubs are run
languages to projects offer structured and tremendously with their confidence by teachers.
create their
own games, fun content for the clubs. The and engagement in coding and If you’re considering getting a
animations projects are step by step guides computing in general,” Caroline Code Club started, we’ve come up
and websites
with a few tips to help you.

Register your club online


To access Code Club’s project
materials, you will need to register
online. You can sign up as a Code
Club Host by visiting codeclub.org.
uk/bett, making sure to use your
school email address so we can
validate you as a teacher.
Once you’ve entered your details,
you will be able to select the option
to run the club yourself. Your club
will then be automatically activated
and you will have immediate access
to all Code Club’s online resources.
Code Club have projects in three
different coding languages: Scratch,
HTML/CSS and Python. Beginning
with Scratch is recommended, as

10 Educator’s Edition raspberrypi.org/education


START A CODE CLUB IN YOUR SCHOOL Feature

Left There is no
cost involved in
starting a Code
Club. It’s free for
schools, and the
kids who attend

this visual block-based language Code Club in practice


provides a great introduction to There are thousands of teachers
key programming concepts. If your running their own Code Clubs
pupils are already experienced with across the country, and around the
Scratch, though, you may wish to get world. We spoke to Matthew Cave,
started with HTML/CSS or Python. Assistant Headteacher at West Town
There are twelve Code Club projects Lane Academy in Bristol, who told
in each language to keep your club us about his club.
occupied for a full term. Beginning with Year 5 and 6
students, Matthew and his team
Your first Code Club introduced Code Club’s Scratch
It’s worth preparing for your first projects for all Key Stage 2
Code Club session by working children. Now, they have a whole-
through the project in advance, school approach, with Scratch Jr
so that you are aware of all the introduced for Key Stage 1, and they
instructions and the places where have invested in new technology
pupils could possibly get stuck. including Lego WeDo and My Romo. TACKLING
THE COMPUTING
Code Club is fun and it offers Matthew said; “We’ve been
children (and their teachers) the running our Code Club for over
opportunity to get creative with
coding. It’s a chance to experiment
a year now, with 40 children
attending. The club is in CURRICULUM
and invent, helping children to learn high demand.”
an important skill for their future, Code Club’s fun approach has Running an after-school Code Club can help you
while engaging with technology and provided other benefits: “It’s develop more confidence to teach the computer
creating things that they can get amazing to see the sense of curriculum and to integrate computing into your
excited about. achievement the children get everyday lessons.
The model can be adapted to suit when they finish their projects. If you and your colleagues are keen to get
different venues and educational We can really see them starting to some additional, more formal training, you
needs. Most clubs run through persevere with the tasks in Code may be interested in Code Club’s Teacher
one coding project per week, but Club, using analytical thinking Training courses. There are three modules on
some children like to spend longer to troubleshoot.” offer, focussing on ‘Computational Thinking’,
perfecting their designs. Some What advice does Matthew have ‘Programming & Networks’ and ‘The Internet’.
clubs have pairs of students sharing for teachers who are thinking of Many of the sessions are now free for teachers,
computers, and many clubs also starting a club? “It’s dead easy, so so if you are interested, you can make an
like to experiment with physical take the plunge! The children will enquiry with the Code Club team by emailing
computing. You can customise your run with it, so don’t worry about hello@codeclubpro.org.
club to suit you and the children. not being an expert.”

raspberrypi.org/education Educator’s Edition 11


Feature

FIND
THIS ADVANCING
COMPUTER
& OTHER
RESOURCES:
rpf.io/learn

SCIENCE WITH
RASPBERRY PI
The Raspberry Pi Foundation produces free resources for learners
and educators all over the world. Head of Curriculum Development,
Marc Scott, explains why and how…
ne of the core goals of the Raspberry Pi Teach, Learn and Make
O Foundation is to advance Computer Science
education, and one of the key ways in which
Head on over to raspberrypi.org/resources and you’ll
find three categories of resources from which to
we attempt to achieve this is in the publication of free cherry-pick: Teach, Learn and Make.
educational resources. Our aim is to be the first port Our rapidly growing set of Teach resources are
of call for educational materials, whether you are a designed with educators in mind. There you can find
learner who has just unboxed your first Raspberry Pi complete sets of lesson plans, student worksheets
computer, or an educator teaching Computer Science and resource files ready for you to print off, project,
to eager students of any age and level. or just to direct your students to. Some schemes
require Raspberry Pis, such as the Networking
lessons. Some are cross-platform, such as the Sonic
Pi lessons on making music. Some tackle tricky
concepts in Computer Science, such as the Sorting
Algorithm lessons. There are even some cross-
curricular schemes, such as Sensing Space.
Our Learn and Make resources are designed
to be accessed by learners without necessarily
requiring the support of an educator. They could
also easily be used in lessons and are especially
suitable for after-school or lunchtime clubs. If
you’ve ever wanted to build a device to tell you
how many astronauts are currently in space,
predict the future with a digital Magic 8-Ball, or
learn what it’s like to float around in zero-g, this

SIMULATING WEIGHTLESSNESS is the place to go. Our Learn resources focus on


developing new skills and knowledge through project
In this resource you can learn how to simulate the effects of based learning, while the Make resources engage
weightlessness in space using Scratch. The resource teaches about learners with fun and often hands-on software and
some fundamental computer science concepts such as sequencing, hardware projects.
looping, variables, and conditionals. It’s an ideal activity for those just We add new resources to the site almost every
starting out with a Raspberry Pi and wanting to learn a little bit more week, so it’s worthwhile checking back every now
about learning to program in Scratch. See it at rpf.io/weightlessness. and then to see what new and exciting projects we’ve
been dreaming up lately.

12 Educator’s Edition raspberrypi.org/education


COMPUTER SCIENCE WITH THE PI Feature

FLAPPY ASTRONAUT
This resource is for the more advanced learner. It uses the new Sense
Free as in Beer and Speech HAT hardware along with some Python code to produce a clone of
A key difference between the Raspberry Pi Foundation Flappy Bird, in which the player navigates between pipes by vigorously
resources, and those produced by many other shaking the Raspberry Pi to overcome gravity. It’s a tricky game to
organisations, is that ours are free. That’s free master, but a lot of fun to play. Test it yourself at rpf.io/flappy.
in both senses of the word!
Both time and money are finite, and we recognise
that educators can spare little of either. That’s why Get involved
we’ve created these resources for you to use in any We’re a very small team here at the Raspberry Pi
way you wish, and why you’ll never be charged for Foundation, and as such we rely a huge amount on our
downloading, printing or sharing them. In fact, wonderful community of enthusiasts, tinkerers and
we would encourage you to do all those things. educators. Not only do they use our resources, they
We’re big believers in open source software at the contribute as well, doing anything from correcting a few
Foundation, and our attitude to educational resources typos right up to producing full schemes of work for us

Both time and money are finite, and we recognise


that educators can spare little of either.
mirrors this belief. The license under which we to publish on our site. You could get involved too, and
publish our work is very permissive. We use a Creative help to improve or create educational materials. For the
Commons Attribution and Share-Alike license for technically minded, just head on over to our GitHub page
all our educational materials, and encourage others at github.com/raspberrypilearning and you can fork our
to do the same. This means that if you want to make resource repositories, make any improvements you like,
changes to our resources, you are welcome to go ahead and then submit a pull request for us to look over. If the
and do so. If you want to alter our work so that it is idea of using Git is a little bit daunting though, then you
more appropriate to your learners, better suited to your can just use GitHub reporting feature to raise an issue,
teaching style, or just plain better than the original, explain what the problem is and we’ll get the message
then that is not a problem. Copy the text, change it in and can make the changes for you.
whatever way you like, and then publish it yourself. If you want to have a go at making a resource yourself
All we ask is that you attribute us as the original then go ahead. Share it with us and if we like it you
authors and that any derivative works you produce could well find your work being proudly displayed
are shared under the same license. on our website.

raspberrypi.org/education Educator’s Edition 13


Tutorial STEP
SENSEBYHAT
STEP

FIND
THIS
& OTHER
RESOURCES:
rpf.io/learn

You’ll
Need MAKE A DIGITAL
MAGIC 8 BALL
> Sense HAT
magpi.cc/
SenseHAT

> Sense HAT


Python library
magpi.cc/
1RKRoqc
(pre-installed Bring the time-honoured tradition of shaken-not-stirred fortunes
with Raspbian
Jessie) to the Sense HAT, making use of those motion sensors
n this activity you will build your own Magic 8 Once the Python shell window has loaded, click on
I Ball using your Raspberry Pi computer, a Sense
HAT, and some Python code. A Magic 8 Ball is
File and New File. This will open a text editor window
in which you can write, save, and test your code. Save
a toy to which you verbally ask a closed question. You the blank file as magic8ball.py by clicking on File
then shake it, and it will give you a prediction. and Save As.
In this tutorial you will use IDLE 3, the Python
development environment, to write some code for the Printing replies to the screen
Sense HAT. This means you can test your code and fix A good way to start your Magic 8 Ball program is to
Fig 1 Test the it as you write it as well. To open IDLE 3, click on the first create a text version of how it works. Let’s think
program first
in a Python main Raspbian Menu (at the top-left of the desktop), about what a Magic 8 Ball does. First, you ask it a
shell window followed by Programming and then Python 3 (IDLE). question, then you shake the ball, turn it over, and
read a reply that it has randomly selected. Therefore,
you will need a list of replies and a way of randomly
choosing one from the list and displaying that answer
on the screen.
To start, you need to import the random and time
libraries. Type the following into your magic8ball.py
text file:

import random
import time

Using the print function, you can print text to the


screen for the person using your program.

14 Educator’s Edition raspberrypi.org/education


MAKE A DIGITAL MAGIC 8 BALL Tutorial
Finally, an instruction is needed to select an item
from the list at random and then display it on the
screen. You can use the random library to do this,
by typing:

print(random.choice(replies))

Save your code by clicking on File and Save, then


run your program to test it works by clicking on
Run and Run Module. Your code should look similar
to that in Fig 1.

Display text on the Sense HAT


Now that you have text outputting to the Python 3
shell window on your screen, let’s change the code
so that the text scrolls across the LED matrix on
your Sense HAT. To do this, you will need to use the
Fig 2 You can alter the speed of the scrolling text
SenseHat library and replace the ‘print’ functions with
Type: a ‘show message’ function. Underneath the ‘import
modules’ section of your code, add the following lines:
print("Ask a question")
from sense_hat import SenseHat
Then there needs to be a pause before the program sh = SenseHat()
responds, so that the user can ask a question verbally
or mentally. You can use the time library to ask Next, replace print with sh.show_message in your
the program to sleep for a set amount of time, like this: code. There are two places where you will need to do
this. To test the code, save your program by pressing
time.sleep(3) CTRL+S on your keyboard, then run it by pressing F5
to check that it works on the Sense HAT.
The program will pause for three seconds. You can You may find that the text is slow to scroll across
change the value to make the pause longer or shorter. the LED matrix on your Sense HAT. To speed the text
Now, create a list of replies that the program could up, you can add scroll_speed=(0.06) to your text
give to the question. Lists can be named in much the strings, as in Fig 2.
same way as variables; for example, number = Normal Magic 8 Balls activate by being
[1, 2, 3, 4]. This list called ‘number’ has four shaken up after asking a question. How do you
items in it. Your list will contain strings of text that think you could make that happen using the
will be displayed on the screen; these strings will be Sense HAT’s motion sensors? That’s your next
quite long. To create your list, type: programming challenge!

replies = ['Signs point to yes', 'Without Left A little


a doubt', 'You may rely on it'] hint for how to
use the Sense
HAT’s motion
Add as many replies to your list as you like. Make sensors so you
can shake your
sure that you separate each reply with a comma. You Magic 8 Ball
can break up your list onto multiple lines, as shown
below, to make it easier to read. However, this is not
required for your program to work:

replies = ['Signs point to yes',


'Without a doubt',
'You may rely on it',
'Do not count on it',
'Looking good',
'Cannot predict now',
'It is decidedly so',
'Outlook not so good'
]

raspberrypi.org/education Educator’s Edition 15


Tutorial WALKTHROUGH
SAM AARON
Sam is the creator of Sonic Pi. By day he’s
a Research Associate at the University of
Cambridge and by night he writes code for
people to dance to.
sonic-pi.net

LIVE CODING
&& Digital musician and Cambridge Computer Lab researcher Sam Aaron
You’ll introduces Sonic Pi and the art of live coding
Need he laser beams sliced through the wafts of Live loop
>R
 aspberry Pi
running Raspbian
T smoke as the subwoofer pumped bass deep
into the bodies of the crowd. The atmosphere
The key to live coding with Sonic Pi is mastering the
live_loop. Let’s look at one:
>S
 onic Pi v2.6+ was rife with a heady mix of synths and dancing.
>S
 peakers or However, something wasn’t quite right in this live_loop :beats do
headphones with nightclub. Projected in bright colours above the DJ   sample :bd_haus
a 3.5mm jack
booth was futuristic text - moving, dancing, flashing.   sleep 0.5
>U
 pdate Sonic Pi: This wasn’t fancy visuals; it was merely a projection end
sudo apt-get
of Sonic Pi running on a Raspberry Pi. The occupant of
update && sudo
apt-get install the DJ booth wasn’t spinning discs; she was writing, There are four core ingredients to a live_loop. The
sonic-pi editing, and evaluating code. Live. This is live coding. first is its name. Our live_loop above is called :beats.
This may sound like a far-fetched story from the You’re free to call yours anything you want. Go crazy.
future, but coding music like this is a growing trend Be creative. I often use names that communicate
and is often described as live coding (toplap.org). something about the music they’re making to the
One of the recent directions this approach to music- audience. The second ingredient is the do word, which
making has taken is the Algorave (algorave.com); marks where the live_loop starts. The third is the
these are events where artists code live music for end word, which marks where the live_loop finishes.
people to dance to. However, you don’t need to be in a Finally, there is the body of the live_loop, which
nightclub to live-code; with Sonic Pi v2.6+, you can do describes what the loop is going to repeat – that’s
it anywhere you can take your Raspberry Pi and a pair of the bit between the do and end. In this case, we’re
headphones or some speakers. Once you reach the end repeatedly playing a bass drum sample and waiting
of this article, you’ll be programming your own beats for half a beat. This produces a nice regular bass beat.
Below The new
and modifying them live. Where you go afterwards will Go ahead: copy it into an empty Sonic Pi buffer and hit
Dark theme for
v2.6 is lovely! only be constrained by your imagination. Run. Boom, boom, boom!

Redefining on-the-fly
OK, so what’s so special about the live_loop? So far
it just seems like a glorified ‘loop’! Well, the beauty of
live_loops is that you can redefine them on-the-fly.
This means that while they’re still running, you can
change what they do. This is the secret to live coding
with Sonic Pi. Let’s have a play:

   live_loop :choral_drone do
     sample :ambi_choir, rate: 0.4
     sleep 1
   end

Now hit the Run button or press ALT+R. You’re now


listening to some gorgeous choir sounds. Now, while

16 Educator’s Edition raspberrypi.org/education


SONIC PI LIVE CODING Tutorial
it’s still playing, change the rate from 0.4 to 0.38. Hit This means it’s really easy to create interesting Language
Run again. Whoa! Did you hear the choir change note? polyrhythmical structures and even play with >RUBY
Change it back up to 0.4 to return to how it was. Now, phasing, Steve Reich-style. Check this out:
drop it to 0.2, down to 0.19, and then back up to 0.4.
See how changing just one parameter on-the-fly can Steve Reich’s piano phase
give you real control of the music? Now play around
with the rate yourself, choosing your own values.    notes = (ring :E4, :Fs4, :B4, :Cs5,
Try negative numbers, really small numbers, and large :D5, :Fs4, :E4, :Cs5, :B4, :Fs4, :D5, :Cs5)
numbers. Have fun!
   live_loop :slow do
Sleeping is important      play notes.tick, release: 0.1
One of the most important lessons about      sleep 0.3
live_loops is that they need rest. Consider the    end
following live_loop:
   live_loop :faster do
live_loop :infinite_impossibilities do      play notes.tick, release: 0.1
  sample :ambi_choir      sleep 0.295
end    end

If you try running this code, you’ll immediately see Bringing it all together
Sonic Pi complaining that the live_loop did not sleep. We are going to round this tutorial up with a new piece
This is a safety system kicking in! Take a moment to of music which draws from all of the ideas we have
think about what this code is asking the computer to introduced so far. Read this code and see if you can
do. That’s right, it’s asking the computer to play an imagine what it’s doing. Then, copy it into a fresh Sonic
infinite amount of choir samples in zero time. Without Pi buffer, hit Run and hear what it actually sounds like.
the safety system, the poor computer will try to do this Finally, change one of the numbers, or comment and
and crash and burn in the process. So remember- your uncomment things some of the lines out. See if you
live_loops must contain a sleep. can use this as a starting point for a new performance.
Above all, have fun!
Combining sounds
Music is full of things happening at the same time.    with_fx :reverb, room: 1 do
Drums at the same time as bass at the same time as      live_loop :time do
vocals at the same time as guitars... In computing we        synth :prophet, release: 8, note: :e1, cutoff: 90, amp: 3
call this concurrency, and Sonic Pi provides us with an        sleep 8
amazingly simple way of playing things at the same      end
time. Simply use more than one live_loop!    end

   live_loop :beats do    live_loop :machine do


     sample :bd_tek      sample :loop_garzul, rate: 0.5, finish: 0.25
     with_fx :echo, phase: 0.125, mix: 0.4 do      sample :loop_industrial, beat_stretch: 4, amp: 1
       sample  :drum_cymbal_soft, sustain:      sleep 4
0, release: 0.1    end
       sleep 0.5
     end    live_loop :kik do
   end      sample :bd_haus, amp: 2
     sleep 0.5
   live_loop :bass do    end
     use_synth :tb303
     synth :tb303, note: :e1, release: 4,    with_fx :echo do
cutoff: 120, cutoff_attack: 1      live_loop :vortex do
     sleep 4        # use_random_seed 800
   end        notes = (scale :e3, :minor_pentatonic, num_octaves: 3)
       16.times do
Here, we have two live_loops: one looping          play notes.choose, release: 0.1, amp: 1.5
quickly, making beats; another looping slowly,          sleep 0.125
making a crazy bass sound.        end
One of the interesting things about using multiple      end
live_loops is that they each manage their own time.    end

raspberrypi.org/education Educator’s Edition 17


Tutorial
News
JASPER HAYLER-GOODALL
The brains behind one of the winning
Astro Pi entries, and a regular helper at
CoderDojo Ham and Code Club. He’s ten.
coderdojoham.org

TNT RUN!
Can you outrun an explosion?
Test your speed with this marvellous Minecraft mini-game!

INFO CARD
Difficulty
Medium

Type
Programming

Requirements
Raspberry Pi computer One of the many amazing things about Raspberry Pi computers is that Bash the first block
to trigger the chain
Raspbian from they come with their own edition of Minecraft included for free. And reaction along the TNT
raspberrypi.org/downloads even better, you can code it in Python using the Minecraft API! In the
next 30 minutes you will create a game called TNT RUN, in which you
start at one end of a long line of TNT and have to try to make it to the
safe area without the TNT exploding in your face.

The Minecraft API gives us you need to look directly into the
complete control over many invisible bedrock.
elements of the game. This TNT also behaves differently in
includes teleporting players the Pi edition. Whereas in other
around the world and displaying editions you set TNT off with
helpful messages to the screen. flint and steel, a fire charge or a
We are also able to place blocks flaming arrow, in the Pi edition
automatically – not just one at a you simply need to hit it a couple
time, but as a three-dimensional of times with anything. However,
collection of blocks. you can’t just do this with any old
This game will also include a TNT block: first, we need to set its
block which is unique to Pi and block data value to an odd number
Pocket editions: invisible bedrock. (1, 3, 5, 7, or 9). Most blocks have a
We use this block to keep the block data value; by changing this
TNT from falling to the ground value, you will alter the block’s
when lit, and as an invisible path behaviour. For example, when you
leading to the safe area. You may set a nether reactor core’s block
find something strange about data value to 1, it appears in a red
this block when you place it next colour; if you set it to 2 then it will
to a non-invisible block, so try come out as a dark blue colour. We
experimenting: you will find that use these cool-looking blocks to

18 Educator’s Edition raspberrypi.org/education


raspberrypi.org/resources
News
Tutorial

Language
TNTRUN.py >PYTHON 2.7
How to
play:
# import all the necessary modules pos.z-88,pos.x,pos.y-7,pos.z-88, DOWNLOAD: >T
 he start of the
from mcpi.minecraft import Minecraft block.BEDROCK_INVISIBLE.id) github.com/
TNT line will
snake48/TNTRUN
from mcpi import block mc.setBlocks(pos.x+1, appear directly
import time pos.y-1,pos.z-88,pos.x, underneath you.

pos.y-7,pos.z-88,block.BEDROCK_INVISIBLE.id) >T
 he TNT won’t
# connect with the Minecraft world mc.setBlocks(pos.x,pos.y,pos.z,pos.x, just light itself;
you need to
mc=Minecraft.create() pos.y-7,pos.z-92,block.BEDROCK_INVISIBLE.id) detonate the first
block of TNT by
# get the player’s position # build the bomb hitting it a couple
of times.
pos=mc.player.getTilePos() mc.setBlocks(pos.x,pos.y,pos.z,pos.x,pos.y,
pos.z-88,block.TNT.id,1) > Once you’ve lit
it (you’ll know
# check if the end of the world will engulf your when it starts
#creation & then move you if you’re too close # build the end podium flashing white),
if pos.z<-40: mc.setBlocks(pos.x-2,pos.y,pos.z-93, turn around
and then run for
mc.postToChat( pos.x+2,pos.y,pos.z-97,block.GLOWING_OBSIDIAN.id) your life!
'teleporting to safer distance in progress!') mc.setBlocks(pos.x-1,pos.y+1,pos.z-94,pos.x+1,
>T
 ry to get to the
mc.player.setPos(pos.x,pos.y,-40) pos.y+1,pos.z-96,block.NETHER_REACTOR_CORE.id,1) teleporter, as it
pos=mc.player.getTilePos() mc.setBlock(pos.x,pos.y+2,pos.z-95, will give you an
block.REDSTONE_ORE.id) 18-block boost.

# mark where the teleport is > If the TNT


catches up with
zpos=pos.z-40 # set how many teleports you have
you, you will be
teleport=1 flung up into the
# create the valley by hollowing it out with air air and will lose.
mc.setBlocks(pos.x-1,pos.y+3,pos.z,pos.x+1,pos.y- # build the display teleport signal block
7,pos.z-88,block.AIR.id) mc.setBlock(pos.x+1,pos.y+1,pos.z-44,
block.NETHER_REACTOR_CORE.id,2)
#build the invisible bedrock support mc.setBlock(pos.x-1,pos.y+1,pos.z-44,
mc.setBlocks(pos.x,pos.y-1,pos.z,pos.x, block.NETHER_REACTOR_CORE.id,2)
pos.y-7,pos.z,block.BEDROCK_INVISIBLE.id)
mc.setBlocks(pos.x-1,pos.y-1,pos.z,pos.x,
pos.y-7,pos.z,block.BEDROCK_INVISIBLE.id) # teleport player when at a certain position
mc.setBlocks(pos.x+1,pos.y-1,pos.z,pos.x, while teleport ==1:
pos.y-7,pos.z,block.BEDROCK_INVISIBLE.id) pos=mc.player.getTilePos()
mc.setBlocks(pos.x,pos.y-1,pos.z-88,pos.x-1,pos.y- if pos.z==zpos:
7,pos.z-88,block.BEDROCK_INVISIBLE.id) mc.player.setPos(pos.x,pos.y,pos.z-24)
mc.setBlocks(pos.x-1,pos.y-1, teleport=0

mark the position of the teleporter point. When you run the code,
and as a part of the end podium. make sure Minecraft is running,
The teleporter function in the code otherwise your code will give you a
is designed so that if you manage connection error.
This is the safe area
to get to a certain point along the Once you have finished the you need to run to.
If you make it there,
line of TNT, it gives you a boost project, you can customise your you’ve won
and teleports you forward. own version of the TNT Run game
When you create your Minecraft by adding changes like making
world, fly around it and find a cool the row of TNT longer, or creating
location to create your TNT course a fancier safe area. Also, when
(i.e. not when you are near a cliff you’re connected to a network
or the end of the world). Your with other Raspberry Pis, you can
code takes the player’s position join someone else’s world, create
and constructs the TNT course, two lines of TNT and race to the
using this location as the starting safe areas simultaneously! The dark blue nether reactor core marks the location of the teleporter

raspberrypi.org/resources
raspberrypi.org/education Educator’s Edition 19
SUBSCRIBE TODAY
& SAVE UP TO 40% ESSENTIALS

Subscribe to the official Raspberry Pi mag at our exclusive educator’s rate

Subscription benefits Pricing


Get it first (before stores) Quarterly Direct Debit:
Free delivery to your door £10.50
Never miss a single issue Six issues:
£23
NEW
TEAC HER
OFFER!
12 issues:
£45

How to subscribe:
Call on 01202 586848 and
ask us about our educator rates

1 [ Chapter One ]

Find us on your digital device


by searching for ‘The MagPi’

You might also like