Notice: Undefined index: order_next_posts in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 194

Notice: Undefined index: post_link_target in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 195

Notice: Undefined index: posts_featured_size in /nas/content/live/gadgetmag/wp-content/plugins/smart-scroll-posts/smart-scroll-posts.php on line 196

Astro Pi and the Space-Byrds

How secondary school kids are sending their code to space

The Space-Byrds

The Space-Byrds

Clever Year 7 students at Thirsk School have devised an amazing tracking system for the International Space Station and have become Astro Pi competition winners. We speak to their teacher, Dan Aldred, to find out more…

Can you tell us more about your students at Thirsk School who won the competition?

It was actually a code club that I’d set up at lunchtimes. The original reason for setting it up was to give students, who were perhaps what we call vulnerable learners, something to do at lunchtime – students who would struggle being in the playground; maybe their behaviour means they would get into difficulty, or they were just a bit more timid and so didn’t have anywhere to go. Also, I was keen on making sure that the coding and the Raspberry Pi wasn’t about bright kids – I wanted to make sure that low-ability kids and special needs kids had access to coding and all the benefits that it offers.

International Space StationSo I set up a coding club for lunchtimes, started with Minecraft, Sonic Pi, picamera photo hacking, and then this competition came along and I said, “Look, this is the opportunity we’ve got: a space rocket’s going to go up to the ISS with an astronaut and an Astro Pi. What do you think?” They were like, “Yeah! Let’s do it, let’s do it!” And it grew from there – we ended up with eight to ten students who stayed every lunchtime for seven weeks, creating their winning solution.

That’s amazing dedication!

It is! In the end it became quite social, and by about week four they could see the results of what they’d made and start to get excited, thinking that it could actually win. In the first week it was just a concept, an idea, and they had no idea how to build it, what they were going to do, they didn’t know what an Astro Pi looked like. All they knew was that there was the potential to win a competition at the end of the day. So to begin with it was just pitching it to them, the dream that they could win this and send something up into space, and I think that was the hook – here’s a computer in your hand that might go up into space. But yeah, the dedication from them was huge, really motivated.

It must have been great for building a sense of community too, particularly with the vulnerable learners.

It was very exciting and rewarding personally, too. We started off with a shared document, so all the students could access the code from home, and what I found was that as the weeks went on, the students were logging in more frequently to check their code, add their sections, and then they started editing each other’s code. It was so polite – they’d come in at lunchtimes, for example, saying, “I noticed an error in your code last night. I changed it – hope you don’t mind?” And then of course they had a common goal they could talk about, and they started talking about space and physics, different space films they’d seen, and of course as we were creating it they were talking about the different countries, whether they’d been to that country, what it’s like, what’s the capital – at work we call them learning conversations; they were learning just through talking around the subject.

Organic, peer-to-peer exchange.

Exactly – it wasn’t manufactured. It was completely natural, which was absolutely brilliant. But yeah, they’ve forged some quite good friendships. And confidence as well – these are students who perhaps at the beginning when they started school (they were Year 7 students, so they’re 11 years old now) wouldn’t really go into the playground, were perhaps fearful of the dining hall, were maybe bottom-set students struggling with maths and English, or had a behaviour issue, and suddenly they’ve got quite a good status now amongst Year 7. And obviously the press have gotten hold of it and various local papers have run pieces on it and printed pictures of them, and I think it’s given them a real boost. Rather than being labelled as an underachiever, a pupil premium child, having the potential to achieve, etc – well, they have all actually overachieved now!

It must have been amazing for their confidence and social skills, working in a collaborative environment like that.

