How to connect directly to a Raspberry Pi without Internet
The versatility of Raspberry Pi means that at some point you can use it outdoors or out of wireless network connectivity. So how can you use it without plugging in the keyboard and screen?
There will be external power requirements to do this (unless you use a dedicated and portable Pi touch screen).
A better solution is to connect via another device, such as a notebook. Although direct connection via Wi-Fi is not currently supported by Raspberry Pi, you still have two options for SSH connection directly without a wireless network.
How to connect directly to a Raspberry Pi without Internet
- When you can use wireless connection
- Connect to your Raspberry Pi via Ethernet
- Say Bonjour!
- Connect your PC to the Raspberry Pi Zero via USB
- Two reliable direct connections
When you can use wireless connection
Wireless connection with Raspberry Pi, whether connected via Ethernet to the router or not, is definitely more convenient. It is almost certainly the preferred choice, whether you're at home, at school or at an event.
However, this is not always ideal for every situation.
For example, if you are using your Pi with the camera module, you may want to take it out to take some photos. If you don't have a wireless network to connect to your Pi via SSH, you'll need a different solution, one that will work via PC or possibly a mobile device.
This is the time for direct connection. You have two reliable options here: Ethernet and USB.
Connect to your Raspberry Pi via Ethernet
The most obvious option for such a connection is through an Ethernet cable. All Raspberry Pi computers have Ethernet ports, making this option work best.
To do this, you will need:
- Raspberry Pi (Type B, B +, 2, or 3).
- New Raspbian installation (for best results).
- Micro USB cable and power supply.
- Micro SD card.
- Ethernet cable, with RJ45 connector at each end.
Standard Ethernet cables are the best in this case, because Raspberry Pi can reconfigure ports. Previously, a cable would be used to connect two computers, but that's not necessary here.
You will need to set up Pi to accept the SSH connection. This feature is not enabled by default, but there are two ways to activate it.
- Boot with keyboard and screen to activate SSH via raspi-config.
- Insert the SD card into your computer, browse to / boot and create an empty file called ssh. (This file is detected by the Raspbian operating system at startup, and is considered a guide to enabling SSH.)
Everything you need to connect to Pi via SSH is now available. All you need is the device's IP address. You can find this by connecting to your router (usually 192.168.0.1, but you will need to recheck the router to find the correct IP) or by starting Pi with the keyboard and screen, then enter:
ifconfig
You will need to check if Pi starts correctly and SSH is working properly, before continuing.
When you have checked the Pi boot and wireless operation via the router nothing is wrong, turn off the device.
sudo shutdown
Now, connect your Raspberry Pi to your PC with an Ethernet cable.
Say Bonjour!
To do this, you will need a specific software: Bonjour Zeroconf. This Apple software is a device that identifies network devices and is preinstalled in MacOS. Windows users can install Bonjour Print Services v2.0.2 from the Apple website.
With this setting and connecting the cable directly to the Pi has been set up, once this small computer is powered on and started completely, you will be able to connect to it.
However, you should be patient. First, Pi fetches the IP address from the DHCP server. If it fails, the IP address will default to 169.254.xx You may also find it helpful to switch your PC or laptop to Airplane mode, to make sure there is no confusion. Other devices on the network. When IP is assigned, Bonjour will set the domain address .local .
After a short time, just open your SSH tool and connect to raspberrypi.local (or pi@raspberrypi.local), with the default password "raspberry".
Windows users may need to force the operating system to give up the IP address assigned to the router. This is quite easy, by opening the Command Prompt and typing:
ipconfig / renew
This will select a random private IP within 169.254.xx
Connect your PC to the Raspberry Pi Zero via USB
If you have a Raspberry Pi Zero, you can also connect it directly to the USB port of a PC or laptop, although this also requires Bonjour on Windows and Mac or avahi-daemon on Linux (avahi-daemon preinstalled with Ubuntu).
Start with a new copy of Raspbian Jessie or Raspbian Jessie Lite on your SD card. Before inserting it into your Pi Zero, use the file explorer to find the boot partition and find the file config.txt. Open in text editor (such as Notepad on Windows) and scroll down to the bottom. At the end, add:
dtoverlay = dwc2
Once you've done this, save and close the file, then find and open the cmdline.txt file . Find 'rootwait' and insert it immediately:
load-modules = dwc2, g_ether
Make sure they are on the same line and separated by spaces, as shown below:
Save and close, then push the microSD card out. You can then insert it into the Raspberry Pi Zero and connect it to your PC before starting the device. Connection must be via USB port.
Use the raspberrypi.local as the address in your SSH software (again, you can also try pi@raspberrypi.local if using the Linux command line). Note that you may need to turn off the wireless network if you have any other Raspberry Pi on your home network. This will ensure you connect Pi Zero via USB port.
If you encounter any problems, try switching your USB cable.
Two reliable direct connections
It would be great to be able to connect via Bluetooth or wirelessly connect from a mobile device - perhaps Android or iOS - and while this is theoretically possible, it is currently not supported. Although there are some accounts that work with either of these methods, it is not really reliable.
If you have any questions, please let us know in the comment section below!
Good luck!
See more:
- How to connect Raspberry Pi remotely to a Windows computer
- 5 great apps that make your Raspberry Pi really useful
- 20 great applications from micro-Raspberry Pi computers
You should read it
- How to connect the Raspberry Pi Zero to a TV without HDMI
- Fix Raspberry Pi not connecting to WiFi / Ethernet
- How to connect Raspberry Pi remotely to a Windows computer
- How to add an ADC to Raspberry Pi: What you need to know
- Raspberry Pi Zero vs Model A and B, how are they different?
- What is the Raspberry Pi and how is the Raspberry Pi used?
- How to start Raspberry Pi 3 from USB
- Why should people try Raspberry Pi 4?
- Learn Pi Imager, How to Use Raspberry Pi Imager
- How to use Raspberry Pi Imager to install Raspberry Pi OS
- 5 ways to make good use of Raspberry Pi 4
- How to set up Spotify Connect on Raspberry Pi
Maybe you are interested
How to use Raspberry Pi 400 as a laptop
Raspberry Pi Pico 2 W Launched: Wireless-Enabled Microcontroller Board for Just $7
How to build Android TV Box with Raspberry Pi 4
Raspberry Pi Touch Display Releases New Version After 9 Years
6 ideas to utilize old Raspberry Pi
Raspberry Pi AI Kit: Bring AI to Raspberry Pi