Chapter 1
In This Chapter
Getting familiar with the Raspberry Pi
Figuring out what you can do with a Raspberry Pi
Determining its limitations
Getting your hands on a Raspberry Pi
Deciding what else you need
The Raspberry Pi is perhaps the most inspiring computer available today. Although most of the computing devices we use (including phones, tablets, and games consoles) are designed to stop us from tinkering with them, the Raspberry Pi is exactly the opposite. From the moment you see its shiny green circuit board, it invites you to prod it, play with it, and create with it. It comes with the tools you need to start making your own software (or programming), and you can connect your own electronic inventions to it. It’s cheap enough that if you break it, it’s not going to break the bank, so you can experiment with confidence.
Lots of people are fired up about its potential, and they’re discovering exciting new ways to use it together. Dave Akerman (www.daveakerman.com) and friends attached one to a weather balloon and sent it nearly 40 kilometers above the earth to take pictures of earth from near space using a webcam.
Professor Simon Cox and his team at the University of Southampton connected 64 Raspberry Pi boards to build an experimental supercomputer, held together with Lego bricks. In the supercomputer (see Figure 1-1), the Raspberry Pis work together to solve a single problem. The project has been able to cut the cost of a supercomputer from millions of dollars to thousands or even hundreds of dollars, making supercomputing much more accessible to schools and students.
The Pi is also being used to make synthesizers, robots, gaming devices, audiobook players, home automation controls, and much more, as you discover in Chapter 20.
Although those projects are grabbing headlines, another story is less visible but more important: the thousands of people of all ages who are taking their first steps in computer science thanks to the Raspberry Pi.
Both of the authors of this book used computers in the 1980s, when the notion of a home computer first became a reality. Back then, computers were less friendly than they are today. When you switched them on, you were faced with a flashing cursor and had to type something in to get it to do anything. As a result, though, a whole generation grew up knowing at least a little bit about how to give the computer commands, and how to create programs for it. As computers became friendlier, and we started to use mice and windows, we didn’t need those skills any more, and we lost touch with them.
Eben Upton, designer of the Raspberry Pi, noticed the slide in skill levels when he was working at Cambridge University’s Computer Laboratory in 2006. Students applying to study computer science started to have less experience with programming than students of the past did. Upton and his university colleagues hatched the idea of creating a computer that would come with all the tools needed to program it, and would sell for a target price of $25 (£15). It had to be able to do other interesting things too so that people were drawn to use it, and had to be robust enough to survive being pushed in and out of school bags hundreds of times.
That idea started a six-year journey that led to the Raspberry Pi you probably have on your desk you as you read this book. It was released in February 2012, and sold half a million units by the end of the quarter. By the time the Model B+ launched in July 2014, there were about three million Raspberry Pis in homes, schools, and workplaces.
When your Raspberry Pi arrives, you’ll see it’s a circuit board, about the size of a credit card, with components and sockets stuck on it, as shown in Figure 1-2. In an age when most computing devices are sleek and shiny boxes, the spiky Pi, with tiny codes printed in white all over it, seems alien. It’s a big part of its appeal, though: Most of the cases you can buy for the Raspberry Pi are transparent because people love the look of it.
There are several different versions of the Raspberry Pi:
So, which version should you get? Our advice would be to get the Model B+ unless you have a specific application in mind that requires low power, in which case get a Model A. There’s one caveat: If you want to use add-on components that connect to your Raspberry Pi, beware of compatibility problems. Because there are more GPIO pins on the Model B+, add-ons designed for the Model A or Model B might not fit the Model B+, and vice versa.
Instead of running Windows or Mac OS, the Raspberry Pi uses an operating system called Linux. It’s a leading example of open source, a completely different philosophy to the commercial software industry. Instead of being created within the heavily guarded walls of a company, with its design treated as a trade secret, Linux is built by companies and expert volunteers working together. Anyone is free to inspect and modify the source code (a bit like the recipe) that makes it work. You don’t have to pay to use Linux, and you’re allowed to share it with other people too.
You probably won’t be able to run the software you have on your other computers on your Raspberry Pi. It won’t run Windows or Mac software, and not all Linux software works on the Raspberry Pi. But a lot of Linux software that is compatible with the Raspberry Pi is available and is free of charge.
The Raspberry Pi is a fully featured computer, and you can do almost anything with it that you can do with a desktop computer.
When you switch it on, it has a text prompt (see Chapter 5), but you can use a graphical windows desktop to start and manage programs. You can use it for browsing the Internet (see Chapter 4), word processing and spreadsheets (see Chapter 6), or for editing photos (see Chapter 7). You can use it for playing back music or video (see Chapter 8), or for playing games. You can use the built-in software to write your own music, too (see Chapter 14). It’s the perfect tool for homework, but it’s also a useful computer for writing letters, managing your accounts, and paying bills online.
The Raspberry Pi is at its best, however, when it’s being used to learn how computers work, and how you can create your own programs or electronics projects using them. It comes with Scratch (see Chapter 9), which enables people of all ages to create their own animations and games, while learning some of the core concepts of computer programming along the way.
It also comes with Python (see Chapter 11), a professional programming language used by YouTube, Google, and Industrial Light & Magic (the special effects gurus for the Star Wars films), among many others.
It has a General Purpose Input/Output (GPIO) port on it that you can use to connect up your own circuits to the Raspberry Pi, so you can use your Raspberry Pi to control other devices and to receive and interpret signals from them. In Part V, we show you how to build some electronic games controlled by the Raspberry Pi.
For something that costs so little, the Raspberry Pi is amazingly powerful, but it does have some limitations. Although you probably use it as a desktop computer, its power is closer to a mobile device (like a tablet) than a modern desktop PC.
By way of example, the Raspberry Pi Foundation says the Pi’s overall performance is comparable with a PC using a 300 MHz Pentium 2 processor, which you might have bought in the mid to late nineties, except that the Raspberry Pi has much better graphics. The memory of the Raspberry Pi is more limited than you’re probably used to, with just 512MB or 256MB available. You can’t expand that with extra memory in the way you can a desktop PC.
The graphics capabilities lag behind today’s market somewhat too: The Raspberry Pi Foundation says the Pi’s graphics are roughly the same as the original Xbox games console, which was released ten years ago.
Both the Pentium 2 PC and the original Xbox were fine machines, of course, for their time. They’re just not as snappy as we’re used to, and that’s where you might experience some problems. You might find that the Pi can’t keep up with the demands of some modern software and that some programs don’t run fast enough to be useful on it. However, it’s easy to find programs, try them, and remove them if they’re no good (see Chapter 5), and plenty of programs for work and play run well on the Raspberry Pi (see Chapter 19).
If you already have another computer, the Raspberry Pi is unlikely to usurp it as your main machine. But the Pi gives you the freedom to try lots of things you probably wouldn’t dare to try, or wouldn’t know how to try, with your main PC.
The Raspberry Pi was created by the Raspberry Pi Foundation, a charity registered in the UK. The charity’s six trustees funded the manufacture of the first large batch themselves, but it sold out rapidly so it quickly became clear that they needed something that would scale better.
The Foundation now licenses the design of the Raspberry Pi to RS Components (www.rs-components.com), Allied Electronics (www.alliedelec.com), and Premier Farnell, which uses the brand name Element 14 (www.element14.com/community/groups/raspberry-pi). In China, you can buy a red-colored Raspberry Pi from Egoman (http://mall.egoman.com.cn). These companies fund and manage the manufacture of the Raspberry Pi, market and sell it, and look after their customers. They accept orders through their websites and are able to offer a number of the accessories you might also need. Some other electrical retailers also stock the Pi now, typically as part of a bundle with a keyboard, mouse, and other accessories. The official Raspberry Pi Swag Store (http://swag.raspberrypi.org/) also sells some Raspberry Pi boards and accessories.
It’s possible that more companies will license the design of the Pi in the future, so check the Raspberry Pi Foundation’s website at www.raspberrypi.org for current links to stores that sell the Pi.
Secondhand Raspberry Pis can be bought on eBay (www.ebay.com), but we would recommend getting a new one so you benefit from the customer support available, and have the peace of mind that it hasn’t been damaged by the previous owner.
The creators of Raspberry Pi have stripped costs to the bone to enable you to own a fully featured computer for about $35, so you’ll need to scavenge or buy a few other bits and pieces. We say “scavenge” because the things you need are exactly the kind of things many people have lying around their house or garage already, or can easily pick up from friends or neighbors. In particular, if you’re using a Raspberry Pi as your second computer, you probably have most of the peripherals you need. That said, you might find they’re not fully compatible with the Raspberry Pi and you need to buy replacements to use with the Pi.
Here’s a checklist of what else you might need:
When the Raspberry Pi behaves unpredictably it’s often because the keyboard is drawing too much power, so avoid keyboards with too many flashing lights and features.
A list of compatible and incompatible devices is maintained at http://elinux.org/RPi_VerifiedPeripherals and you can check online reviews to see whether others have experienced difficulties using a particular device with the Raspberry Pi.
If you’re buying new devices, you can minimize the risk by buying recommended devices from Raspberry Pi retailers.
In any case, you should set a little bit of money aside to spend on accessories. The Raspberry Pi is a cheap device, but buying a keyboard, mouse, USB hub, and cables can easily double or triple your costs, and you might have to resort to that if what you have on hand turns out not to be compatible.
18.190.25.193