Raspberry Pi User Guide. Eben UptonЧитать онлайн книгу.
stored in the memory is lost when the Pi loses power or is switched off.
Below the SoC are the Pi's video outputs. The wide silver connector is a High-Definition Multimedia Interface (HDMI) port, the same type of connector found on media players and many satellite and cable set-top boxes. When connected to a modern TV or monitor, the HDMI port provides high-resolution video and digital audio. A composite video port, which is designed for connection to older TVs that don't have an HDMI socket, is provided as part of the black and silver 3.5 mm AV jack to the right of the HDMI socket. The video quality is lower than is available via HDMI, and only lower-quality analogue audio can be used. You'll need a 3.5 mm AV adapter cable to use the composite video output, but you can use the analogue audio output with any standard 3.5 mm stereo audio cable.
The Raspberry Pi Zero has a somewhat different layout. In place of a full-size HDMI socket is a mini-HDMI socket, which requires a mini-HDMI to HDMI cable or adapter to connect to a TV or monitor. The Pi Zero also lacks the 3.5 mm AV jack of the larger Pi models; there is no analogue audio output by default, and composite video is available only by soldering a cable or RCA jack to the two empty holes on the upper left of the board marked TV.
The pins to the top left of the Pi compose the general-purpose input/output (GPIO) header, which you can use to connect the Pi to other hardware. The most common use for this port is to connect an add-on board. An example, the Sense HAT, is described in Chapter 16. The GPIO port is extremely powerful, but it’s fragile. When handling the Pi, always avoid touching these pins, and never connect anything to them while the Pi is switched on.
The plastic and metal connector below the GPIO port is the Display Serial Interface (DSI) port, which is used to connect digitally driven flat-panel display systems. These are rarely used because the HDMI port is more flexible, though the official Raspberry Pi touchscreen accessory is one of the few displays to make use of the port. A second plastic and metal connector, found to the right of the HDMI port, is the Camera Serial Interface (CSI) port, which provides a high-speed connection to the Raspberry Pi Camera Module. For more details on the CSI port, see Chapter 15, “The Raspberry Pi Camera Module”.
The Pi Zero, again, has a different layout: there is no DSI port available on this model of Pi, and a compact CSI port is used in place of the full-size version found on the larger Pi models. This compact CSI port requires the use of an adapter cable or board to connect to the Raspberry Pi Camera Module. Older revisions of the Pi Zero have no CSI port at all and cannot use the Camera Module as a result.
At the very bottom left of the board is the Pi's power socket. This is a micro-USB socket, the same type found on most modern smartphones and tablets. Connecting a micro-USB cable to a suitable power adapter, detailed in Chapter 2, “Getting Started with the Raspberry Pi”, switches the Raspberry Pi on. Unlike a desktop or laptop computer, the Pi doesn't have a power switch and will start immediately when power is connected. For the Raspberry Pi Zero, the power socket is found on the far right of the board rather than the far left.
On the underside of the Raspberry Pi board on the left-hand side is a micro-SD card slot. A Secure Digital (SD) memory card provides storage for the operating system, programs, data and other files, and is non-volatile. Unlike the volatile RAM, it will retain its information even when power is lost. In Chapter 2, you'll learn how to prepare an SD card for use with the Pi, including installing an operating system in a process known as flashing. The Pi Zero has the micro-SD card slot on the top side of the board, rather than the underside.
The right-hand edge of the Pi will have different connectors depending on which model of Raspberry Pi you have; these models are described in more detail in the following pages. The board also includes one or more light-emitting diodes which provide visual feedback as to the status of the board: whether it is powered, whether it has a network connection, whether it is actively accessing the micro-SD card, and so forth.
Model A/B
The original Raspberry Pi models launched were known as the Model A and the Model B (see Figure 1-2). Both had the same Broadcom BCM2835 SoC at their heart, but differed in specification: the Model A had 256 MB of RAM, a single USB port, and no networking capabilities; the Model B had either 256 MB or 512 MB of RAM depending on when it was purchased, two USB ports, and a 10/100 wired network port.
FIGURE 1-2: The Raspberry Pi Model B board
These models are immediately recognisable due to the smaller than normal GPIO port, which has only 26 pins compared to a modern Pi's larger 40-pin port. Both models also use full-size SD cards for storage, rather than the compact micro-SD cards of newer models. No longer manufactured, Raspberry Pi Model As and Bs are nevertheless still compatible with the majority of software designed for newer models but cannot use add-on hardware based on the HAT standard, as described in Chapter 16.
If you have a Raspberry Pi Model A or Model B, you can follow most of the material in this book without difficulty; simply pay close attention to sections such as Chapter 14, “The GPIO Port”, to ensure that you're not relying on information written with newer models in mind when wiring hardware directly into the Pi.
Model A+/B+
The original Model A and B proved popular, but were quickly replaced with a new board design known as the Plus. Split into the Model A+ and Model B+ (see Figure 1-3), these revisions introduced the now-standard 40-pin GPIO header while also improving various other features; they did not, however, change from the BCM2835 SoC, meaning there is no appreciable difference in performance between the Plus variants and the older non-Plus models.
FIGURE 1-3: The Raspberry Pi Model B+ board
The hardware split between the Model A+ and Model B+ is similar to that of the Model A and Model B: the A+, which has a smaller footprint than the Model A, has either 256 MB or 512 MB of memory depending on when it was purchased, a single USB port, and no network capabilities; the Model B+ has 512 MB of memory, four USB ports, and a 10/100 wired network port.
The Raspberry Pi Model A+ and Model B+ are compatible with all software and devices mentioned in this book, and use the same GPIO layout as the newer-model Pi variants. If you currently own a Model A+ or Model B+, the only reason you may have to upgrade is to improve performance, gain additional memory, or enjoy built-in wireless capabilities.
Raspberry Pi 2
While the Plus and prior boards all used the same BCM2835 SoC, the Raspberry Pi 2 (see Figure 1-4) was the first to feature a brand new processor: the BCM2836 SoC. Featuring four processor cores to the original's lone core, the BCM2836 offers anything between four and eight times the performance of its predecessor – making everything from word processing to compiling code run faster. The board also boasts 1 GB (1024 MB) of RAM, double the maximum previously available, making multitasking and memory-intensive applications smoother and more responsive.
FIGURE 1-4: The Raspberry Pi 2 board
Layout-wise, however, little has changed from the Model B+. The Raspberry Pi 2 features the same 40-pin GPIO header, four USB ports, 10/100 wired network port, and all other ports. If you have a case or add-on device which works with a Model B+, it will also work just fine with the Raspberry Pi 2 – but may run considerably faster!
The