Raspberry Pi: Getting started with Wi-Fi

Reviewed by Editor: Jack Allison

To have you RPi connected through Wireless LAN (Wi-Fi) you will need an appropriate USB-dongle. I used EdiMax EW-7811Un (ebay). Although it has lower data-rate specification (150 Mb), there are some advantages: – small form-factor (size): good for small products/prototypes – fully supported (in plug-and-play fashion) by Raspbian – widely available at local stores in Israel for affordable price

Step-by-step (first usage)

To make your RPi connected to your home Wi-Fi Router do the following steps: – Plug the Wi-Fi dongle into RPi (powered-on or switched off) – If necessary, power-on your RPi – Use RPi’s WiFiConfig utility (on your desktop) to configure the WLAN settings: network name and password of your home Wi-Fi router. For that do the following 2 steps:

1) scan for available WLAN networks

2) chose your home network and enter the password

Auto-initialization (on power-up) of WiFi-interface.

Among the rest of connectivity benefits, Wi-Fi allows working on the RPi SW while the board is closed in a case. Instead being connected to RPi with a monitor trough HDMI cable, you can see RPi desktop remotely using VNC, TightVNC or Microsoft Remote Desktop utilities. In order to do this, you need the Wi-Fi dongle  initialized and to have valid IP address automatically assigned immediately after the RPi boot. The following steps describe how to achieve this goal: – Once you configured your RPi’s Wi-Fi interface to connect to your network (as described above), the connection details are saved and preserved at /etc/wpa_supplicant/wpa_supplicant.conf – To have the Wi-Fi initialization happen at the RPi’s boot add the following command to etc/rc.local :

sudo ifup wlan0

We are done with Wi-Fi and can start to enjoy our Wireless RPi  🙂

Static IP

It may be necessary to create a static IP address for RPi so that the router, via DHCP, does not assign different IP addresses which can cause problems when accessing RPi from the internet.  To create a static IP address for RPi, two files ned to be edited as follows:

1. /etc/network/interfaces

Add the rows as below replacing with your LAN addresses and netmask

The first parameter after iface command is interface name that you will use later so chose something meaningful

iface weather_station inet static

2. /etc/wpa_supplicant/wpa_supplicant.conf

Add id_str variable that will link your wi-fi dongle to the static IP defined earlier

ssid=”<name of your WLAN>”
psk=”<your WLAN password key>”

Power Management

By default power saving feature may be On for Wi-Fi adapters. So that they go to sleep when aren’t used for a long time. As a result it takes a time (if possible at all) to awake this interface by ping command.

You may check if this feature is enabled by using a command:


If it is enabled and this is annoying and you would like immediate connectivity, you can disable this feature by adding of the  following line to the /etc/network/interfaces file

wireless-power off

After power reset use iwconfig command again to check if the new setting helped

Additional useful commands

allow-hotplug wlan0 eth0

sudo ifdown wlan0

sudo ifup –force wlan0 (note that DOUBLE-minus should appear before the ‘force’ parameter: at some web-browsers this example may show only one minus)

Related References

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s