Definitely. The program that they made was actually very simple in essence – it’s just the fact that it’s so big that took the time. In terms of the coding, it wasn’t particularly difficult; it was just a case of there being 96 countries filled with 96 different flags, and 96 different languages that you have to find out and create messages for. So once they’d mastered the skill they were learning, it was then a case of repetition and discovery. They all knew what the skill was – it wasn’t the case that they were working separately on 50 different parts; they were all working on the same skill. So, “this session we’re going to be doing five countries’ flags, five countries’ messages – you two work on that one. Who do you want to pick?” And they’ll go, “Ah, I’ll have Brazil”, “I’ll have Outer Mongolia”, “Oh I’ll have Russia”, “I’ll take Kazakhstan”. And they were all doing the same set of skills, they were all coding in the same style, so they could help each other out. The bit that was individual at that point was that the flag for Kazakhstan is different to the flag for the UK, and stuff like that. But creating each flag is a similar set of code – obviously the colours are slightly different, and the setup, but in essence the code was the same, so they could support each other, and say, “Oh, actually you’ve missed this bit out on the red, green and blue – you haven’t got a value for the blue, that’s why it’s this colour.” So yeah, they’ve learned a heck of a lot of skills and they’ve also learned a lot about the other countries as well, through supporting each other.

In terms of the logistics, how did the division of the work happen at the beginning and the end of the project?

Astro pi flight caseThere were two parts to the competition: the first was to pitch an idea, and you were then selected from that to go into the second stage. So the first couple of lunchtimes it was basically just brainstorming ideas, listening to what everybody wanted to come up with. We had some fantastic concepts, like, “Can we strap it to the astronaut, so that when he or she goes outside the ISS it can check for radiation?” Despite having the great ideas, we didn’t quite know how much of it was realistic! I contacted Raspberry Pi and asked for a breakdown of what we can and can’t do, and when we got the breakdown it said it was going to be stationary, it was going to be inside the station, it’s not going to be moving, there’s going to be no screen and the astronauts really need to have minimal interaction with it, other than maybe starting it up and pressing a couple of buttons. So then we could shrink down the list, and I suppose the final idea came out because one student said, “So they’re in space… how do they know where they are?” We talked about the different instruments and the fact they’ve got GPS or an equivalent tracking and co-ordinating system, but when they look over a country, how do they know which one they’re looking over? And that’s where the idea came out – why don’t we have our Astro Pi system show the astronauts the flag of the country and a message, so they could compare that with the instruments on-board the space station and see if it works?

ISS TrackerSo they all decided on that, we pitched it to Raspberry Pi, who said it was a great idea and sent us the kit, we got started, and picked out 96 major countries. For that, the students used the ISS trackers online and basically looked at the plot map of where it goes. It was quite a time-consuming process because they had to write down all the countries they were going to complete and put them into a shared Word document. I then put the example code at the top for England with the UK flag – from there they just had to work up the countries. What we found was that some of the students would come in and they wouldn’t do any coding for the session – what they’d do is eat their lunch and just go round each student, asking things like, “Have you done the Democratic Republic of Congo yet?” And they’d respond, “No, that one will need doing – can you do that one, please?” And some students would say, “I don’t know which one to do next,” and another student would say something like, “Okay, have you done Russia yet? I don’t think there’s a flag for Russia.” Towards the end of the project we had a couple of students who’d set up a spreadsheet with all the 96 countries, 96 flags, 96 messages, and they began ticking them off.

And we had a couple of Astro Pis – one to test the flags and then the other was running all the co-ordinate tracking, so some of the students began working on that. It was probably by week five that we started to integrate the two together, so that if the ISS positional data was within the boundaries of the country then the flag pops up. Towards the end we could start to refine the longitude and latitude so that you got an exact position for the country. One student was in charge of finding out all the longitudes and latitudes for the countries – an absolutely painstaking job because there were four points of origin for most countries, and there are some countries in L shapes so we had to do six or eight points. It’s not perfect – it’s quite a crude model and we’re looking at a way of making it more accurate – but for the purpose of saying we’re over Australia, for example, if you’re within these four points of longitude and latitude then you’re within the boundary. So one student was responsible for that.

So where exactly is the Raspberry Pi getting all of the longitude and latitude data from?

