Do you allow this site to use Cookies?

RaspberryConnect Logo

Models of Raspberry Pi

WhatisaRPI sml

What is a Raspberry Pi and what are the different models?

Raspbian Software Packages


Raspian is the official operating system for the Raspberry Pi. There are 1000's of Free programs available for download. This is a list of what is available.



Various Projects and Guides from the Raspberry Pi Community.


I'm using a Raspberry Pi 3 which i want to connect to via SSH from my Android tablet or phone when i am not in range of my home router.

My requirements are for when the pi is at home it connects to my home router or other known routers so it is available on the local network. If no router is found when it is started up then it will create a wifi hotspot, which is not rooted to the Internet, so i can SSH to the RPi from another device and control the camera and run other custom scripts.

Previously i could do this by creating an adhoc hotspot on my Android Nexus tablet and set the Raspberry Pi to connect to the Tablet if the home network was not in range. In google's infinite wisdom they dropped this feature for my Nexus tablet in the Android Marshmallow update, meaning i could no longer connect to my pi when i was out and about.

The other solution is for the RPi to create a wifi hotspot and connect my tablet to that. Most tutorials for hotspot setup on the pi are for creating an access point to the internet via the Raspberry pi which is not what I require.
I use my pi for photography amongst other things when im out and about, so i don't need internet access just a direct connection to control the Raspberry Pi via SSH from my tablet.


Note: This article is now out of date as some of the commands have been depreciated and is now just for reference. Please use the new article for a AutoHotspot. Raspberry PI 3 Auto WiFi Hotspot if no Internet

This tutorial is the solution I used based on parts of other tutorials i have found online.


Raspberry Pi searches for known router's (SSID)

If the router is not found then it creates a hotspot so tablets, phones and computers can connect to the Raspberry Pi's WiFi hotspot, which is not routed to the internet but allows a connection via SSH, VNC etc.


Raspberry Pi 3 or other Raspberry Pi with WiFi dongle*

Internet Connection

WiFi connection set-up to the local router

*some WiFi dongles don't work in adhoc mode or don't work with with the nl80211 driver used in this guide, so you may want to check this first before starting.



To start with hostapd hotspot client and dnsmasq lightweight dns server need to be installed.

Open a Terminal session.

Update Raspbian with the latest updates by entering the commands:

sudo apt-get update

sudo apt-get upgrade

 To install hostapd enter the command:

sudo apt-get install hostapd

enter Y when prompted.

To install dnsmasq enter the command:

sudo apt-get install dnsmasq

enter Y when prompted

The installers will have set up the programme so they run when the pi is started. For this setup they only need to be started if the home router is not found. So automatic startup needs to be disabled. This is done with the following commands:

sudo systemctl disable hostapd

sudo systemctl disable dnsmasq

Now the hostspot configuration file can be setup. This contains the name of the WiFi signal you will need to connect to (SSID) and the security password.

To edit the configuration files I will be using the nano text editor but if you prefer an editor with an point and click interface then replace nano with leafpad in the following instructions.

Hostapd Configuration

Using a text editor edit the hostapd configuration file. This file won't exist at this stage so will be blank.

sudo nano /etc/hostapd/hostapd.conf

enter or paste the settings:


  • The interface will be wlan0
  • The driver nl80211 works with the Raspberry Pi 3 onboard WiFi but you will need to check that your wifi dongle is compatable and can use AP mode.

For more information on wifi dongles see

  • The SSID is the name of the WiFi signal broadcast from the RPi, which you will connect to with your Tablet or phones WiFi settings.
  • Channel can be set between 1 and 13. If you are having trouble connection because of to many wifi signals in your area are using channel 6 then try another channel.
  • Wpa_passphrase is the password you will need to enter when you first connect a device to your Raspberry Pi's hotspot. This should be at least 8 characters and a bit more difficult to guess than my example.

To save the config file press ctrl & o and to exit nano press Ctrl & x

Now the defaults file needs to be updated to point to where the config file is stored.
In terminal enter the command
sudo nano /etc/default/hostapd


And save.

dnsmasq configuration

Next dnsmasq need to be configured to allow the PI to act as a router and issue IP addresses.

sudo nano /etc/dnsmasq.conf

Go to the bottom of the file and add the following lines

#Pi3Hotspot Config
#stop DNSmasq from using resolv.conf
#Interface to use

And then save (ctrl & o) and exit (ctrl & x)


Now that hostapd and dnsmasq are configured we now need to make some changes to the interfaces file and then add a script that will detect if you are at home or not.

Next we need to edit the interfaces file. There will be several entries already in the file. Look for references to Wlan0 and alter them as below.
Any reference to wpa_conf for wlan0 should be disabled by putting a # at the start of the line.

Open the interfaces file with the command

sudo nano /etc/network/interfaces

edit the following lines as below

auto lo wlan0
iface lo inet loopback

allow-hotplug wlan0
iface wlan0 inet manual
# wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

now save (ctrl & o) and exit (ctrl & x)

Note: Due to the constants updates to Linux the Wifi login details have moved, if your home routers SSID and password was listed in this file then the hotspot will probably not get generated.

