Prerequisites: We suppose you have installed Raspbian from NOOBS Lite(which comes with our TF card) and use the USB wifi adapter from Osoyoo.com authorized dealer. We can not guarantee other brand wifi adapter will work with Raspberry Pi 2.
Step 1: We need make a backup file before we change Ethernet adapter to WIFI adapter. To do the back up,
please open shell terminal window and type following command:
sudo cp /etc/network/interfaces /etc/network/interfaces.old
sudo cp /etc/wpa_supplicant/wpa_supplicant.conf /etc/wpa_supplicant/wpa_supplicant.conf.old
Step 2: Type following command
sudo nano /etc/network/interfaces
in the nano edit window, delete all old contents and insert following new content:
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet manual
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp
PRESS CTRL-X and SAVE the file.
Step 3: Type following command
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
in the nano edit window, delete all old contents and insert following new content(replace the YOURSSID with your wifi ssid and YOURWIFIPASSKEY with wifi passcode) :
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid=”YOURSSID“
psk=”YOURWIFIPASSKEY“
# Protocol type can be: RSN (for WP2) and WPA (for WPA1)
proto=WPA
# Key management type can be: WPA-PSK or WPA-EAP (Pre-Shared or Enterprise)
key_mgmt=WPA-PSK
# Pairwise can be CCMP or TKIP (for WPA2 or WPA1)
pairwise=TKIP
#Authorization option should be OPEN for both WPA1/WPA2 (in less commonly used are SHARED and LEAP)
auth_alg=OPEN
}
PRESS CTRL-X and SAVE the file.
Step 4: reboot Raspberry Pi
After the Raspberry Pi restarts, the wifi will work.
If you want to set the network adapter Ethernet again, you can type following commands:
sudo cp /etc/network/interfaces.old /etc/network/interfaces
sudo cp /etc/wpa_supplicant/wpa_supplicant.conf.old nano /etc/wpa_supplicant/wpa_supplicant.conf
then restart the raspberry pi, the old Ethernet will work again.
DownLoad Url osoyoo.com