28.01.2016 Views

PI ZERO

MagPi42

MagPi42

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

THE 10 BEST RASPBERRY <strong>PI</strong> HATS<br />

Feature<br />

Behind THE HAT<br />

Anybody can make a HAT, but<br />

they have to follow a specification<br />

laid down by Raspberry Pi. Here<br />

are three things that make a HAT:<br />

Putting a HAT on your Raspberry<br />

Pi makes it more functional, more<br />

powerful, and more dapper<br />

Specifications<br />

The HAT hardware must follow<br />

the specifications set by the<br />

Raspberry Pi Foundation. “We<br />

want to ensure consistency and<br />

compatibility with future addon<br />

boards, and to allow a much<br />

better end-user experience…”<br />

says the README.md document.<br />

magpi.cc/1OAHaGk<br />

a HAT should start working the<br />

instant it’s connected.<br />

Raspberry Pi achieves this using<br />

two specific G<strong>PI</strong>O pins found on<br />

the Model A+, B+, and 2: ID_SD<br />

and ID_SC (pins number 27 and<br />

28). These pins are reserved to<br />

connect to an EEPROM (Electrically<br />

Erasable Programmable Read-Only<br />

Memory) chip on the HAT. The<br />

EEPROM chip contains code in a<br />

.dtf file, known as a ‘device tree’,<br />

that outlines all the chips and<br />

hardware on the HAT.<br />

When a HAT is connected to<br />

a Raspberry Pi, the Pi detects<br />

it, reads the .dtf file, and<br />

difascovers what hardware is<br />

attached. Raspbian then loads the<br />

required drivers for the hardware<br />

automatically, sets up the G<strong>PI</strong>O<br />

pins accordingly, and the HAT is<br />

ready to use.<br />

Not every piece of hardware<br />

you buy for the Raspberry Pi is<br />

a HAT. Some types have special<br />

setup requirements, and others<br />

don’t fit on top of the Pi like a HAT.<br />

So HATs aren’t necessarily better<br />

than non-HATs, but if a piece of<br />

hardware is called a HAT then<br />

you know it’ll be relatively easy<br />

to set up and use.<br />

“While we cannot force<br />

anyone to follow our minimum<br />

requirements or HAT<br />

specification,” says James<br />

Adams, director of hardware<br />

at Raspberry Pi, “doing so will<br />

make users’ lives easier, safer,<br />

and will make us more likely to<br />

recommend a product.”<br />

HATs are great, and you can get<br />

so much more out of a Raspberry Pi<br />

using HAT hardware. Here are our<br />

top ten favourite HATs…<br />

Design<br />

The HAT must have dimensions<br />

of 65mm × 56mm, connect to<br />

the G<strong>PI</strong>O pins (using a full 40-<br />

pin header), and feature four<br />

corner holes for mounting on<br />

the Pi Model A+, B+, and 2.<br />

magpi.cc/1RPfNig<br />

EEPROM<br />

The HAT must<br />

contain an<br />

EEPROM that<br />

details the<br />

hardware<br />

contained on<br />

the board.<br />

This allows the<br />

Pi to identify a connected HAT<br />

and automatically configure the<br />

G<strong>PI</strong>Os and drivers for the board.<br />

raspberrypi.org/magpi February 2016<br />

71

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!