Author Archives: David Honess

Desktop Sense HAT emulator

via Raspberry Pi

If this post gives you a sense of déjà-vu it’s because, last month, we announced a web-based Sense HAT emulator in partnership with US-based startup Trinket.

Today, we’re announcing another Sense HAT emulator designed to run natively on your Raspberry Pi desktop, instead of inside a browser. Developed by Dave Jones, it’s intended for people who own a Raspberry Pi but not a Sense HAT. In the picture below, the sliders are used to change the values reported by the sensors while your code is running.


So, why do we need two versions?

  • For offline use, possibly the most common way Raspberry Pis are used in the classroom.
  • To accommodate the oldest 256 MB models of Raspberry Pi which cannot run the web version.
  • To allow you to integrate your Sense HAT program with any available Python modules, or other Raspberry Pi features such as the Camera Module.

The emulator will come pre-installed in the next Raspbian release but, for now, you can just install it by typing the commands below into a terminal window:

sudo apt-get update
sudo apt-get install python-sense-emu python3-sense-emu python-sense-emu-doc sense-emu-tools -y

You can then access it from the Desktop menu, under Programming.

The emulator closely simulates the Sense HAT hardware being attached to your Pi. You can read from the sensors or write to the LED matrix using multiple Python processes, for example.


Write your code in IDLE as before; there are also a number of examples that can be opened from the emulator’s built-in menu. If you then want to port your code to a physical Sense HAT, you just need to change




at the top of your program. Reverse this if you’re porting a physical Sense HAT program to the emulator, perhaps from one of our educational resources; this step isn’t required in the web version of the emulator.


There are a number of preferences that you can adjust to change the behaviour of the emulator, most notably sensor simulation, otherwise known as jitter. This costs some CPU time, and is disabled by default on the low-end Raspberry Pis, but it provides a realistic experience of how the hardware sensors would behave. You’ll see that the values being returned in your code drift according to the known error tolerances of the physical sensors used on the Sense HAT.

This emulator will allow more Raspberry Pi users to participate in future Astro Pi competitions without having to buy a Sense HAT: ideal for the classroom where 15 Sense HATs may be beyond the budget.

So, where do you start? If you’re new to the Sense HAT, you can just copy and paste many of the code examples from our educational resources, like this one. You can also check out our e-book Sense HAT Essentials. For a complete list of all the functions you can use, have a look at the Sense HAT API reference here.

You can even install this emulator on other types of Linux desktop, such as Ubuntu! For more information on how to do this, please visit the emulator documentation pages here.

The post Desktop Sense HAT emulator appeared first on Raspberry Pi.

Astro Pi Coding Challenges: a message from Tim Peake

via Raspberry Pi

Back in February, we announced an extension to the Astro Pi mission in the form of two coding challenges. The first required you to write Python Sense HAT code to turn Ed and Izzy (the Astro Pi computers) into an MP3 player, so that Tim Peake could plug in his headphones and listen to his music. The second required you to code Sonic Pi music for Tim to listen to via the MP3 player.


We announced the winners in early April. Since then, we’ve been checking your code on flight-equivalent Astro Pi units and going through the official software delivery and deployment process with the European Space Agency (ESA).

Crew time is heavily regulated on the ISS. However, because no science or experimentation output is required for this, they allowed us to upload it as a crew care package for Tim! We’re very grateful to the UK Space Agency and ESA for letting us extend the Astro Pi project in this way to engage more kids.

The code was uploaded and Tim deployed it onto Ed on May 15. He then recorded this and sent it to us:

Tim Peake with the Astro Pi MP3 player

British ESA astronaut Tim Peake’s message to the students who took part in the 2016 Astro Pi coding challenges to hack his Astro Pi mini-computer, on the International Space Station, into an MP3 player. The music heard is called Run to the Stars composed by one of the teams who took part.

