Chapter 1
The Raspberry Pi is a super-cool, super-small, super-cheap microcomputer. In fact, it’s a super-cool, super-small, super-cheap microcomputer board, and it doesn’t do much on its own. Before you can do super-clever things with it, you have to add some extras to build a Pi system.
The Raspberry Pi, shown in Figure 1-1, is a tiny computer developed in the UK by the Raspberry Pi Foundation (www.raspberrypi.org
). It’s much smaller than a Mac or PC — it’s almost exactly the same size as a credit card! And it’s also much cheaper. (Prices vary, but a Pi costs around $30 in the United States and between £20 to £30 in the UK.)
Here are a few of the things you can do with a Pi:
Although the Pi is a fully working computer, it’s not a Mac, a PC, a tablet, or a games console. It’s not as powerful as more expensive computers. Here are some things you can’t do with a Pi:
Does that seem disappointing? It shouldn’t.
To make up for it, you can do a lot of things with a Pi you can’t do with a bigger computer. For example, you can
You can see now why the Pi is special. Unlike a PC or a Mac, it’s so small and cheap you can buy a separate Pi for every project. You can leave it running all the time. And it comes with a good set of simple tools for writing software — all free.
Pi boards come in different types (see Table 1-1). You need to know about the differences so that you don’t buy the wrong one.
Table 1-1 Comparing Raspberry Pi Models
Model |
What It’s Good For |
A |
Out of date now. Don’t buy one! |
B |
Out of date. |
A+ |
Smaller, cheaper, slower than a Pi 2. Only useful for special projects. |
B+ |
Out of date. Get a Pi 2! |
Pi 2 Model B |
You want this one. |
The older models are called the A and B boards. The newer models are called the A+ and B+ boards. As of early 2015, there’s an even newer, faster, shinier, and better board called the Pi 2.
Figure 1-2 shows a Model B+ and a Model B.
The boards are the same size, and they use the same software. But they have different numbers of connectors and other bits and pieces.
What’s the deal with the A+? It’s a cut-down budget Pi board with some important bits missing. It’s definitely not the Pi you want when you’re starting out.
It may, sometimes, kind of, perhaps be the right board for small finished projects. But don’t get one until you’ve read the rest of this book!
When you buy a Raspberry Pi, you get a small circuit board. And that’s it. On its own, the board does nothing. You can’t do anything with it, except look at it, and maybe play catch, which is fun but not what it’s made for.
To turn a Pi board into a working computer, you have to add some extras. Collecting all the extras and connecting them to the Pi is your first project. And it’s a big one!
Here’s a list of what you need:
Are you getting a Pi 2? You don’t need a hub. Did you get an old Model A+ or B+ board? You don’t need a hub either.
Otherwise, there’s something you need to know: the original A/B models had a problem: If you plugged a keyboard and mouse into the USB connectors, the Pi often stopped working.
Figure 1-3 shows how you have to fix this issue by connecting everything to the Pi, including a keyboard, and mouse, through a USB hub.
The A+/B+/2 models work fine without a hub, as shown in Figure 1-4. This makes them easier to set up. They don’t need so many wires and cables.
You can use any mouse or keyboard with a USB plug. Models with a cable should just work. You can probably use wireless models, as long as they come with a USB receiver dongle. (Anything made by Logitech should work.) Bluetooth mice and keyboards probably won’t work.
You don’t need to spend a lot of money on these extras. Basic models are fine.
The Pi can work with a monitor or a TV.
The best way to connect the Pi to a monitor is to use the HDMI socket. Most new TVs and many monitors have an HDMI socket that takes an HDMI cable. Hook up the cable to the Pi at one end and the monitor or TV at other, and you’re done.
Figure 1-5 shows where the HDMI connector is.
The monitor/TV doesn’t have to be very new, or very good. The Pi can barely produce HD video. Almost any monitor less than ten years old should work fine.
A few monitors have a different socket called a DVI-D connector. If you can’t find a monitor with HDMI, you need an adaptor cable with an HDMI plug at one end and a DVI plug at the other. Look on Amazon and eBay for a cheap one.
If your monitor has only a VGA connector, you need a special adaptor and a cable. Amazon and eBay should help again, but you may as well see whether you can find a used new or used monitor with the right connections. It may be cheaper than an adaptor.
Wait — USB? VGA? DVI? HDMI? What do all these letters mean? If you don’t already know, search the web to find out!
Type the letters into a browser search bar and see what you get. Search for images to see pictures.
You don’t need to know how the cables work. You don’t even need to remember that HDMI stands for High-Definition Multimedia Interface. (Like, really, who cares?)
But you do need to be able to tell cables apart so that you know which cable goes where on the Pi. You can also use the photos in this chapter as a guide. For example, Figure 1-6 shows the network/Ethernet and USB connectors on the side of a B+ board.
The Pi doesn’t have a disk drive. It stores everything on a small memory card. The Model A or B needs an SDHC card with a speed rating of 8 or 10. For a Model A+/ B+/2, get a microSD card.
Figure 1-7 shows the bottom of a Model B+. The memory card is the black rectangle at the right.
The card should hold at least 4GB. You can get a bigger card if you like, but it will cost more, and most of the space will be wasted.
The cheap option is to get a blank card — Amazon is a good choice — and write the software to the card by hand. You can only do this if your Mac or PC has a card reader/writer. If it doesn’t, you’ll have to buy one for about $5 to $10 (less than £10 in the UK).
The lazy option is to buy a card with the Pi software already installed. The software is called NOOBS. You can buy prewritten cards from Amazon and shops that specialize in Pi extras. The cards cost a few dollars or pounds more, but they save you some time.
You can use a standard USB power supply as long as it’s 2A, 2.1A, or 2100mA. This means it produces plenty of spare power. If it isn’t labeled 2A, 2.1A, or 2100mA, your Pi may not work properly.
The best way to find a power supply is to look for Raspberry Pi Power Supply online. Don’t forget to look for the 2A tag!
You’ll probably need a network cable, which is sometimes called an Ethernet cable. The cable should be Cat 5 or Cat 6. Plug one end of the cable into your home Internet router and the other into the network socket on the Pi.
If you want to plug more than one Pi to a home network, buy a long cable and a network switch — a box with lots of network sockets. Plug the long cable into one of the sockets and other computers into the other sockets. The other end of the cable goes into your home router. (If this is too hard, ask a grown-up to help you. If you can’t find a grown-up to help, search the web!)
You can add a lot of extras to your Pi. You don’t need them to get started, but they can give you more options and maybe make your Pi easier to use.
You don’t really need a case, but a good one will help protect your Pi from falling objects, fat fingers, and annoying brothers or sisters.
Search the web for Raspberry Pi case to see a very long list of cases. Pick one that looks good. They all do more or less the same thing. A/B, A+/B+, and Pi 2 cases are different, so make sure that you get the right one. Figure 1-8 shows a Pi inside a typical case.
If you don’t use a case, put your Pi on something that doesn’t conduct electricity. Thick paper, cardboard, wood, plastic, glass, and ceramics (plates and such) are all fine. Baking trays, metal foil, cutlery, silver plate, and gold bars are all bad because they can create a short circuit.
If you’re lucky, a short circuit will stop your Pi until you restart it. If you’re not, it will kill your Pi dead forever. (Although if you have gold bars to spare, you can always buy another Pi. Or ten.)
If you want to add WiFi, you have to plug a WiFi dongle — a small plastic stick with a USB plug at one end and WiFi electronics at the other — into a USB port.
A camera is a popular Pi extra. Most USB webcams work just fine with the Pi, but very old or very cheap webcams (less than $10) may not.
The official Pi Camera module is another option. It’s a tiny electronic board with an even tinier camera that works better than you expect it to. The Pi comes with ready-made software for the camera, so — unlike a webcam — you don’t have to write your own.
The camera is quite delicate, and if you use it a lot, you’ll want to put your Pi and the camera inside a special camera-friendly case. Search the web for Pi camera case for the latest options.
The Pi has a standard audio jack socket, like the ones on many mobile phones and MP3 players. You can plug a pair of speakers or headphones into the socket. If the Pi makes some noise, you’ll hear it.
The smart way to buy a Pi system is to buy a Pi Starter Kit from a Pi shop. The right Pi kit will have everything you need, except a monitor/TV and (usually) a monitor cable. Search online for Raspberry Pi Starter Kit to find the latest deals.
Some Starter Kits include a Model B instead of a B+. Check this so that you know what you’re getting. Be careful to buy a Starter Kit, not an Electronics Kit; some shops sell kits of electronic parts for Pi projects. You may want one later, but you can’t start with one! Make sure that your kit includes a power supply, keyboard, mouse, memory card, and cables.
If you don’t want to buy a kit, many families have an old computer parts box or shelf. It’s usually in the corner of an attic, garage, den, or spare room. To save money, raid the shelf and see what you find. You’ll often discover old mice and keyboards, cables, and perhaps even an old monitor.
If your family doesn’t have one, you can try asking uncles and aunts. Or you can get together with your friends to see what they’ve got!
Table 1-2 is a list of Pi parts. You can check off items as you find them or buy them.
Table 1-2 A Handy Pi System Checklist
Extra |
Do I Need One? |
Can I Find a Spare One? |
Do I Need to Buy One? |
Monitor or TV |
Yes |
||
USB Hub |
Only for a Model A/B |
||
2A USB Hub Power Supply |
Only for a Model A/B |
||
USB Keyboard |
Yes |
||
USB Mouse |
Yes |
||
2A Power Supply |
Yes |
||
SDHC Memory Card |
Only for a Model A/B |
||
Micro SDHC Memory Card |
Only for a Model A+/B+/2 |
||
Card Reader/Writer |
Only if your Mac/PC doesn’t have one already |
||
Ethernet Cable |
Yes |
||
WiFi Dongle |
Only if you can’t use an Ethernet cable |
||
HDMI to HDMI cable |
Depends on monitor/TV |
||
HDMI to DVI cable |
Depends on monitor/TV |
||
Case |
Nice to have |
||
Camera |
Nice to have |
18.222.20.101