Abstract: You wish to configure your Raspberry Pi (Wheezy or Jessie) so that it automatically connects to different wireless networks.

If you wish to take your Raspberry Pi to different houses and wish that it connects automatically to the wlan there, you need to configure multiple different WLAN configurations. The Raspberry Pi can then scan the environment and use the WLAN which is fits your configuration. To implement that you need to follow the steps below:

1.) At first you need to connect a WLAN USB stick (if the Raspberry Pi you are using isn´t supporting WLAN). I would prefer to get a EDIMAX EW-7811UN. Once installed, connect a LAN wire to the device and power up your pi.

2.) Login into your raspberry (Default User: pi; Default Password: raspberry) via SSH (see here how to enable SSH) and the IP address you got (if that isn´t possible you can connect the device to a screen and use a USB keyboard)

3.) Check if the USB stick is recognized. This can be done via multiple ways (as outlined below):

# Country code# The ISO/IEC alpha2 country code for the country in which this device is# currently operating.#country=UScountry=DE

# IEEE 802.1X/EAPOL version # wpa_supplicant is implemented based on IEEE Std 802.1X-2004 which defines # EAPOL version 2. However, there are many APs that do not handle the new # version number correctly (they seem to drop the frames completely). In order # to make wpa_supplicant interoperate with these APs, the version number is set # to 1 by default. 0 might be used if the driver should handle this feature. # Note: When using MACsec, eapol_version shall be set to 3, which is # defined in IEEE Std 802.1X-2010. eapol_version=1

# The SSID from the network 1# (either as an ASCII string with double quotation or as hex string; network name)ssid="YourFirstWLAN"

# Enable/Disable the scan for SSIDs# (this can be used to find APs that do not accept broadcast SSID or use multiple SSIDs;# this will add latency to scanning, so enable this only when needed)scan_ssid=1

# WPA preshared key; 256-bit pre-shared key# The key used in WPA-PSK mode can be entered either as 64 hex-digits, i.e.,# 32 bytes or as an ASCII passphrase (in which case, the real PSK will be# generated using the passphrase and SSID). ASCII passphrase must be between# 8 and 63 characters (inclusive)psk="YourFirstWlanKey"

}

# ---------------------------------

network={# Network 2

# The SSID from the network 2# (either as an ASCII string with double quotation or as hex string; network name)ssid="YourSecondWLAN"

# Enable/Disable the scan for SSIDs# (this can be used to find APs that do not accept broadcast SSID or use multiple SSIDs;# this will add latency to scanning, so enable this only when needed)scan_ssid=1

# WPA preshared key; 256-bit pre-shared key# The key used in WPA-PSK mode can be entered either as 64 hex-digits, i.e.,# 32 bytes or as an ASCII passphrase (in which case, the real PSK will be# generated using the passphrase and SSID). ASCII passphrase must be between# 8 and 63 characters (inclusive)psk="YourSecondWlanKey"

}

6.) The next step is optional and would disable the power saving functions (for the EDIMAX EW-7811UN USB WLAN Stick). If you do not disable them it might be that the WLAN connection gets disconnected. To disable the feature create a new config:

sudo nano /etc/modprobe.d/8192cu.conf

with the following content:

options 8192cu rtw_power_mgnt=0 rtw_enusbss=0

7.) Checking the connection could be done via two possible ways:

7a.)

sudo ifup wlan0

7b.)

or reboot the PI via (and disconnect it from the LAN wire):

sudo shutdown -r now

Once it is back online it should be connected to one from the configured WLANs.