In total, there were four winning MP3 players and four winning Sonic Pi tunes; the audio from the Sonic Pi entries was converted into MP3 format, so that it could be played by the MP3 players. The music heard is called Run to the Stars, composed with Sonic Pi by Iris and Joseph Mitchell, who won the 11 years and under age group.

Tim tested all four MP3 players, listened to all four Sonic Pi tunes, and then went on to load more tunes from his own Spacerocks collection onto the Astro Pi!

Tim said in an email:

As a side note, I’ve also loaded it with some of my Spacerocks music – it works just great. I was dubious about the tilt mechanism working well in microgravity, using the accelerometers to change tracks, but it works brilliantly. I tried inputting motion in other axes to test the stability and it was rock solid – it only worked with the correct motion. Well done to that group!!

“That group” was Lowena Hull from Portsmouth High School, whose MP3 player could change tracks by quickly twisting the Astro Pi to the left or right. Good coding, Lowena!

Thanks again to everyone who took part, to our special judges OMD and Ilan Eshkeri, and especially to Tim Peake, who did this during his time off on a Sunday afternoon last weekend.

The post Astro Pi Coding Challenges: a message from Tim Peake appeared first on Raspberry Pi.

Principia schools conferences

via Raspberry Pi


In November this year the UK Space Agency (UKSA) is holding two special conferences to celebrate the educational work linked to Tim Peake’s Principia mission. These events will be an opportunity for kids of all ages to show their projects to a panel of leading space experts – hopefully including Tim himself!

Tim’s schedule after he returns to Earth is hectically busy, but he’s very keen to be at the events and meet children, and everyone involved is working hard towards this goal. The conferences will be held at:

Attendance is free, and UKSA are offering travel bursaries to help with the cost of getting there. However, if you want to go, you’ll need to apply for one of the available places.

The Principia mission has a huge range of linked educational activities, one of which is our own Astro Pi, and the conferences will be attended by students selected from across them all. There are about 500 student places available for each event; the individuals and teams who submit the strongest applications presenting their projects will be invited to take part.


Astro Pi is one of many Principia activities

You certainly don’t need to have won one of the Principia competitions to be invited to participate: the organisers want to see all kinds of work linked with Tim’s mission. They want your application to tell the story behind what you did, describe what you’ve learned by carrying out the project, and explain what long-term effects the work has had on your school. We expect the conferences will include students presenting a huge variety of work, from activities linked to official competitions to creative ideas that students and teachers have generated themselves.

To illustrate the kind of applications we’re hoping to see, it’s worth mentioning the testimonial about Astro Pi that maths teacher Gillian Greig, from The Priory School in Hitchin, wrote last year. We think it’s a great example of the kind of story the organisers will enjoy seeing. Gillian, we hope you and your students will apply!

Of course, we’d love to see a strong Astro Pi contingent at both conferences, so we strongly encourage anyone who engaged with Astro Pi to apply. You can apply as an individual, a group, a class, or even an entire school. The applications will be judged by a panel who will select projects that show dedication and thoughtfulness.

Laser-etched Astro Pi

Flight equivalent Astro Pi units will be available at the conferences

Dave Honess, who manages Astro Pi, will be at both conferences with a number of flight equivalent Astro Pi units that can be used by attendees for their presentations.

The deadline for applications is Thursday 15 September 2016 at 12 noon. Apply here!

You can find more details about the application process, the conference venues, and arrangements for travel and accommodation on the Principia website. And if you have any questions, feel free to post them below – we’ll do our best to answer them.

Good luck!

The post Principia schools conferences appeared first on Raspberry Pi.

Astro Pi: Coding Challenges Results!

via Raspberry Pi


Back in early February we announced a new opportunity for young programmers to send their code up the International Space Station to be used by British ESA Astronaut Tim Peake.

Two challenges were on offer. The first required you to write Python Sense HAT code to turn Ed and Izzy (the Astro Pi computers) into an MP3 player, so that Tim can plug in his headphones and listen to music. The second required you to code Sonic Pi music for Tim to listen to via the MP3 player.

