Friday 20 May 2016

Autoconnect wireless dongle from raspberry pi to wifi

Remove and reinsert the SD card so that your Windows or Mac PC can see the small FAT32 partition on the card (labelled "boot").
If you get a message telling you the card must be formatted, cancel it.
On that small FAT32 partition, create a file with the name ssh (or ssh.txt). It can be empty, the contents don't matter.
To connect to a wireless network, create another file on the card called wpa_supplicant.conf, which has the following inside:
Code: Select all

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
country=US

network={
    ssid="Your network name/SSID"
    psk="Your WPA/WPA2 security key"
    key_mgmt=WPA-PSK
}
Edit country=, ssid= and psk= with your information and save the file.
Use a pure text editor, not a word processor to edit the wpa_supplicant.conf file.
Make sure that both files are in the main directory of the small FAT32 partition, not in any folder.
Safely eject the card from your PC and use it to boot the Pi.
If Raspbian finds an ssh file it will enable SSH and delete the file. If it finds a wpa_supplicant.conf file, it will move it to its correct location and connect to your wireless network. Give your Pi some time to boot and connect to your network (the first boot always takes a bit longer), then you should be able to SSH into the Pi and configure it how you like.

No comments:

Post a Comment