Setting up Raspbian on a Raspberry Pi
The setup is the one thing that usually deters many novice enthusiasts from getting started with SBCs. Many times, the instructions are very generic and do not cover all the cases for various types of hardware components. That is why I have dedicated an entire section to the setup of Raspbian on RPi. In this section, we will demonstrate the setup in detail with all the board models ever produced, with the exception of the compute modules.
We need the following components for the setup:
- A Raspberry Pi board of any model.
- If you have a Raspberry Pi 4B board, then you will need a power supply of 5V 3A with a USB Type-C pin. Here is a photograph of a USB Type-C pin:
Figure 1.11 – USB Type-C pin
- To be on the safe side, you might want to purchase the official Raspberry Pi 15.3W USB-C power supply by the Raspberry Pi Foundation. The URL for this product is https://www.raspberrypi.org/products/type-c-power-supply/.
- For all the other models of Raspberry Pi, a 5V 2.5A power supply with a Micro-USB type pin should be compatible. Here's a photograph of a Micro-USB pin:
Figure 1.12 – A Micro-USB pin
- You might want to purchase a Raspberry Pi Universal Power Supply (https://www.raspberrypi.org/products/raspberry-pi-universal-power-supply/) for this purpose.
- A USB keyboard and mouse: It is a good idea to purchase a USB keyboard with an integrated mousepad, as follows:
Figure 1.13 – A keyboard with an integrated mousepad
- For RPi Zero and RPi Zero W, the keyboard with a mousepad is mandatory because these board models have only one Micro-USB type of connector to the peripherals interface. Additionally, for RPi Zero and RPi Zero W, we need a USB to Micro-USB OTG converter, as follows:
Figure 1.14 – USB OTG cable
- Raspberry Pi boards of any model work with any microSD card. The guidelines say that we should use a class 10 microSD card with a minimum of 16 GB. You might want to visit https://elinux.org/RPi_SD_cards for a compatibility list. RPi 1 Model A and RPi 1 Model B use SD cards. Therefore, it is better to have a microSD to SD card adapter, as follows:
Figure 1.15 – MicroSD to SD card adapter/converter
- An HDMI monitor or a VGA monitor for visual display.
- All RPi board models, except RPi 4B, RPi Zero, and RPi Zero W, have an HDMI output and can be directly connected to the HDMI monitor with an HDMI male-to-male cable:
Figure 1.16 – HDMI cable
RPi 4B has a micro-HDMI output. Therefore, we need a micro-HDMI to HDMI converter. RPi Zero and RPi Zero W both have mini-HDMI outputs. So, for them, we need a mini-HDMI to HDMI converter. The following photograph shows the HDMI, mini-HDMI, and micro-HDMI ports, respectively:
Figure 1.17 – HDMI, mini-HDMI, and micro-HDMI ports
We also need to plug the mini- and micro-HDMI ends to the RPi boards and the HDMI to the monitor. If you are planning to use a VGA monitor, then we will need HDMI/mini-HDMI/micro-HDMI to VGA converters depending on the board models.
Here is a photograph of an HDMI to VGA converter:
Figure 1.18 – HDMI to VGA converter
The following is a photograph of a mini-HDMI to VGA converter:
Figure 1.19 – Mini-HDMI to VGA converter
The following is a photograph of a micro-HDMI to VGA converter:
Figure 1.20 – Micro-HDMI to VGA converter
We need a Windows computer and a wired or wireless internet connection.
Finally, we require an SD card reader, as follows:
Figure 1.21 – SD card reader
Many laptops have this (SD card reader) feature built-in. So, in that case, a separate reader is not required as we can use the built-in reader.
We will need a few more hardware components by the end of the chapter. We will discuss them when the need arises. For now, we are okay to proceed further.
Downloading the necessary software
To get started, we need to download all of the free software. Follow these instructions to download all the necessary software:
Figure 1.22 – Raspbian image download page

Figure 1.23 – BitTorrent application window

Figure 1.24 – Opening the location of the downloaded image
This will open the folder that has the ZIP file for the Raspbian OS image.

Figure 1.25 – 7-Zip application window
Double-click on the ZIP file and then click on the Extract button in the menu. This will extract the file. The extracted file has the img extension.
Preparing the microSD card manually
The best way of installing an OS on a microSD card is to do it manually. This allows us to prepare the SD card manually so that we have easier access to the /boot/config.txt configuration file, which must be modified, in a few cases, before booting up the RPi. We will discuss this in detail later. The default Raspbian image has only two partitions—boot and system. I recommend choosing, at a minimum, a 16 GB class 10 microSD card. Then, follow these steps:
- Unpack the fresh microSD card and insert it into the card reader. Plug the card reader into your Windows laptop or computer. Many laptops and computers come with an SD card reader. For these, insert the microSD card into the microSD to SD card adapter, and insert the adapter into the slot for the SD card reader of the computer or laptop.
- Then, a new drive will appear in the left-hand panel of Windows File Explorer. Right-click on the drive and choose Format. Here is a screenshot of the Format window:

Figure 1.26 – Formatting the microSD card
- Make sure that you check the Quick Format checkbox. Then, click on the Start button. It will show a warning message, as follows:

Figure 1.27 – Dialogue box for confirmation
- Click on the OK button to finish formatting.
- Once the formatting is complete, we need to write the Raspbian OS image file to the microSD card. Open
Win32DiskImagerand choose the Raspbian OS image file, as shown in the following screenshot:
Figure 1.28 – The Win32 Disk Imager application window
- Then, click on the Write button. It will show the following warning box. Simply click on the OK button:

Figure 1.29 – Dialogue box to confirm writing of the image to the microSD card
- Once the OS is successfully written to the SD card, it shows the following message box:

Figure 1.30 – Confirmation message box
This means that the image has been successfully written to the microSD card. Now we can use it to boot up the RPi.
- Now, this step is necessary only if you are using a VGA monitor and not the HDMI monitor. Readers using the HDMI monitor can safely ignore this step. The microSD card's BOOT partition can be accessed using Windows File Explorer. It has the
config.txtfile. Double-click and open the file. We must edit the settings in the/boot/config.txtfile, as follows, to enable a proper display on the VGA monitor:a) Change
#disable_overscan=1todisable_overscan=1.b) Change
#hdmi_force_hotplug=1tohdmi_force_hotplug=1.c) Change
#hdmi_group=1tohdmi_group=2.d) Change
#hdmi_mode=1tohdmi_mode=16.e) Change
#hdmi_drive=2tohdmi_drive=2.f) Change
#config_hdmi_boost=4toconfig_hdmi_boost=4.g) Save the file.
The commented lines (that have # at the beginning) are disabled. We must enable these lines by uncommenting them. This can be done by removing # at the beginning of these commented lines.
Note