The competition closed on March 31st and the judging took place at Pi Towers in Cambridge last week. With the assistance of Flat Tim!

The judges were selected from companies who have contributed to the Astro Pi mission so far. These were;


Orchestral Manoeuvres In the Dark (Andy McCluskey and Paul Humphreys)

We also wanted to have some judges to provide musical talent to balance the science and technology expertise from the aerospace people. Thanks to Carl Walker at ESA we were able to connect with synthpop giants OMD (Enola Gay, Electricity, Maid of Orleans) and British/French film composer Ilan Eshkeri (Stardust, Layer Cake, Shaun the Sheep).


Ilan Eshkeri working on the Stardust soundtrack

We also secured Sam Aaron, the author of Sonic Pi and Overtone, a live coder who regularly performs in clubs across the UK.


Sam Aaron at TEDx Newcastle

Entries were received from all over the UK and were judged across four age categories; 11 and under, 11 to 13, 14 to 16 and 17 to 18. So the outcome is that four MP3 players and four songs will be going up to the ISS for Tim to use. Note that the Sonic Pi tunes will be converted to MP3 so that the MP3 player programs can load and play the audio to Tim.

The judging took two days to complete: one full day for the MP3 players and one day for the Sonic Pi tunes. So without further ado, let’s see who the winners are!

MP3 Player Winners

11 and under

11 to 13

14 to 16

  • Winner: Joe Speers
  • School: n/a (Independent entry)
  • Teacher/Adult: Craig Speers
  • Code on Github

17 to 18

Sonic Pi Winners

11 and under

11 to 13

  • Winner: Isaac Ingram
  • School: Knox Academy
  • Teacher/Adult: Karl Ingram

14 to 16

17 to 18

Congratulations to you all. The judges had a lot of fun with your entries and they will very soon be uploaded to the International Space Station for Tim Peake. The Astro Pi Twitter account will post a tweet to indicate when Tim is listening to the music.

The Raspberry Pi Foundation would like to thank all the judges who contributed to this competition, and especially our special judges: Andy McCluskey and Paul Humphreys from OMD, Ilan Eshkeri and Sam Aaron.

The post Astro Pi: Coding Challenges Results! appeared first on Raspberry Pi.

Astro Pi: 3D-Print Your Own Flight Case

via Raspberry Pi



Back in December, British ESA astronaut Tim Peake took two specially augmented Raspberry Pis, called Astro Pis, to the International Space Station (ISS) as part of his six-month mission. These Astro Pis are running experimental Python programs written by school-age students; the results will be downloaded back to Earth and made available online for all to see.

To satisfy the safety requirements that ESA and NASA have for small payloads aboard the ISS, we had to build the Astro Pi flight unit and put it through a rigorous qualification process.

Laser-etched Astro Pi

One of the two Astro Pi flight units

Ever since this case was announced back in May 2015, people have been asking, “Where can I get that case?”

At £3000 each, you can see why we only ever made eight of them. Why do they cost so much? Each half of the case is milled out of a solid block of aerospace-grade aluminium using a five-axis CNC mill. The two halves are then bead-blasted to give them a matt surface, then they’re anodised with a special coating to aid thermal radiation. After that, there’s some manual touch-up work, followed by installing the Raspberry Pi hardware and, finally, laser-etching the markings and logos.

That all adds up!

However, to quote from the original blog post where we announced it:

This will not be available to the public to buy because we’re only making a small number of them. We may however, in due course, release an object file so schools with a 3D printer can print one themselves.

With today’s blog post we’re making good on this promise!

The first attempt

Initially we just tried to 3D-print the original CAD files to see how hard it would be. The trouble with 3D printers is that they use hot thermoplastics, which can bend and sag under their own weight.

To avoid this, the printer creates what’s known as scaffolding and rafting to ensure the structural integrity of the object during the printing process. The user has to peel off this support material to get the original object they were trying to print. Any part of the object that overhangs will cause support structure to be built below it to prevent sagging. So the lower part of the flight case, with the grid of pins, came out chock full of the stuff:


