Sense HAT

The Raspberry Pi has been designed specifically with add-on boards in mind. A HAT (hardware attached on top) is an add-on board for Raspberry Pi models A+, B+ or 2B. HATs can be securely fastened to a host Raspberry Pi using four stand-offs and eight screws.

IMG_9256S

The Raspberry Pi with Sense HAT (top left)

The add-on board used by the Astro Pi flight hardware is called the Sense HAT, pictured above separately and then securely installed onto a Raspberry Pi below.

This is informally known as the Domestic Astro Pi since it’s the main guts of the flight hardware.

IMG_9259c

The Raspberry Pi with Sense HAT installed

The Sense HAT has the following features:

  • Gyroscope, accelerometer, and magnetometer sensor
  • Temperature and humidity sensor
  • Barometric pressure sensor
  • 8×8 RGB LED display
  • Mini joystick

The Raspberry Pi Guy gives us a tour of the main features in this video:

NEW Raspberry Pi Sense HAT – Astro Pi Add On!

Raspberry Pi in spacceeeee! Today the Raspberry Pi Foundation have launched their very own piece of space hardware, the Sense HAT, for public sale. The component-laden board is designed to go to the International Space Station, with Britain’s first astronaut Tim Peake, on the 15th December 2015.

Continue reading for more information on these features…

Gyroscope

A gyroscope measures the orientation of an object. It can be quite difficult to visualise if you’ve never used one before, but you may have seen one being used for a fairground ride. The ride, an Aerotrim, takes only one person who is strapped in by their legs and arms. They sit inside three big metal rings, which can independently rotate in relation to each other. The ride operator usually says “Scream if you want to go faster!” and sets you going; you then go upside down, back to front and side to side all at once, while screaming. This ride is a gyroscope as it allows three degrees of movement. These are normally called:

  • Pitch (up and down like a plane taking off and landing)
  • Yaw (left and right like steering a car)
  • Roll (imagine a corkscrew movement, like barrel rolling a fighter jet)

orientation

The Sense HAT has a very tiny gyroscope built into it. In your Python code you can ask for its pitch, roll and yaw values, which are returned as angles between 0 and 360 degrees. You could use this to make your program react to changes in orientation or show which way the Astro Pi is pointing. You can also read the gyroscope as X, Y and Z axis values in radians per second.

When planning how you would use this sensor data, consider the fact that in space the concepts of up and down no longer apply.

Accelerometer

An accelerometer measures an object’s increase in speed (acceleration). At rest, it will measure the direction and force of gravity, but in motion it measures the direction and force of the acceleration acting on it – as if you were swinging it around your head on a rope. Because accelerometers can detect the direction of gravity, they are often found in devices that need to know when they are pointing downwards, such as a mobile phone or tablet. When you turn the screen sideways the accelerometer inside detects that the direction of gravity has changed, and therefore changes the orientation of the screen.

The Nintendo Wiimote uses accelerometers to detect the force and direction of your movement while playing Wii Sports, for example. It can tell if you’re doing a hard back-swing or a soft under-arm shot in the Tennis game. The Sense HAT also has an accelerometer built in; you can read its data in code as pitch, roll and yaw angles or as X, Y and Z axis values in Gs. In space, the accelerometer will always read zero because it’s in free fall. However, any movement will be picked up as it is also sensitive enough to detect when the station is under thrust, for example when the space station itself is doing an orbital correction or a debris avoidance manoeuvre.

Magnetometer

A magnetometer is used to measure the strength and direction of a magnetic field. Most often they’re used to measure the Earth’s magnetic field in order to find the direction of North. If your phone or tablet has a compass, it will probably be using a magnetometer to find North. They are also used to detect disturbances in the Earth’s magnetic field caused by anything magnetic or metallic; airport scanners use them to detect the metal in concealed weapons, for instance. The Sense HAT has a magnetometer built in too. The data comes as only one angle between 0 and 360 degrees in your code, a bit like only taking the yaw value from the previous two sensors, and shows the direction of geomagnetic North. You can also read the strength and direction of the magnetic field as X, Y and Z axis values in microteslas (µT).

