How to Connect to Raspberry Pi using USB Hot-spot
--
This is first part in a series of posts about my current Raspberry Pi Project
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 —
- After burning is complete, eject the SD card from PC and reconnect it, open BOOT partition.
- Open
config.txt
and add this line at the last —dtoverlay=dwc2
- Now open
cmdline.txt
and check forrootwait
Addmodules-load=dwc2,g_ether
after that. Save and exit - Also make a file named
ssh
sudo nano ssh
save the file and exit - Eject the SD card. And connect it to Pi’s SD card slot.
Now that you have done setting up SSH server you can try to connect to your Pi for the first time —
- Power on Raspberry Pi.
- Connect it to your Android Phone using USB cable.
- 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 - 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. - 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.
- 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 - 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. - Type
ifconfig
,df -h
, and similar commands to check it’s working.