Connecting Your Raspberry Pi
Here’s a guide to setting up your Raspberry Pi. The most important thing to note here is that the power is connected last.
1 Insert your SD or microSD card.Your SD or microSD card contains the software and data for your Raspberry Pi (see Chapter 2). On the Raspberry Pi 400, insert the microSD card into the slot on the back, with the label facing up. The slot is between the general-purpose input/output (GPIO) pins and the HDMI sockets. On the Raspberry Pi Zero, your microSD card slides into the slot on the top of the board, with the card label facing up. On other models, your SD or microSD card goes into the slot on the bottom of the board. When you put your Raspberry Pi back on the desk, the card label should be facing the desk.Gently press the card home to make sure it’s well connected. The card will stick out from the side of the board. On some models (including the Raspberry Pi 400), you can press the card to pop it out again. On others, you can remove the card by just pulling it.To avoid data loss, you should only insert and remove cards with the power switched off, and you should shut down your Raspberry Pi properly when you’ve finished using it (see Chapters 4 and 5).
2 Connect your keyboard and mouse.Your keyboard and mouse can be connected directly to the USB sockets on your Raspberry Pi, and they should work fine on current models. If your Raspberry Pi has blue USB ports, they’re the USB 3.0 ones, so save them for other devices that need the extra speed. Connect your mouse and keyboard to the other ports. For earlier models and those with a single USB socket, we recommend connecting the keyboard and mouse to an externally powered USB hub that is connected to the Pi. It reduces the risk of problems caused by the devices drawing too much power from the Pi, and gives you more sockets to play with. If you’re using an official Raspberry Pi keyboard or another keyboard with a built-in hub, you can plug the mouse into the keyboard.The Pi Zero models use Micro USB sockets. Before you can connect your USB hub, you need to plug in a converter that will enable you to connect to standard USB devices. The USB converter goes into the Micro USB socket, labeled as USB on the board. Take care with this one because the socket is the same shape and size as the the power socket.You can set up Bluetooth devices after you’ve entered the desktop environment. See the “Configuring Bluetooth devices” section, later in this chapter, for more info.
3 Connect an HDMI or DVI monitor.On the Raspberry Pi Zero models, first plug the HDMI converter into the Mini HDMI socket. On other models, you can connect your HDMI or micro HDMI cable directly to your Raspberry Pi. The Raspberry Pi 4 and Raspberry Pi 400 have two micro HDMI ports, so you can use two screens.If you have a DVI display rather than an HDMI display, you need to use an adapter on the screen end of the cable. The adapter itself is a simple plug, so you just plug the HDMI cable into the adapter and then plug the adapter into your monitor and turn the screws on the adapter to hold the cable in place.
4 Connect a composite video screen.If your TV has an HDMI socket, use that socket for optimal results. Alternatively, you can use the composite video socket if your Raspberry Pi has a socket. On the original Model A and B, it’s a round, yellow-and-silver socket. On later (and current) models, it’s the same socket as the audio output. You’ll need to use a special RCA cable for this socket — you can’t just connect an audio cable. Connect one end of your RCA cable to the socket and the other end to the Video In socket on your TV, which is likely to be silver and yellow.You may need to use your TV’s remote control to switch your TV over to view the external signal coming from the Raspberry Pi. If you’re using HDMI on your TV, you may need to turn on the TV so that the Raspberry Pi can detect it when you switch it on.Note that the Pi Zero models do not have a composite video socket, but they do have composite video output. You can solder your own connector to the board where it’s labelled TV. For instructions, see https://magpi.raspberrypi.org/articles/rca-pi-zero
.There is no composite video support on the Raspberry Pi 400.On a Raspberry Pi 4, you need to enable composite output. Enable enable_tvout=1 in config.txt. See the appendix of this book for guidance on editing config.txt. The easiest solution is to connect another screen temporarily to make this change.
5 Connect to the network.The Raspberry Pi Model A, A+, and Zero have no wired network connection on the board. The other Raspberry Pi models have an Ethernet socket on the right edge of the board. Use this socket to connect your Raspberry Pi to your Internet router with a standard Ethernet cable. The Raspberry Pi automatically connects to the Internet when used with a router that supports the Dynamic Host Configuration Protocol (DHCP), which means it works with most domestic routers. For advice on troubleshooting your Internet connection, see the appendix.If you're using a Wi-Fi adapter, you can plug it into a USB socket so that it’s ready for when you switch on your Raspberry Pi. Many models, including the Raspberry Pi 4, Raspberry Pi 400, and Raspberry Pi Zero W and WH, have built-in Wi-Fi.
6 Connect the audio.If you’re using an HDMI TV, the sound is routed through the HDMI cable to the screen, so you don’t need to connect a separate audio cable. Otherwise, the audio socket of your Raspberry Pi is a small black or blue box stuck along the top edge of the board on the Model A and B, and on the bottom edge of the board on later and current models. If you have earphones or headphones from a portable music player, you can plug them directly into this socket. Alternatively, you can plug a suitable cable into this socket to feed the audio into a TV, stereo, or PC speakers for a more impressive sound. If you’re using PC speakers, note that they need to have their own power supply. There is no audio socket on the Raspberry Pi 400 and Pi Zero models.
7 Connect the power.The last thing you should do is connect the power. Take particular care with the Raspberry Pi Zero, because the power socket looks the same as the USB socket to its left.
The Raspberry Pi Foundation warns against using battery power unless you know what you’re doing, because it’s easy to damage your Pi unless you provide a steady 5 volts (5V) of power. Some cellphone emergency battery chargers can be used to provide that steady power, but proceed with caution.
The Raspberry Pi has no on/off switch, so when you connect the power, it starts working. To turn it off again, you disconnect the power. To avoid losing data, you should shut down first (see Chapters 4 and 5) and wait for that process to finish.
Setting Up Your Raspberry Pi
When you switch on your Raspberry Pi for the first time using Raspberry Pi OS, you’re guided through the basic settings.
First you set your country, language, and time zone. Then, you’re prompted to change the password. The default Raspberry Pi OS username is pi and the password is raspberry. Both of these are case-sensitive, so you can’t use PI instead, for example. It’s a good idea to change the password, but you can click Next to skip any step in the setup process. If your screen display has a black border around it, the Set Up Screen option helps fix this.
Next, you can set up your wireless network. Start by choosing your network from those that the Raspberry Pi has detected. Click Next, and you’re prompted for the password. When you click Next again, your Pi connects to the network. There’s an option to update the software, which checks whether any of the software on your card needs updating. Even if you’ve just created your microSD card, there may be updates ready to