# Setting up Raspberry Pi

Raspberry Pi will require the installation of an operating system. The easiest way to install an operating system on Raspberry Pi is to use the [Raspberry Pi Imager tool](https://www.raspberrypi.com/software/).

While the Raspberry Pi Imager tool offers live download and installation of the Raspberry Pi OS, this tutorial uses a manual download and install option.

Download the latest 32-bit version of [Raspberry Pi OS with Desktop](https://www.raspberrypi.com/software/operating-systems/). Save the \*.img.xz file anywhere on your laptop. This will be used in the following steps.

Next, download and install [Raspberry Pi Imager](https://www.raspberrypi.com/software/) on your laptop.

<figure><img src="https://1642858864-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MW_pkggCd-D5nsvstvb%2Fuploads%2FqxC3qR5XnBCijFMrNwQV%2Fimage.png?alt=media&#x26;token=13e21880-311e-43e7-94b9-9812bf73ed69" alt="" width="563"><figcaption><p>Raspberry Pi Imager</p></figcaption></figure>

Choose your Raspberry Pi board after clicking on the `Choose Device` option.

<figure><img src="https://1642858864-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MW_pkggCd-D5nsvstvb%2Fuploads%2F0t0qYQm4l6M0u5GJPwA7%2Fimage.png?alt=media&#x26;token=00e14572-36cb-49a4-aaa9-bbd19c8b8a7b" alt="" width="563"><figcaption></figcaption></figure>

Next, click on `Choose OS` option and scroll through the list of operating systems until you find the "Use Custom" option towards the end of the list.

<figure><img src="https://1642858864-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MW_pkggCd-D5nsvstvb%2Fuploads%2FGgF8BgmUgXbbBfSzwttr%2Fimage.png?alt=media&#x26;token=b4bbeaac-e44c-4aa4-a50e-e83ed459f73a" alt=""><figcaption></figcaption></figure>

Click on the "Use custom" option and choose the \*.img.xz file.

Plug in your SD card in your laptop and select it through the `Choose Storage` option in the Raspberry Pi Imager tool. Make sure to setup some password during installation. Default username is Pi.

Click Next and select `Edit Settings` option.

<figure><img src="https://1642858864-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MW_pkggCd-D5nsvstvb%2Fuploads%2F7QH1k5WfO1akXB5PcHMi%2FScreenshot%202025-03-22%20154158.png?alt=media&#x26;token=080a06cc-b999-45e3-8810-b4fc12f36eda" alt=""><figcaption></figcaption></figure>

Enter customisations as shown in the screenshot below. Turn on your Mobile Hotspot (if available) and enter the name and password of the hotspot in the SSID and password field, respectively. Ensure that the `Wireless LAN country` is set to **IE** and `locale settings` have the correct **Time zone** (Europe/Dublin) and **Keyboard layout** selected. Click `Save` and then `Yes` in the customisation popup.

<figure><img src="https://1642858864-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MW_pkggCd-D5nsvstvb%2Fuploads%2FEoo2BYbCR3Pk0Y68q3At%2FScreenshot%202025-03-22%20123617.png?alt=media&#x26;token=b647b479-7b11-41f7-bba3-b1130f5ac528" alt=""><figcaption></figcaption></figure>

Click next and wait until the tool finishes writing up the OS on the SD card.&#x20;

Eject the SD card from your laptop and insert the card into Raspberry Pi.&#x20;

Ensure that Raspberry Pi OS displays the correct time in the clock once it starts. If it displays incorrect time, use the following command to set correct time.

To ensure that the Raspberry Pi OS displays the correct time, observe the clock when it starts. If the time is incorrect, use the following command to set the correct time:

```bash
sudo date -s "YYYY-MM-DD HH:MM:SS"
```

Replace `"YYYY-MM-DD HH:MM:SS"` with the current date

If Mobile hotspot is not available to you. Follow instructions on [connecting to eduroam page](https://teaching.gitbook.io/ee5127/misc/raspberry-pi) to connect Raspberry Pi to eduroam network.

Raspberry Pi OS comes with Python already installed. You can check the version of Python by running the following command in the Terminal

```python
python --version
```

Next, perform an upgrade operation on the newly installed Raspberry Pi OS by running following commands in the Terminal

```bash
sudo apt update
sudo apt upgrade
```

Install Microsoft Visual Studio Code > <https://code.visualstudio.com/docs/setup/raspberry-pi>

Next, Install the Python Extension on Visual Studio Code (refer to previous tutorial on VSCode)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://teaching.gitbook.io/ee5127/lab/iot-gateway/setting-up-raspberry-pi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
