How to Connect to Raspberry Pi using USB Hot-spot

Akshul Goyal
3 min readFeb 12, 2021

This is first part in a series of posts about my current Raspberry Pi Project

Photo by Vishnu Mohanan on Unsplash

I have tested the following Steps on Ubuntu Mate and Raspberry OS. Though I think it can be applied to other OS as well.

These steps can be used when you do not have any screen for Pi to connect to, and it will provide a simple terminal interface to access it.

First things first, If you do not have an OS installed on a SD card, burn your SD card with your preferable OS. I am using Raspberry OS Lite (Headless). Download the image file, connect your SD card to your PC, and use this command if you are on Ubuntu.
dd if=~/path/to/raspberryos.img of=/dev/sdb status=progress
Check the partition name using either df -h or fdisk -l

If you are using Windows, then follow my tutorial here
OR
Use Raspberry Pi Imager

Setting up SSH server —

  1. After burning is complete, eject the SD card from PC and reconnect it, open BOOT partition.
  2. Open config.txt and add this line at the last — dtoverlay=dwc2
  3. Now open cmdline.txt and check for rootwait
    Add modules-load=dwc2,g_ether after that. Save and exit
  4. Also make a file named ssh
    sudo nano ssh
    save the file and exit
  5. Eject the SD card. And connect it to Pi’s SD card slot.
cmdline.txt

Now that you have done setting up SSH server you can try to connect to your Pi for the first time —

  1. Power on Raspberry Pi.
  2. Connect it to your Android Phone using USB cable.
  3. Go to Settings> Network & Internet > Hotspot Tethering> Turn ON USB Tethering.
    Your Pi is now connected to internet hotspot network.
    https://imgur.com/a/w5tbVYm
  4. To check the IP of this network, I used an App called “Hotspot Manager”, which can be easily available on Play Store.
    After installing the app, The “Clients” tab will show the IP of connected devices.
  5. To connect to my Pi, I used another App called “ConnectBot”. It’s a lite app which can be used to ssh to devices using your Android phone itself.
  6. Open Connectbot. Click on + button. Under username@hostname:port type your Pi’s username and IP address on Hotspot Manager app. Eg. —
    user@192.168.1.2
  7. Click on + button to Add the host. Click on this host to connect to Pi. Type in password when prompt. Default password is raspberry. Now you are connected to Pi.
  8. Type ifconfig, df -h, and similar commands to check it’s working.
Adding a host
Connecting to the host
Typing in password
Connected. Checking terminal commands

--

--

Akshul Goyal

Hacking the Physical World | Senior Embedded Systems Engineer @ PiRhoAlpha Research (ActiveBuildings) | I write posts about AVR and Raspberry Pi.