The physical computing capabilities of the Raspberry Pi

Get the newsletter

While the Raspberry Pi is an excellent and affordable mini Linux computer with a stylish and functional desktop user interface, it has plenty of scope beyond that of a regular PC. Here's an overview of the physical computing capabilities of the Pi.

GPIO pins

Since 2014, with the release of the Model B+, the Raspberry Pi's form factor has stayed the same, including the uniform 40-pin GPIO (General Purpose Input/Output) pin header.

CC BY-SA Raspberry Pi Foundation

These pins allow you to connect electronic components and program physical devices in the real world, such as inputs like sensors and outputs like lights. The pins include:

Add-on boards / HATs

You can connect simple components directly to the pins using jumper wires, or you can use a breadboard to hold everything in place and allow components to share use of some pins.

CC BY-SA Raspberry Pi Foundation

Alternatively, you can use add-on boards that provide embedded components on a PCB (printed circuit board), which sits on top of the Pi's GPIO pins. Soon after the B+ launch, the Raspberry Pi Foundation published the specification for a HAT (Hardware Attached on Top) standard, which determines the dimensions and other requirements for what can be considered a HAT. HATs are add-on boards that fit neatly on top of the Pi with aligned mounting holes, and some have slots for the camera and display cables. The community of Raspberry Pi accessory retailers have produced a wide range of HATs.

CC BY-SA Raspberry Pi Foundation

The Raspberry Pi Foundation has produced one official HAT of its own named the Sense HAT, which was made especially for the Astro Pi space mission aboard the International Space Station. It is also available for purchase. It encompasses a LED grid, a mini joystick, and a series of sensors. Read more about programming the Sense HAT.

HATs are a great way of extending the capabilities of your Raspberry Pi to use in a project without having to wire up or solder components. See my Top 10 Raspberry Pi Add-on Boards.

GPIO with Python

It's possible to control the GPIO pins from a wide range of programming languages, but the simplest and most popular way is to use Python. The GPIO Zero library provides a simple interface to GPIO devices and includes support for a range of components and add-on boards. With just a few lines of code you can flash an LED:

Camera module

The camera module is an official Raspberry Pi accessory and it comes in two variations, a visible light camera and an infrared camera. The current version of the camera (V2) has an 8-megapixel resolution, whereas the original camera was 5 megapixels.

CC BY-SA Raspberry Pi Foundation

You can control the camera module with the command-line tools raspistill and raspivid or with the Python library picamera:

Physical computing projects at home

Once you've learned how to get started with Raspberry Pi, and tried some simple GPIO examples, it's easy to move on to some hobby projects of your own, perhaps in home automation or IoT. What do you want to make?

Topics

About the author

Ben Nuttall - Ben Nuttall is the Raspberry Pi Community Manager. In addition to his work for the Raspberry Pi Foundation, he's into free software, maths, kayaking, GitHub, Adventure Time, and Futurama. Follow Ben on Twitter @ben_nuttall.

Footer

The opinions expressed on this website are those of each author, not of the author's employer or of Red Hat.

Opensource.com aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. Red Hat and the Shadowman logo are trademarks of Red Hat, Inc., registered in the United States and other countries.