RASPBERRY PI SETUP

INTRODUCTION

Setting up a Raspberry Pi 4 with Ubuntu Server 22.04.5 LTS is an essential first step for many robotics, IoT, or server-based projects. This guide provides a detailed walkthrough to help you successfully install and configure Ubuntu Server on your Raspberry Pi using a microSD card. It covers everything from flashing the OS image onto the SD card and pre-configuring Wi-Fi and SSH access, to identifying the device on your network and performing a system update after your first login.

Whether you're preparing the Pi for ROS 2, custom scripts, or headless operation, this guide ensures you get up and running smoothly—with no need for a monitor or keyboard. It also includes various methods to find your Raspberry Pi’s IP address and access it remotely, including SSH via terminal, Angry IP Scanner, and PuTTY.

Let’s get started with turning your Raspberry Pi into a powerful and flexible development platform.

Step 1: Flash Ubuntu Server 22.04.5 LTS to the microSD Card


  1. Download Raspberry Pi Imager from Raspberry Pi OS – Raspberry Pi

  2. Insert your microSD card via USB card reader in your PC.

  3. In Raspberry Pi Imager:

  • Choose the Raspberry Pi Device: Raspberry Pi 4

  • Choose OS: Other general-purpose OS → Ubuntu → Ubuntu Server 22.04.5 LTS (64-bit)

  • Choose storage: Your microSD card

The above steps are as shown below: 

The following pop up will appear: If not click (CTRL+SHIFT+X):

  • Click on Edit Settings

The following will appear:

  • On General:

Check Set hostname and type your hostname as desired.

Check Set username and password

  • Enter:

    • Username: your username

    • Password: your password

Check Configure wireless LAN

  • Enter:

    • SSID: your Wi-Fi name

    • Password: your Wi-Fi password

    • Wireless LAN country: KE for Kenya

Then Click Save

It is recommended to use your mobile hotspot throughout the whole process, input its details as shown above.

  • On Services:

Check Enable SSH

Choose Use password authentication

Then Click Save

The above process is as shown below:


Don’t edit the options section.

  • After the above steps the following will pop up:



Click on yes, it will begin to write then verify as shown below.


This writes Ubuntu Server to your SD card with Wi-Fi pre-configured.

Step 2: Boot and Connect

  1. Insert the microSD into the Pi and power it up.

  2. Wait about 1–2 minutes for it to boot and connect to Wi-Fi.

Step 3: Find Your Pi’s IP Address

Your Laptop should be connected to the same Wi-Fi or Mobile Hotspot you used to set up Raspberry Pi in Step 1 above.

Option A: Try this in Windows Terminal:

ssh username@username.local

  • Keep trying until you find the Pi's IP Address

Option B: Using Linux Terminal and Windows PowerShell Tools

  1. Determine your IP Range

On your laptop, open Windows PowerShell and run:

ipconfig

You’ll see something like this:

Look under Wireless LAN adapter Wi-Fi:

  • Note your IPv4 Address (e.g., 192.168.152.72)

  • Note the Default Gateway (e.g., 192.168.152.89)
    This tells you the subnet range is likely 192.168.152.0/24

  1. Scan for the Raspberry Pi IP.

  • In your Linux terminal, install Nmap if it’s not already installed.

    • sudo apt update sudo apt install nmap
  • Scan the network for active devices. Run:

    • nmap -sn 192.168.152.0/24 #Modify the subnet range to match your subnet range
    • This scans the entire subnet for live devices. Look for unfamiliar IPs (you’ll likely see only 2, one for your laptop the other for the Raspberry Pi since it’s a mobile hotspot).

    • You might see something like this:


  1. Try SSH-ing Into Detected IPs

    • Attempt to SSH into each IP you found.

    • ssh username@<IP-Address> #Replace with your username and the respective IP address
  • If connection is refused, try the next IP.

  • If it’s the correct one, you'll see a prompt like:

  • The authenticity of host '<IP>' can't be established. ECDSA key fingerprint is ... Are you sure you want to continue connecting (yes/no/[fingerprint])?

  • Type Yes to continue

  • Then enter the password you had set on the very first step.

Option C:Using Angry IP scanner and PuTTY

  1. To get the IP address of the Raspberry Pi 4 download Angry IP scanner application from Angry IP Scanner - Download for Windows, Mac or Linux then choose your respective operating system.


  1. Download the PuTTY application to enable you access the Raspberry pi 4 from Download PuTTY - a free SSH and telnet client for Windows.


  1. Open the Angry IP scanner application.



For it to be simpler for you to see the raspberry pi add the MAC vendor to the left:

You will access fetchers by pressing the button next to start on the right.
  1. Click on the start button to run the application. After 100% scanning Click the ping section and sort by ping.


From the MAC vendor section you will see the Raspberry mentioned. That will be the IP address of the raspberry pi 4.

  1. Open the PuTTY application and key in the IP address:


Open then enter the username that you will log in as.

  1. Input your password that you had input when installing the software in the micro SD card.

Congratulations! You’re now connected to the Pi.

Step 4: Update the System

Once connected via SSH, run the following in the Command Prompt
sudo apt update
sudo apt upgrade

Type y when prompted.

You’ll see a Window like this when the installation is done: 



  • Reboot your pi’s system by unplugging the power cable and plugging it back in. Wait for 1 to 2 minutes for the system to boot.

  • ssh into it again using:

    • ssh username@<IP-Address> #Replace with your username and the respective IP address

You’ll see something similar to this:


You’re Done!partying face

Now your Raspberry Pi is ready for:

  • Installing ROS 2 or other packages

 

To shutdown the Raspberry Pi run the following command on the terminal:

sudo shutdown -h

Always shutdown the OS before powering it off.

References

Install Ubuntu Server 22.04 on Raspberry Pi

Raspberry Pi 4 Setup

 




Comments

Popular posts from this blog

Getting Started with ROS2 Humble: Workspace, Packages, and Nodes

Introduction to ROS 2: The Future of Robotics Software

CREATING A PUBLISHER AND SUBSCRIBER NODES USING PYTHON