Raspberry Pi For Dummies. Sean McManus
Читать онлайн книгу.for your project. If you want to support the Raspberry Pi Foundation while buying cheaper, secondhand boards, you can donate to the foundation online.
The older models are described in this list:
Raspberry Pi 1 Model B with 256MB memory: Although it’s called Model B, this was the first Raspberry Pi to be released, in February 2012. The Raspberry Pi Model B features an Ethernet connection for the Internet and two USB ports. It uses an SD card for storage.
Raspberry Pi 1 Model B with 512MB memory: Released in October 2012, the Raspberry Pi Model B had twice the memory capacity. This improved the speed of some software, especially applications that used images heavily.
Raspberry Pi 1 Model A: The Model A, released in February 2013, is a stripped-down version of the Model B. It has just one USB port and doesn’t have an Ethernet port for connecting to the Internet. It has 256MB of memory.
Raspberry Pi 1 Model B+: The Model B+, released in July 2014, has been described by the Raspberry Pi Foundation as “the final evolution of the original Raspberry Pi.” It runs all the same software as the previous versions of the Raspberry Pi, but it has four USB ports, more GPIO pins for connecting electronics projects to the Pi, and lower power consumption and better audio than the Model B. In common with the Model B, it has 512MB of memory. Although all previous versions use SD cards for data storage, the Model B+ introduced the smaller microSD cards, which are now standard on the Raspberry Pi.
Raspberry Pi 2 Model B: Launched in February 2015, this model doubled the memory on the Model B+ to 1GB. It increased performance, compared to the Model B+, while retaining its physical features. Over the years the Pi’s performance has been improved through new software releases as well as updates to the hardware. The Pi 2 represents an immediately noticeable speed-up, compared to the Model B+.
Raspberry Pi 3 Model B: Launched in February 2016, this model has a new 64-bit processor, which means it can handle data in bigger chunks than the previous 32-bit processor. The Raspberry Pi 3 Model B is 50 percent to 60 percent faster than the Raspberry Pi 2 Model B when working in 32-bit mode.
Raspberry Pi 3 Model B+: Launched in March 2018, this model has a faster processor and improved networking speeds. It introduced support for PoE, which enables the Raspberry Pi to be powered through the Ethernet cable. You’ll need to add the Raspberry Pi PoE HAT accessory.
If you’re using anything earlier than the Model B+, you’ll need full-size SD cards (not microSD) for storage, and you’ll only have 26 GPIO pins to play with. Current add-ons are unlikely to be compatible with the early boards, so check their requirements before you buy.
Many of the projects in this book will work on older Raspberry Pi models (indeed, they first appeared in previous editions of this book when those models were the latest thing). But for best performance, we recommend using a current model, if possible.
WHAT’S THE RASPBERRY PI COMPUTE MODULE?
You’ll also see the Raspberry Pi Compute Module in the online stores alongside the Raspberry Pi, but this is something quite different.
The Compute Module, or C for short, is designed for industrial use and intended to be built into a product you’re manufacturing. The modules tend to follow the release of the main Raspberry Pi models. There are also light versions available that correspond to the Model A of the Raspberry Pi. They’re built on a SODIMM board, which is what is sometimes used for PC memory modules. You’re supposed to design your own board to plug the Compute Module into, but a development kit is available with a C module and an example motherboard containing all the normal plug-in connectors (see www.raspberrypi.org/products/compute-module-development-kit-2
). Note, however, that this is an expensive way to buy what is otherwise a normal Raspberry Pi. Currently, the Raspberry Pi Compute Module 4 is the latest one, but the dev kit uses the Compute Module 3.
We only mention the Compute Module here in case you wonder what it is: It’s not covered further in this book, and it’s almost certainly not what you want to buy for your first Raspberry Pi.
RASPBERRY PI PICO: A MICROCONTROLLER, NOT A COMPUTER
The Raspberry Pi Pico is a radical new departure for the Raspberry Pi Foundation. Whereas previous devices were general-purpose computers, Raspberry Pi Pico is a microcontroller. A microcontroller is usually built into a device that does one job, such as a heating system or a microwave oven.
You can use the Raspberry Pi Pico for your electronics projects. You program it by connecting it to a computer. It’s similar to the Arduino, which you might have heard of, but the Pico uses the Raspberry Pi Foundation’s own custom chip.
The big advantage of a microcontroller is that there is no operating system to get in the way of things, so you can get precise control over the signals coming from its pins. This is important for things like audio generation and motor/servo control.
The Raspberry Pi Pico can be programmed using either MicroPython or C, which are both programming languages. (A programming language is a way of giving instructions to a computer or computing device – Part 4 introduces you to some programming languages). MicroPython is a version of Python optimized for running on microcontrollers. There are a few differences in some instructions, but MicroPython mostly looks the same as Python. You can program a Pico using Thonny, a Python programming tool available in Raspberry Pi OS. You get the option of saving your code into the Pico’s memory or your computer. Any code saved into a file called main.py
will run automatically when power is applied to the Pico, independently of whether you have a computer attached.
Programming a Pico in C, however, is not for the fainthearted. It requires a long process to prepare the C code for compiling or the use of a complex piece of software. We expect it to get easier, but at the moment we would recommend MicroPython instead.
The Raspberry Pi Pico is extremely cheap: It costs just $4, and it doesn't need an additional microSD card for storage.
You can find more information on the Raspberry Pi Pico in Chapter 17, but our focus in this book is on the Raspberry Pi computers and not the microcontroller. When we say “the Raspberry Pi,” we’re referring to the computers.
Figuring Out What You Can Do with a Raspberry Pi
The Raspberry Pi is a fully featured computer, and you can do almost anything with it that you can do with a desktop computer.
Instead of running Windows or macOS, 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. Rather than 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 has a graphical windows desktop to start and manage programs (see Chapter 4) as well as a shell for accepting text commands (see Chapter 5). You can use it for browsing the Internet (see Chapter