Scaffolding and rafting that must be manually removed

After about 20 minutes with a pair of pliers, and accidentally snapping one of the corner pins, we decided this would be too frustrating for most users.


The base with scaffolding and rafting still remaining

The lid was slightly better. It was printed with the outer surface of the case facing downwards, to avoid support structure filling the internal cavity. But this meant that the outer surface came out with rafting all over it, and removing this resulted in a characteristic stringy finish that doesn’t look great.


The lid, printed with outer surface facing down

So we set about modifying the design so that even users with low-end 3D printers would be able to successfully print it, with minimal scaffolding and rafting.

Several attempts later

Many thanks to Ben Martin from Solid Models in Cambridge for running off so many test prints for us, and to Jonathan Wells (who did the original CAD work) for the many tweaks and changes. Our own Creative Producer, Rachel Rayns, contributed lots of 3D printing experience which led to these decisions. It was most definitely an iterative process!

The first change we agreed on was to slice off the heat sink on the base, so that it could be printed in the opposite orientation. That way it would have nothing overhanging to cause support structure to be built between the pins.


The heat sink as a discrete part (click for 3D STL view)

We then sliced off the top of the lid so that it could be printed with the clean side facing upwards, meaning the stringy side would face down.


The lid as a discrete part (click for 3D STL view)

That was a lot nicer looking. So with the lid and heat sink sliced off, it meant the two original middle bits were left as discrete parts.


The middle as a discrete part (click for 3D STL view)

We also removed the pillars between the USB and Ethernet ports because these snapped off easily. Finally, for convenience, we changed the corner bolt enclosures from a sunken captive screw to a straight-through M4 nut-and-bolt design.


The base as a discrete part (click for 3D STL view)

You can use epoxy adhesive (or similar) to join the heat sink to the base and the lid to the middle. When the Raspberry Pi and Sense HAT are installed it’ll end up looking something like this:


The assembled flight unit, still missing a few buttons

New resource

To guide you through the assembly process we’ve created a brand new educational resource that covers everything from downloading the STL files and getting the fixtures and fittings you need right through to testing that you’ve wired up the push buttons correctly. Click through and take a look:

3D Printed Astro Pi Flight Case | Raspberry Pi Learning Resources

The Astro Pi flight case is one of the most desirable cases in the history of the Raspberry Pi. With this resource you will learn how to 3D print your own case and install the Astro Pi hardware inside it.

We’re really looking forward to seeing the cases you make – please show us by tweeting pictures to @Astro_Pi and @Raspberry_Pi.

By far the most exciting benefit of owning an Astro Pi flight unit is the ability to prototype and test code that could be run on the International Space Station. Head over to the Astro Pi website now to get involved in the new coding challenges!


Where are the STL files?

On GitHub.

Why are there four files, not two?

We sliced the case into four layers to minimise the amount of scaffolding and rafting that needs to be printed; it also keeps printing time down. The text of the blog post above explains this in more detail.

Can we modify the STL files?

Yes. They are released under the Creative Commons attribution license so you are welcome to modify them. Please note that GitHub has a great STL viewer and also has a 3D file diff, which could be useful for tracking changes.

Can we have the original CAD?

Currently, no. Raspberry Pi needs to retain the ability to be the sole manufacturer of the space-qualified Astro Pi flight unit. You are welcome to reverse-engineer the STL files we’ve released today, though.

How do you fit the hardware inside it?

The educational resource we’ve written covers this in great detail: check it out here.

I don’t have access to a 3D printer, but I really want this case. What can I do?

You may be able to find one at your local hackspace. You can also find local 3D-printing services through the 3D Hubs website.

The post Astro Pi: 3D-Print Your Own Flight Case appeared first on Raspberry Pi.

Astro Pi: Mission Update 8 – ISS Deployment

via Raspberry Pi


Ed and Izzy