Here’s the official press release of it: “the program uses telemetry data provided by NORAD along with the real-time clock on the Astro Pi to computationally predict the location of the ISS so it doesn’t need to be online. It then works out which country’s territory the ISS is above and shows its flag on the LED matrix along with a short phrase in the local language”. So that’s the official blurb.

The coding bit for the flags etc was tricky, but the mathematically challenging bit was the TLE file, which was a two-line element file that looks at the time on the Raspberry Pi and makes a calculation of where the ISS should be. From that it returns the longitude and latitude position. The students wrote conditional statements – if it’s within this longitude and latitude then it must be over this country, and therefore return this flag; and if it’s not then it displays a little graphic and says ‘calculating current position’. The experiment is comparing that set of results off the Raspberry Pi with what the ISS tracking system actually says on-board. It makes 19 orbits a day and can go out of sync – sometimes they have to move out of the way of space debris and it’s not on the path, sometimes there’s an adjustment to make if there’s a drop-off or something, or if another spaceship docks they might move to another position of orbit that isn’t calculated. So the TLE file is updated 19 times a day, and you have to download those two lines of code, pop it into your Python program and then it calculates the new positions. One of the biggest challenges was getting the time correct because the Raspberry Pi wasn’t online when they were testing, so the Raspberry Pi was still at 10:30pm even though it was 1 o’ clock in the afternoon, and it was throwing out all these wrong countries and locations. We were scratching our heads for a little while and then we realised that the time had to be set correctly. But the Raspberry Pi Foundation has been great – they worked with us to ensure that it’s accurate when the Raspberry Pi boots up, that the Astro Pi and Raspberry Pi are in sync, and that it’s the correct time. On-board the Astro Pi there’s a Real Time Clock that runs off a battery and keeps the clock count ticking over, like CMOS in the regular computer, just to keep the clock ticking while the power’s off.

What’s the next step for the project, then – are you completely ready for launch day, just waiting for Tim Peake to go up?

Tim PeakeYep – Raspberry Pi has been in contact. Tim’s going up in December but on the 11th August he’s doing a test run in Germany, which basically involves him being in a simulation for a number of weeks, and within that simulation he will run a number of experiments, including our ISS tracker experiment. So the code at the moment, the project we’ve built, is staying as it is and it’s going to be used as a test run so Tim can check it works, that there’s no malfunctions, etc. And then in December he will fly up to the ISS and begin experiments there for six months, sending the data back to the UK.

So at that point, will you be running the experiment concurrently with an Astro Pi at Thirsk School?

Yep – as soon as we get confirmation he’s on board, we’re going to set up a copy of the ISS tracker and record the data from each day, and then with the two pieces of data that he returns – the ISS’ real position from their flight instruments and then our ISS Astro Pi tracker – we’ll compare all three.

In terms of September when we return to school, the maths department are on board now and they are going to build us a pixelated map of the world, where each element of the country boundary will be within a pixel grid reference, so what we can actually do is take the longitude and latitude of each country and break it down to a pixel position. At the moment, what we’ve had to do for ease of use for the students is basically draw rectangles or squares around the countries using four points of origin, or with countries like Columbia, which is L-shaped, we’ve drawn a rectangle at the top and a rectangle at the bottom to get six points. So it’s accurate, but with somewhere like Russia and Kazakhstan, as it goes over it actually undulates between the two different countries, so for two minutes it’s in Kazakhstan and then for two minutes it goes into Russia and back out again. So for that kind of thing, our measurements weren’t accurate enough to show that, but obviously a pixelated version of the atlas is going to be better.

Will this be a second branch off the main experiment or will you be updating the code to be sent up in the Astro Pi?

I was talking to Raspberry Pi and they said they’re more than keen for us to continue working on it. We’ve got September and October, and we’ve got the maths department on board, so it’s just a case of building a dictionary now – we’ve got all the co-ordinates, so once it’s been pixel-mapped then we can build the dictionary and pop them back in. So we’re hoping to have that ready in time – the experiment’s still the same, it’s just making it more accurate. It’s very exciting!

