-
Notifications
You must be signed in to change notification settings - Fork 902
Wifi Preconfiguration
Preconfiguring wifi is useful for loading wifi credentials into a device that does not have an Ethernet port, like the Raspberry Pi Zero or Raspberry Pi Zero W.
Wifi can only be preconfigured before the first time device boots i.e. /boot/wpa_supplicant.conf
is only read once the first time device boots up. If you have booted the device with no wpa_supplicant.conf
file or invalid wpa_supplicant.conf
file, then you'll need to either reflash the SD card or overwrite the /data/etc/wpa_supplicant.conf
file.
Note: Starting from version 20190119, Wifi configuration will be read every time the device boots up i.e. existing Wifi configuration will be overwritten if /boot/wpa_supplicant.conf
exists. This means there is no need to reflash the SD card if you did not get the /boot/wpa_supplicant.conf
correct the first time.
Things you will need first:
- Win32DiskImager
- The latest motioneyeos image
- Notepad++
- Download the latest motioneyeos image.
- Extract the image to your hard drive (using Winzip, 7Zip, etc.)
- Write the image to your microSD card using Win32DiskImager.
- DO NOT EJECT THE SD CARD yet.
- Open Windows Explorer and browse to your drive containing the microSD card. You should see files such as:
- bootcode.bin
- loader.bin
- start.elf
- kernel.img
- cmdline.txt
- Right-click in the right window pane and select
New Text Document
. - Now, right click on this file and rename it
wpa_supplicant.conf
. Make sure to remove the.txt
file extension. - Once again, right click on this file and select
Edit with Notepad++
. - Make sure you set the EOL conversion to UNIX LineFeeds (Edit-->EOL Conversion-->Unix LF).
- Paste the following contents into your blank file (obviously changing the ssid and psk to match yours):
country=US
update_config=1
ctrl_interface=/var/run/wpa_supplicant
network={
scan_ssid=1
ssid="MyWiFiSSID"
psk="S3cr3tp@$$w0rc|"
}
- Change the country code to the country in which this device is currently operating. You can get the list of country codes here.
- Save the file.
- Eject your microSD card safely.
- Insert this microSD card into your device, e.g. Pi Zero W.
- Optionally, attach a camera to your device.
- Apply power to your device.
- If you have a monitor attached to the device, you should see the wireless network service starting, wpa_supplicant being read and 'brcmfmac Done'.
- Shortly, you should see your IP address being displayed along with your gateway and DNS servers.
- Using your favorite browser, browse to the IP address that was displayed and log in to the device using the default motioneyeos credentials of: admin / [blank password]
- You can shut down the motioneye os remotely by select the advanced settings-->shutdown
Note: If you do not have a display attached to your zero, you can use nmap to scan your home network for any new devices / ip's. Look for one labeled "(Raspberry Pi Foundation)"
- Mount microSD card.
- Copy the
wpa_supplicant.conf
file to the/boot
partition. - Unmount.