2016/08/09

Raspberry Pi - Setting up WiFi using USB WiFi Dongle based on Realtek RTL8188CUS chipset

This is a quick summary of how to set up WiFi using USB WiFi Dongle based on Realtek RTL8188CUS chipset.

1. Make sure the Raspberry Pi is power off.

2. Plug in a USB WiFi Dongle that uses Realtek RTL8188CUS chipset to one of the USB ports of the Raspberry Pi.

3. Power on the Raspberry Pi.

4. Use PuTTY to login to Raspbian.

5. Issue the "sudo lsusb" command to list the USB devices attaching to the Raspberry Pi.




6. Issue the "sudo nano /etc/network/interfaces" command to bring up the interface configuration file for editing.


Note from the configuration above that hotplug is supported. That is, if the USB WiFi Dongle is plugged into the USB port AFTER the Raspberry Pi is powered up, the OS is able to detect and enable support for the USB WiFi Dongle. 

Make sure the instructions in the red box above are exactly the same as the 4 lines of instruction below.

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

Press “CTRL + X” to exit nano (press Y and then press ENTER when prompted) to save and exit.

7. Issue the "sudo iwlist wlan0 scan" command to scan and list available WiFi hotspots. Use the scroll bar on the right to scroll through the list.


8. Issue the "sudo nano /etc/wpa_supplicant/wpa_supplicant.conf" command to edit the "wpa_supplicant.conf" file.

Add the following line to the file.

network={
        ssid="YourSSID"
        psk="password"
        key_mgmt=WPA-PSK
}


Press “CTRL + X” to exit nano (press Y and then press ENTER when prompted) to save and exit.

9. Issue "sudo reboot" to reboot the Raspberry Pi.

Verification

1. Unplug the RJ-45 Ethernet cable (if it's still connecting the Raspberry Pi to the router) from and use Advanced IP Scanner to scan for the IP address of the Raspberry Pi's WiFi port.


In my case, the IP address assigned by the router to the WiFi Dongle plugged into the Raspberry Pi is 192.168.1.24.

2. Use PuTTY to login to the Rspberry Pi via its WiFi port and use the ping command to make sure the Pi is connected to the internet.


Note,

- To store multiple SSIDs and passwords for different networks, simply repeat the network={…} code in the wpa_supplicant.conf file for each network.

- The instruction above is for WiFi network that uses visible SSID, for WiFi network that uses hidden SSID, please refer to this post - http://www.dafinga.net/2013/01/how-to-setup-raspberry-pi-with-hidden.html.

References:

How to set up WiFi on a Raspberry Pi
https://www.maketecheasier.com/setup-wifi-on-raspberry-pi/

Setting up Wifi with the Command Line
https://learn.adafruit.com/adafruits-raspberry-pi-lesson-3-network-setup/setting-up-wifi-with-occidentalis

--------------------------------------------------------------------------------------------------------------------------

Product Offered:

USB WiFi Dongle (based on Realtek RTL8188CUS Chipset) - US$4/ea


Description:

- This is exactly the same dongle that I used for writing this post.
- It works with Raspbian JESSIE out of the box. All you need to do is follow the above instruction to make some changes to the configuration files.

How to purchase:

Leave your message in the comment section below and I will contact you for detail.

No comments:

Post a Comment