I bet you’ll have an awesome live-updating map going once you’ve got the pixel map sorted!

That’s a good idea… I’d also like to set up some kind of live web feed so that everyone can compare the live ISS data with what our live Astro Pi ISS tracker is saying. A lot of the parents have contacted me, saying, “This is great – my son/daughter is talking about this and they’re so excited.” I’m going to share some pictures on Facebook and Twitter because I think when people actually see it, they’ll understand it better. If I put a picture of some LEDs showing the Brazilian flag and say it’s tracking the ISS, it doesn’t really mean a lot. But if you can see there’s the ISS over Brazil, and here’s the Astro Pi with the Brazil flag, and now it’s going over Columbia you can see the flag change, and oh there’s the language…

That’s the other thing as well – all the kids were learning all the different languages, so they were going, “What do they speak in the Democratic Republic of Congo? Oh, it’s French. Sir, why do they speak French? It’s miles away!” The cross-curricular aspect was absolutely fantastic – you had physics, coding, maths, geography with the latitude and longitude, then you had the flags, the size of the country. So one of the best moments for me was when they were building the longitude and latitude comparisons, and they were saying, “This one is -23.7 and -24.7”, and then they went to another country and said, “this one is -16 and -65.7… wait a minute, that’s huge!” They were getting numerical comparisons for the countries – so the UK is very small, I think it’s two or three degrees, and somewhere like Russia, that’s nigh-on 45 degrees latitude and longitude difference – and they had a mathematical model of how big these countries were. And of course, students are used to looking at a map or atlas that has countries out of proportion – the UK is not as big as it’s shown on the atlas – so the students were saying, “Hang on, so if this is this big but the States are supposed to be this big, it doesn’t work!” So it challenged their perceptions and showed them that when you look at a map or an atlas, the countries aren’t in actual relational size. It challenged their conception that the UK is massive. So we had loads of geography, and a bit of astronomy as well, talking about planets and things.

What was really nice and couldn’t have been better timed was that when the announcement of the winners was made, it was the same day that the Pluto photograph was out in the UK as well. The conference where they announced the winners was the same conference where they were showing the photograph that had come back from Pluto, and it was great because there was so much press about that and then this was coming in as well – it was absolutely brilliant. It added a little bonus to it because the kids felt there was something bigger, rather than just the competition – this was a huge discovery, the first couple of photos of Pluto coming back from the new satellite.

It locates what they’re doing inside a live, active field of science, which is all about discovery and creativity. Must have been a great experience.

Going back to what you were saying about the students and building confidence, the other winning schools – if we’re to get political now – were all independent schools. So you’ve got Westminster School, one of the top London schools, you also have Magdalen College, Oxford, and there was another independent school as well. So in terms of the political education landscape, you’ve got privately funded schools who’ve got access to a wealth of resources and expertise, and then we had this rural school, which is state-funded – well, under-funded – with students in these 1950s buildings that are falling apart, and yet they’re up there with these independents. One of those schools even had access to a light aircraft! Someone actually wrote in on the Raspberry Pi website saying, “Hang on – how can you expect schools to compete with this? You’ve got a primary school and a secondary school state-funded, and then you’ve got a school that’s got access to a physics lab and a light aircraft for testing.”

It would have been a real shame if it was just privately-funded schools that had gone through. I’m glad that the selection of winners reflects that the idea is the most important thing – it’s not about the school with the most resources.