You will need to put a # infront of each line

#iface wlan0 inet dhcp
#       wpa-ssid "mySSID"
#       wpa-psk "Router Pasword"

These details need to be in the wpa_supplicant.conf file to work with this setup.

Add your router details to the wpa_supplicant.conf file with 

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

and add the following commands to the bottom of the file.

        psk="Router Password"

If in the future you change your router connection details with the WiFi icon by the clock then check that the changes have been made to the wpa_supplicant.conf file and not the interfaces file.

Start-up Script

The final stage is to add the startup script to the rc.local file.
This is an altered version of the "Rpi Network conf Bootstrapper" script by Lasse Christiansen

This script will check what routers are available when the RPi is stared in the order of mySSID1, mySSID2 etc. The first router found in the list will be connected to using existing configured WiFi settings. If none of the listed SSIDs are in range then a WiFi hotspot is created.

sudo nano /etc/rc.local

Your rc.local file will look like this if it has not previously been edited.

# rc.local
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
# In order to enable or disable this script just change the execution
# bits.
# By default this script does nothing.
# Print the IP address
_IP=$(hostname -I) || true
if [ "$_IP" ]; then
printf "My IP address is %s\n" "$_IP"
exit 0

Firstly change the top line from #!/bin/sh to #!/bin/bash

The line "exit 0" need to be at the bottom of the file so add the bootstrapper script between

printf "My IP address is %s\n" "$_IP"


exit 0


#Wifi config - if no prefered Wifi generate a hotspot
# RPi Network Conf Bootstrapper
    echo "Creating RPI Hotspot network"
    ifconfig wlan0 down
    ifconfig wlan0 netmask up
    service dnsmasq start
    service hostapd start
    echo " "
    echo "Hotspot network created"
    echo " "
echo "================================="
echo "RPi Network Conf Bootstrapper"
echo "================================="
echo "Scanning for known WiFi networks"
ssids=( 'mySSID1','mySSID2' )
for ssid in "${ssids[@]}"
    echo " "
    echo "checking if ssid available:" $ssid
   echo " "
    if iwlist wlan0 scan | grep $ssid > /dev/null
        echo "First WiFi in range has SSID:" $ssid
        echo "Starting supplicant for WPA/WPA2"
        wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf > /dev/null 2>&1
        echo "Obtaining IP from DHCP"
        if dhclient -1 wlan0
            echo "Connected to WiFi"
            echo "DHCP server did not respond with an IP lease (DHCPOFFER)"
            wpa_cli terminate
        echo "Not in range, WiFi with SSID:" $ssid
if ! $connected; then

 And finally save (ctrl & o) and exit (ctrl & x)

In the line ssids=( 'mySSID1', 'mySSID2' ) change mySSID1 to the SSID name of your home router,

in the UK common SSIDs are in the format of SKY12345, BTHub-1234, TalkTalk12345, VM123456, plusnet1234 etc

if you connect your Rpi to other routers then these can be added separated by a comma.
Remove mySSID2 if you only want to search for one router as this will speed up the startup process.


You should now be able to reboot and if all has gone ok your Raspberry Pi will start and connect to your router as normal.

 Testing the Hostspot

To test if the hotspot is being created edit the rc.local file again and change your SSID to something else such as mySSID1off

ssids=( 'mySSID1','mySSID2' ) to ssids=( 'mySSID1off','mySSID2off' )

Save the rc.local file and then reboot.

When the desktop loads the WiFi network icon in the top right corner will be two screens instead of the usual WiFi icon.


When the mouse is placed over the icon is should show a popup displaying the RPI3hot access point.



Check the WiFi signals in range with a wifi device and you should see that one of them is RPI3hot



Select this as the WiFi signal to connect to. The security password will be the one you set in the hostapd.conf file.

From my example that would be 1234567890.

Now you are connected to the Raspberry Pi's hotspot and you can now open a SSH connection as usual using the host name. If you are using the IP address then that will be

Once your happy it is all working, reset the SSID entry back to your routers SSID and your ready to go.


This setup has been tested on a Raspbery Pi 2 and PiZero with a WiFi dongle and a Raspberry Pi 3 all running Raspbian Jessie. 


Tutorial used as reference for this guide are:


Keep connected at home and on the move with the Automatic Hotspot scripts

Guides for setting up your Raspberry Pi to your home network when your at home or generate a Automated Hotspot when you are out. For all models of the Raspberry Pi

Auto Hotspot Script Easy Installer

AutoHotspot Net Sml

Setup a Auto Hotspot or Static Hotspot with the easy installer

Auto Hotspot Scripts with Internet

AutoHotspot Net Sml

Auto Hotspot with Internet access for Raspberry Pi's 1, 1B/+, 2, 3, 3B+ & 4

Auto Hotspot Scripts no Network

AutoHotspot Zero Sml

Auto Hotspot with NO Internet access for Raspberry Pi Zero

Static Hotspot Scripts

StaticHotspot Net Sml

Perminant Hotspot with Internet access for all Raspberry Pi's