Connect Your Headless Pi to a Library WiFi Network





Introduction: Connect Your Headless Pi to a Library WiFi Network

How many times have you wanted to work on your headless Raspberry Pi projects at the local library, only to find yourself stuck because the open WiFi network needs you to use a browser? Well fret no more, this Instructable is here to help!

We will assume you followed our Instructable on how to prep your Raspberry Pi for anything.

In this tutorial, we will show you how to:

  • use a serial cable with your Raspberry Pi
  • setup a public WiFi network in the command line
  • use the command line browser w3m to connect to a public WiFi network

Next stop: the things we'll need!

Step 1: The Things We'll Need

For this project, we will need:

  • a Raspberry Pi (any flavor, but the Pi 3 and Zero W have built-in WiFi connectivity)
  • a microSD card
  • a serial cable
  • a micro-USB charger
  • a WiFi dongle (optional, depending on your Raspberry Pi model)
  • an Ethernet cable (optional)

This Instructable assumes you followed our guide on how to prep your Raspberry Pi like a champ. If you haven't, go check it out just in case!

If you've got everything, let's get started!

Step 2: Install the W3m Web Browser

The biggest hurdle of connecting a headless Raspberry Pi to a public WiFi network like our library's is accepting the terms of the landing page from the command line. Let's install w3m, a piece of software that'll let us do just that!

Before you go to the library, connect your Raspberry Pi to the Internet. If you're going to use a network cable, just plugging it in your Raspberry Pi's network port and your router should be enough.

If you're going to connect your Pi to your WiFi network, the Raspberry Pi website has detailed instructions on how to do that.

Connected? Then let's install w3m by typing the following in your terminal:

sudo apt-get install w3m

If your Pi is correctly connected to the Internet, w3m should install pretty quickly. We're almost done! Now pack up everything, and let's go to the library!

Step 3: Scan for Library WiFi Network

Once you are at the library, connect your Raspberry Pi to your computer using your serial cable and log in to it with Putty. Time to scan for WiFi networks with the following command:

sudo iwlist wlan0 scan

You might get a long list - WiFi networks are everywhere! Scroll through until you find the name of your library's WiFi network you're looking for - in our case JoCoLibrary Public Wireless. Note for any upper or lower case characters in the name of the WiFi network you're looking for, it'll be important for later!

Step 4: Add the Library WiFi Network to Your Wireless Preferences

Time to do some editing and set up your Pi to connect automatically to the WiFi network you're looking for. First, open your Pi's text editor by typing the following in your terminal:

sudo nano /etc/wpa-supplicant/wpa-supplicant.conf

At the end of the file, add the following:

ssid="JoCoLibrary Public Wireless"

Of course, replace the SSID name with the name of your library's WiFi network.

Next, time to restart our Pi's wireless adapter!

Step 5: Check for Connection and Reset the WiFi Adapter

Whether you're using a Pi 3's built-in wifi or a USB dongle on a Pi Zero or an older Pi computer, it can help to restart your wireless adapter after setting up.

First type the following in your terminal:

sudo ifconfig

If we've been able to connect to the network, congratulations, you should have an IP address! If you don't, there's still a few things you can do:

  • check the wpa-supplicant.conf file for spelling and settings mistakes;
  • reboot your Raspberry Pi.

After that, everything should work out. We can finally connect to the library portal page in the next step!

Step 6: Connect to the Landing Page

Time to open that landing page and accept its terms of use! In your Pi's terminal, type


w3m should start and load the landing page directly: you can use the arrow keys on your computer to scroll down to the YES - I ACCEPT "button" and hit Enter to "click" it. And you're good to go! Press Q on your keyboard to quit after the page updates, and confirm with Y.

Step 7: Test Your Connection

Now that you accepted the terms of the landing page, you should be connected to the Internet. There's a few easy ways to test that:

  • open other websites through w3m, or
  • try to update your Raspberry Pi with
    sudo apt-get update

If your Pi updates successfully, congrats, you're all done!



  • Epilog Challenge 9

    Epilog Challenge 9
  • Sew Warm Contest 2018

    Sew Warm Contest 2018
  • Paper Contest 2018

    Paper Contest 2018

We have a be nice policy.
Please be positive and constructive.




Hi there! We should absolutely have tried to make this pic bokehlicious on purpose - Thomas says he'll check some Instructables and try to make it happen. Have a good day!