Definitely. The Raspberry Pi is there for education – I subscribe to their ethos that coding and computing can move students forward and it can open up new vistas to them. And it really has done this – I mean, these ten students when they arrived in September were standard students, a piece of data on a system that come in with predictions from primary school of how many As and Cs they’re going to achieve in five years time, and now they are going into Year 8 and they’re among the first set of 10 or 15 students who are going to be sending a piece of code to a space station, and suddenly that’s a huge springboard for them – and they’re also speaking to their friends, who are asking, “What’s this coding then?” And they say, “Well, why don’t you come along!” And it’s not just about the coding – it’s always about the output, it’s about what you’re creating, with the code being the language that allows you to do that.

Astro PiThe best thing about this was that it happened over seven weeks. There was a deadline to meet for the competition, but there wasn’t a deadline in terms of ‘you have to have achieved this by this week, otherwise you’re underachieving’. So the students had time to make mistakes, time to try different things, time to have those conversations with each other, whereas in a typical, traditional classroom setting, you’ve got 50 minutes, you’ve got to show that the students have progressed, and if one student hasn’t progressed then you give them extra support. Here, we didn’t need to do that – it was much more fluid. I’m a big believer in that if you’re writing code, you need the time to think it through, and I think we’ve all been in that position where you’ve spent 24 hours building something and it’s still not working, you go away for two days, then you can come back and you’ve suddenly got it. If it’s led in a traditional classroom setting – a 50-minute ‘you must code this, this and this’ – then it loses its power and its organicness. I think if it’s run as a club, or externally, or over time, then students have the time for all this. We had students coming in in the morning saying, “I looked up this flag last night – did you know that this one only has three colours? I thought it had four”, and asking about the red, green and blue values, wondering why 255 is the top value. So they were learning about these values and hexadecimal, and I didn’t want to stop and say, “Right, that’s off-class now – you don’t need to know that.” I had the time – I had seven weeks – and I could go in and spend time looking at converting binary to a value of colour, why it is 255 and not 256. One of the things that they loved is that there are 256 values but it only goes up to 255, so they got that the 0 is actually a value included in it, and it’s the first position or number when you’re coding. I could have made a lesson about that, but it never would have been as organic – natural self-learning, basically. You could never force those questions in a lesson without prompting them, and then it becomes a bit stilted and I don’t think they remember it as much.

When it started, the club was just running every Monday – now we’re up to every lunchtime, five days a week. And we’ve got a beginner’s club on Monday, so what happens is the students who’ve been doing it since November last year come along and they support the new kids, and they feel really good now because they know everything – sudo idle and all the different commands – they remember how they were when they first started. Tuesday is the dedicated one for Minecraft. Wednesday is the picamera. Then Thursday and Friday – I asked the students what they wanted to do when they start up again in September and they said motors: “We want to build a car – build something that we can control from the computer”. So I don’t know what we’re going to do yet or how we’re going to do it, but that’s going to be part of the learning. We’ll get some Pibrellas out, we’ll get some Raspberry Pis out, we’ll hook up some motors, control them, and I know that one or two of them will say, “Well I’ve got some LEGO at home. If I build a chassis can we put it in there?” And they’ll start to build the project up and introduce more people to it and new elements, which makes it exciting. They don’t go to the club saying, “I’m going to learn coding.” They go there saying, “I’m going to build a car. I’m going to build a tank. I’m going to hack Minecraft. I’m going to play the Mario theme tune in Sonic Pi.” When I was learning code at school, the emphasis was just on the code – it’d be like an English lesson, learning grammar. And of course, you need to know that – but if you read a book then you start talking about how it’s structured, the different chapters and characters, and you see through the words to the story and you get a feel for it. I think this is where the Raspberry Pi is so powerful – it strips away that “I’m learning to code” and what you’re actually doing is learning to control a motor, for example. The kids are coming in writing six or seven lines of code but not thinking of it as coding, they’re thinking that now they can build a trampoline or can make the water turn to ice in Minecraft just by walking on it. And that’s what inspires them to do it. Exciting, isn’t it?

Want to see the code for yourself? Check out the new issue when it hits the stores next week – Dan has written a great tutorial on creating the ISS tracking software.

Track the ISS