alt="Snapshot of the Bluetooth and Wi-Fi buttons, beside the volume control and clock."/>
FIGURE 3-3: The Bluetooth and Wi-Fi buttons, beside the volume control and clock.
Click a network to select it and you’re prompted to enter the Pre-shared Key, which is the Wi-Fi password. If the connection fails or drops, the Wi-Fi icon changes to an icon with two red crosses on it.
You can test whether your connection is working by opening the web browser and visiting a web page with it (see Chapter 4).
After you’ve set up a Wi-Fi network using the tool, your Raspberry Pi remembers it, so it automatically reconnects whenever you restart your Raspberry Pi or reconnect after previously turning off Wi-Fi. You can also use the network connection you have set up from the command line.
When you connect to a new network, the Pi doesn’t remember the previous network’s password, so you need to reenter it if you want to reconnect to it later.
Configuring Bluetooth Devices
The Raspberry Pi 4, 400, 3, and Pi Zero W are Bluetooth-enabled, so you can use a wireless Bluetooth keyboard and/or mouse with your Pi.
Not all wireless devices are Bluetooth-enabled: Keyboards and mice that come with their own USB dongles typically don’t use Bluetooth.
The process of getting two Bluetooth devices to work together is called pairing them. Check the instructions for your device to see how you make it discoverable so that your Raspberry Pi can pair with it. This isn’t always obvious: On Sean’s mouse, the process involved pushing and holding a button and then pushing the two mouse buttons together and holding them until the mouse started flashing.
Once you have made your device discoverable, click the Bluetooth menu at the top of the screen (refer to Figure 3-3) and choose Add Device. Your Raspberry Pi will search for devices. When it finds your device, click it and then click the Pair button. When setting up a keyboard, we had to enter a code shown on the screen on the new keyboard. With the mouse, we were asked to confirm that a code was showing on the mouse (which it couldn’t be, because the mouse has no display), but we confirmed that it was, to complete the setup.
Connecting the Raspberry Pi Camera Module
Lots of accessories and add-ons are available for the Raspberry Pi, but the Raspberry Pi Camera Module devices are official products from the Raspberry Pi Foundation. The camera module is a small circuit board with a strip of ribbon cable that plugs directly into the Raspberry Pi board. The Raspberry Pi High Quality Camera is a heavier and larger board, with a built-in screw mount for a tripod. You need to buy a lens separately and fix it to the camera. You can see both in Figure 3-4.
It’s easiest to connect your camera before you plug your Raspberry Pi into any cables.
The Raspberry Pi 400 does not have a camera connector.
FIGURE 3-4: The Raspberry Pi High Quality Camera (left) and Camera Module (right). The Camera Module has a lens built in, but there is no lens fixed to this High Quality Camera yet.
Connecting the camera on a Pi Zero
The Pi Zero camera socket uses a different width of cable to the main Raspberry Pi boards. You can buy the cable separately or get it with the official Pi Zero case.
The camera and the Pi board have similar sockets for the cable. You press the connector between your thumb and finger and gently pull to open the connector. The parts don’t separate, but there’s enough of a gap to remove and insert the cable. On the Raspberry Pi, the camera connector is on the right of the board.
Figure 3-5 shows the camera connected to a Raspberry Pi Zero. On the camera, insert the cable with the shiny contacts facing the camera front, and then press the socket closed again. On the Raspberry Pi Zero, insert the cable with the shiny contacts facing the bottom of the board (the flat side). When the cable is flat, the camera will be facing down, but you can bend the cable so that the camera sits on top of the board and faces up. One of the covers for the official Pi Zero case has a hole in it for the camera lens.
FIGURE 3-5: Connecting the Raspberry Pi Camera Module to a Raspberry Pi Zero.
Connecting the camera on other Raspberry Pi models
The camera connector socket on the other Raspberry Pi models is about 1 inch long, and it touches the bottom edge of the board.
To open the camera connector on your Raspberry Pi board, hold the ends between your finger and thumb and gently lift. The plastic parts don’t separate, but they move apart to make a gap. This is where you insert the camera’s cable.
At the end of the camera’s cable are silver connectors on one side. Hold the cable so that this side faces to the left, away from the side with the USB socket(s). Insert the cable into the connector on the board and press it gently home, and then press the socket back together again.
If the cable needs to be connected at the camera end, the shiny side of the cable should point towards the camera front. Figure 3-6 shows a camera connected to a Raspberry Pi 4.
FIGURE 3-6: Connecting the Raspberry Pi Camera Module to a Raspberry Pi 4.
Testing the Camera Module
Let’s test whether your camera is working correctly.
Make sure the camera is enabled: Go into the Raspberry Pi Configuration tool, click Interfaces, and select Enabled beside the Camera option. For more information, see the “Configuring Your Raspberry Pi in Raspberry Pi OS” section, earlier in this chapter. You’ll need to reboot after enabling the camera.
We’ll test the camera from the command line interface, which is covered in more depth in Chapter 5. Click the Terminal icon at the top of the screen to start. It has a >_
symbol on it. To take a still photo, type in this command:
raspistill -o testshot.jpg
You should see what the camera sees onscreen for a moment before it takes the photo. The picture is saved with the filename testshot.jpg
. You can verify that the image was created by looking at the files