On Monday this week we released the first of four short cartoons that tell the story of the Astro Pi mission. Part 1 introduces Ed and Izzy, the two Astro Pi flight units that are up in space right now.

You may recognise the voiceover: it’s TV science presenter Fran Scott from Absolute Genius and How to be Epic. Thanks Fran!

The Story of Astro Pi (Part 1)

British ESA Astronaut Tim Peake has joined the crew of the International Space Station for Mission Principia – and two specially equipped and tested Raspberry Pi computers are there with him. Find out more at Narration by Fran Scott:

The idea to anthropomorphise the Astro Pis came from Tim Peake himself. He was a fan of what ESA had done previously with Rosetta and Philae’s social media accounts, and felt that this would be a great way to involve young people in the mission.

Ed @astro_pi_vis and Izzy @astro_pi_ir have their own Twitter accounts and will be tweeting about what they’re doing over the coming weeks. They’re named after the real-life friendship between Sir Isaac Newton (Izzy) and Edmond Halley (Ed) which resulted in the publication of the famous 17th-century physics book, Principia Mathematica, after which Tim’s mission is named.


On the 4th of January Tim unpacked Ed and took this amazing picture in the Columbus module of the ISS. You can download the original from Tim’s Flickr account.

Tim Peake on Twitter

Look what turned up today…nearly time to start running your code in space! @astro_pi @Raspberry_Pi

The Astro Pis were originally scheduled to be powered up on the 11th of January; however, it was postponed due to the spacewalks they recently undertook, which rightly take priority over anything educational.

It gives us great pleasure to announce that yesterday Ed was successfully deployed by Tim. He’s powered up and is now running the student experiments that won the 2015 Astro Pi competition.

Ed on Twitter

@astro_timpeake Running Crew Detector code from @cranmerefriends @rdhayler @codeclub

It takes several days to get images back from the ISS because they have to be screened by ESA and NASA for crew privacy reasons. So keep an eye on Tim’s social media accounts over the next few days for pictures of Ed online and working!

Ed is running most of the experiments, but the others will be run by Izzy who will be deployed in the Harmony node of the ISS on February 15th. Izzy needs to look through a hatch window, as she’ll be taking infrared pictures of the Earth – there are no windows in Columbus.

If you enjoy watching the ISS Live Stream you may be able to spot them from time to time!

Flight Data Analysis

Once Ed and Izzy have finished running their student experiments, they will each begin a long-term ISS environmental monitoring experiment that you can all take part in.

They’ll enter a flight recorder mode where they save sensor readings to their own databases every ten seconds. Because the sensor readings are taken so often, there will be masses of data to search through, so we need your help to look through the data and find out what was going on. There could be strange, unexplained things, or just the normal day-to-day activities of the astronauts.

Check out the resource for this below. The data will not be available for several weeks yet, but there is some sample data here for you to practice with.

Astro Pi Flight Data Analysis | Raspberry Pi Learning Resources

Do strange, unexplained things happen on the International Space Station? With this resource you can help us find out. The Astro Pis will be watching… The two Astro Pi flight computers on board the ISS are programmed to run the competition-winning programs as part of an automatic sequence.

New Coding Challenge

It also gives us great pleasure to announce two new coding challenges, where the prize is to have your code uploaded and run by Ed or Izzy in space!

That’s right – your code in space!

The first requires you to write Python Sense HAT code to turn Ed and Izzy into an MP3 player, so that Tim can plug in his headphones and listen to music. The second requires you to code Sonic Pi music for Tim to listen to via the MP3 player. You may enter both challenges if you wish.

Head over to the Astro Pi website now, where you’ll find out everything you need to know.

Coding Challenges – Astro Pi

We are pleased to announce that, from today (03/02/2016), we are running a new set of coding challenges for the Astro Pi mission. There are currently two challenges on offer. What do I have to do? To take part you’ll need to pick a challenge from the list below, read through what’s required, and then …

The post Astro Pi: Mission Update 8 – ISS Deployment appeared first on Raspberry Pi.