On the Earth’s surface, the magnetic field lines run flat across it, which makes them ideal for finding the direction of North. You should easily be able to program a compass using the LED matrix. However, the further away you are from the surface, the more curved the magnetic field becomes. Consider that, up on the ISS, magnetic North might look like it’s pointing off into space somewhere, because the field’s shape is hugely curved up there. As the station orbits the Earth, the direction of geomagnetic North will sway back and forth, and this could be used as a way to count how many orbits have happened while your code is running.

Temperature sensor

A temperature sensor is used to measure hot and cold. It’s exactly like the thermometer that you would put in your mouth to take your own temperature, except it’s an electronic one built into the Sense HAT and reports the temperature as a number in Celsius in your code. The environmental temperature on the ISS is carefully controlled, and so the ambient temperature will not change very much. You may be aware that warm air rises while cool air falls; this is because cool air is denser and heavier than warm air and is therefore pulled down by gravity. On the ISS this effect doesn’t happen, because there is no gravity to pull the heavier air downwards. Airflow is an important issue on the station, so it may be that you would detect different ambient temperatures in different parts of the station where the airflow is different.

Consider also that the temperature sensor may be measuring some heat coming from the Raspberry Pi itself, as well as the ISS environment.

Barometric pressure sensor

A pressure sensor (sometimes called a barometer) measures the force exerted by tiny molecules of the air we breathe. Although air molecules are invisible, they still have weight and take up space. There’s a lot of empty space between air molecules and so they can be compressed to fit into a smaller space; this is what happens when you blow up a balloon. The air inside the balloon is slightly compressed and so the air molecules are pushing outwards on the elastic skin; this is why it stays inflated and feels firm when you squeeze it. Likewise, if you suck all the air out of a plastic bottle, you’re decreasing the pressure inside it and so the higher pressure on the outside crushes the bottle. Ever felt your ears pop when going up and down in a lift?

The Sense HAT has an air pressure sensor built in and will report air pressure to you in millibars in your code. Air pressure on the ISS is controlled and you should not expect to see it change very much.

Humidity sensor

A humidity sensor measures the amount of water vapour in the air. There are several ways to measure it, but the most common is relative humidity. One of the main properties of air is that the hotter it is, the more water vapour can be suspended within it. So relative humidity is a ratio, usually a percentage, between the actual amount of suspended water vapour to the maximum amount that could be suspended for the current temperature. If there was 100% relative humidity, it would mean that the air is totally saturated with water vapour and cannot hold any more.

The Sense HAT has a humidity sensor that will report relative humidity as a percentage to you in your code. It uses data from the temperature sensor to give you the correct value. Humidity on the ISS is carefully controlled by environmental systems so you can expect it to be quite low all the time – the air is very dry up there. However, the sensor will be good enough to detect the water vapour in human breath, so you might be able to use this data to detect the presence of the crew working near the Astro Pi.

8×8 RGB LED matrix display

This is the only real form of visual output that the Astro Pis will have up on the ISS. For a number of technical and safety reasons we are not allowed to plug the HDMI or composite outputs of the Raspberry Pi into anything on the ISS, since this would have required a very lengthy certification process that we didn’t have time for.

LED stands for ‘light emitting diode’; light emitting because it emits light (yup), and diode means that current can only flow through it in one direction. The matrix consists of 64 LEDs arranged in an eight-by-eight grid, and each individual LED has a red, green and blue component that you can control in code.

For a single LED you can specify how much red, green and blue you want, using numbers between 0 and 255. Using various combinations of red, green and blue for each LED, you can create any colour or shade that you want. It should allow you to create a basic display or status monitor, or even play animations showing what your program is doing.

Mini 5 button joystick

This is a standard direction pad like the one on your games console controller, made up of five buttons for up, down, left, right, and centre. You will be able to pick up events in your code when the joystick is moved and you could use them to allow a human user to control your program. Combine this with the LED matrix and you have the ability to create a game for the ISS crew to play. Tetris, Pong and Snake come to mind but you could also use the joystick to make a reaction time game, and use the data you capture to determine if the crew reactions are getting faster or slower over time.

The Sense HAT joystick is mapped to the four keyboard cursor keys, with the joystick middle-click being mapped to the Return key. This means that moving the joystick has exactly the same effect as pressing those keys on the keyboard.