I just got a Raspberry Pi Zero W, and am planning on sealing it inside a device, with only the USB Power cord coming out of the case. I will control the Pi via Wifi which will then let me control the device. I can set up the Wifi ssid and password ahead of time.

My question is: If the wifi network changes, or I move the device to a new network, is there a good way to regain ssh access?

Right now my plan is to make some network like SSID: 'RaspberryPi', pass: 'random-pass-123', and set that as the highest priority network, and save those credentials. Then I can create an adhoc network with my laptop and have the Pi connect to that, and ssh in.

Any reason this wouldn't work, or any better way of doing this?

  • 1
    You could turn the Pi zero into an ethernet gadget and power the device and connect with only a USB cable connected to the USB port learn.adafruit.com/… Mar 24, 2017 at 3:10
  • If by sealing you mean something that can't be easily opened, don't rely on WiFi. You don't want to be locked out after an upgrade or a configuration error. Steve's right: replace that USB power chord with a USB data cable and load g_ether to have SSH via USB. Mar 24, 2017 at 10:29

1 Answer 1


Here's an interesting "out-of-band" option that might work for you. It requires a bit of extra hardware and software setup, but might allow for a better way to reconfigure the device without cracking it open...

Proposed Solution: Attach an RC522 NFC/RFID Reader to the Pi via the GPIO pins and set up a small daemon app that checks for an RFID tag every so often. When one is found, it's contents are read and, if properly formatted, used to reconfigure the WPA Supplicant on the device with the new WiFi settings.


  • The RC522 reader is small and will likely fit inside the sealed device enclosure you are using.
  • The RFID tags can be custom programmed with whatever text you need. For instance you can program it with a string something like:


  • Your daemon would look for the special "WPACONFIG" string in the text from the tag. If it exists, it would attempt to read the SSID and PSK, then update the wpa_supplicant with the new values and restart the networking service (or just reboot).

  • With a little imagination, this option could be expanded to provide other configuration changes or trigger other types of events on the device.

Whatever you end up doing, I hope you get what you need! Good luck!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.