Headless WiFi configuration brainstorming

In January I was working out of a co-working space with a Pi 2 on a 48-hour hackathon project. There were no RJ45 (LAN) connections available, only WiFi. To top it off, I had forgotten my keyboard at home. Until I managed to borrow a keyboard I was stuck. I couldn’t configure my WiFi dongle to to get SSH access. Once I had WiFi and SSH, I could proceed and everything worked fine.

With the Raspberry Pi 3 out, and the eventual Model A coming with wireless but no RJ45, I thought it would be a good time to toss around ideas for setting up WiFi on a Pi. Starting with the more obvious options:

  • The keyboard/screen approach even if it’s going to be headless later. The official 7" screen is an option to transport a smaller screen. I haven’t yet picked a portable (tenkeyless) keyboard specifically for the Pi.
  • Plugging in an RJ45 cable to SSH in. Bonjour networking works by default on Raspian so raspberrypi.local is available rather than trying to find out the IP. Then configure WiFi.
  • There are serial cables, but I’m leery of installing kernel drivers on my Mac to support them. Maybe they would work from a Linux VM?
  • Maybe a program could run on a Display-o-Tron 3000 to pick WiFi, but entering a password would be a pain without a keyboard. And there is the matter of running that program, and including it on the microSD card or image in the first place.

What would you do?

I’m using a PL2303HX based serial cable. On Yosemite I did use the prolific driver, which the upgrade to El Capitan broke, unsurprisingly.

I’m now using https://www.decisivetactics.com/products/serial/ which is a fantastic solution. It’s not cheap but I use it daily to communicate to a Zero and Flotilla dock so is worth every penny. Compared to using the screen command it’s a significanrly improved experience too.

Either way, serial cables IMO are the way to go as they work on any Pi and with freshly imaged SD.

That said I’m experimenting with an old Airport Express I’ve got lying around to make a portable network that would allow me to ssh into a preconfigured Pi anywhere I go. I think it’s entirely doable and I’m keen to get it going in the next few days so I’ll let you know how I fare with that.

FIY, I got my private network solution courtesy of Airport Express working easily.

All I had to do was add the network login credentials to /etc/wpa_supplicant/wpa_supplicant.conf and tada, wireless ssh on the go. Best of all’ I can just plug the airport into my LAN network when back home/office for maintenance. It really is that simple!

I’m sure you can do the same with similarly featured WAP, not just an Airport… I suspect the process would be similarly straightforward.

Awesome. Thanks for pointing out Serial. I installed the trial and it Just Works™ with the Adafruit’s serial cable. It’s not perfect though:

  • I haven’t figured out how to send files to the Pi with it. Usually I would use scp.
  • When I was done I ran sudo poweroff but I’m not sure if it worked. “reboot: Power down” but the red light remains on.
  • It also blocks use of HATs since it’s using GPIO.

It would be good enough to get WiFi configured for a headless Pi without needing a separate keyboard.

The Airport Express is a good idea too. I’ve used one for travel before but I no longer have one. It does make me wonder about configuring the Pi itself like a router with a network a laptop could join, much like some WiFi-enabled cameras. Again it may be good enough to set things up on a different network that has Internet.

I also wonder what can be done with Bluetooth on the Pi 3 once the drivers are there. Could Serial possibly work with the Pi 3 over Bluetooth?

Nathan.

yes, the need to access the GPIO limits practicality of the serial console some, unless you are willing to perform mods such as http://learn.pimoroni.com/tutorial/hacks/add-a-serial-breakout-to-your-pi (or the abomination I have performed on my Zero).

I am pretty sure I have used Serial to transfer files to a Pi, but admittedly it’s not something I do often and may have resorted to a shortcut (copy to /boot and grab from there). Either way, that’s a feature advertised so it should be possible. Good point about bluetooth, I shall try and report.

another solution worth mentioning, though limited to the Zero and A+ is USB Gadget. I believe this is coming as part of the next Raspbian revision but it’s possible to get going right now (my Zero is hooked up to my AirBook that way as we speak), though it can be painful to set up if you’re not an advanced user currently.

Would the Black HAT provide a nice clean option for using a HAT and the serial cable? Or would HATs and the RX/TX for the serial cable interfere with each other?

I did end up buying the Serial app since my trial expired. It works well enough, though on the Pi 3 I think I needed to enable the serial port before I could use it – will confirm.

On unfortunate thing is needing to power the Pi 2 or Pi 3 from another source:

Pi 2 or later are not suggested for this technique as they draw over 500mA
Connect the Lead | Adafruit's Raspberry Pi Lesson 5. Using a Console Cable | Adafruit Learning System

I had a similar experience recently when trying to setup a Pi Zero. Without a hub to spare I was having to connect a keyboard to do the setup and then switch it with a wifi dongle when done. For some reason I just couldn’t get the wifi to work and with the constant switching of USB devices getting annoying I looked for another solution.

I found PBakery which will let you write a fresh version of Raspbian to a SD card with some options such as wifi preconfigured and some software preinstalled. Not sure how useful it would have been in your situation but it would mean that if you had access to a computer and a spare SD card that you could get up and running and then SSH any needed files etc over.

I only used it for setting up wifi, you can however have it start up servers, install software, and download files if needed all from a Scratchlike interface.

1 Like