I'm streaming

Raspberry Pi: Multiple wpa_supplicant networks

Imagine building a raspberry pi project at home that is dependent on wifi. Everything is working perfectly until you move that project somewhere outside your home network. You have to go find a monitor and keyboard to set it up on the new wifi. This process is difficult, time consuming, and stressful. I have had the pleasure to endure this multiple times throughout my projects. Especially when there is pressure to have it done for a public event. I was curious if there was a way to get the networks to be plug and play, where there would not be an issue when moving it from one place to another. Doing a bit of research I have found that you can setup multiple wireless networks on the raspberry pi. There are two pieces in which were new to me for the wpa_supplicant file:

  •  id_str This will be the name we will save for later to reference this network .
  • Priority The lower the number, the higher the priority is for that network if it finds two from the list

In the example below, I have my home network as the first one it will connect to if it finds it. If I plug it in at Spruce it should be already ready to go. If the two of those can not be found I have a backup hotspot on my phone to make the magic happen. Below is an example of the wpa_supplicant file.


ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

    ssid="Hemstreet Home Network"

    psk="beards are good and stuff"

    ssid="Cell Hotspot"

In the example below you can notice that the 2nd column is the corresponding id_str we had set earlier in our wpa_supplicant file.


iface home inet dhcp
iface spruce inet dhcp
iface cell inet dhcp

An inventive, entrepreneurial and positively unsatisfied mind that constantly pushes the tech boundaries to create new solutions and devices that change people’s lives.

  1. Reply saki June 9, 2016 at 11:48 pm

    this is really too useful and have more ideas from yours. keep sharing many techniques. eagerly waiting for your new blog and useful information. keep doing more.

    • Reply Jon Hemstreet June 10, 2016 at 7:47 am

      Glad you found it useful!

  2. Reply Gissa August 30, 2016 at 5:03 am

    The information you provided about Raspberry pi for enabling to know with the multiple networks. I am expecting more concepts like this. And i have one idea to implement with the camera recording project. Is it easiest for using raspberry pi or something else??

    • Reply Jon Hemstreet September 16, 2016 at 8:40 pm

      A raspberry pi may be the way to go if cost / form factor is not a concern. Personally I have not messed too much with a camera on the raspberry pi. The fact that it is a computer w/ an OS makes it that much easier to program.

  3. Reply nanoo August 29, 2017 at 6:50 pm

    Hi, after reading this amazing post i am too glad to share my familiarity here with colleagues.

  4. Reply rupiya November 7, 2017 at 12:20 am

    Nice to see your blog post.. I really enjoyed by reading your blog post. Thanks a lot for sharing this with us..Android Project Center in Chennai | Android Project Center in Velachery

  5. Reply darthiraj November 7, 2017 at 5:17 am

    Thanks a lot for sharing this with us.. Keep on sharing like this informative post.

    Mat Lab Project Center in Chennai | IEEE Mat Lab Projects in Velacheryk

Leave a Reply