Raspbian WiFi Configuration

The main Raspberry Pi website has a good section on how to configure WiFi networking

 

Raspberry Pi WiFi Networking Section

 

We'll step through this here as an example using Raspbian Wheezy, this process is the same on Jessie.

WiFi can be obtained by either the SparkLAN WPER-172GN/WPEQ-160ACN mPCIe cards or various USB dongles available.

Log into the unit via the console or as in the example below via the wired LAN connection and check that the wifi dongle has been detected :

MyPi Industrial Raspberry Pi WiFI Configuration Step 1

Notice that the WiFi has not yet been configured so the device wlan0 has no IP information

We can now do a scan to see which WiFi services are available

root@raspberrypi:~# iwlist wlan0 scan
wlan0     Scan completed :

          Cell 05 - Address: B0:48:7A:EB:5A:4C
                    Channel:6
                    Frequency:2.437 GHz (Channel 6)
                    Quality=70/70  Signal level=-33 dBm
                    Encryption key:on
                    ESSID:"testwifi"
                    Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                              9 Mb/s; 12 Mb/s; 18 Mb/s
                    Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
                    Mode:Master
                    Extra:tsf=00000008b028ce28
                    Extra: Last beacon: 10ms ago
                    IE: Unknown: 000664642D777274
                    IE: Unknown: 010882848B960C121824
                    IE: Unknown: 030106
                    IE: Unknown: 2A0104
                    IE: Unknown: 32043048606C
                    IE: IEEE 802.11i/WPA2 Version 1
                        Group Cipher : CCMP
                        Pairwise Ciphers (1) : CCMP
                        Authentication Suites (1) : PSK
                    IE: Unknown: 2D1A4E101BFFFF000000000000000000000100000000000000000000
                    IE: Unknown: 3D1606050600000000000000000000000000000000000000
                    IE: Unknown: DD180050F2020101000003A4000027A4000042435E0062322F00

                   

The above shows the target channel testwifi has been detected AOK so we can now proceed to the configuration section

The file below has all the configuration information we need to alter : 

/etc/wpa_supplicant/wpa_supplicant.conf

MyPi Industrial Raspberry Pi WiFI Configuration Step 2

Alter the two lines highlighted above with the ESSID name (testwifi) and the password for the network

Once saved it's not uncommon to have to restart the interface and allow about 5-10 seconds for the DHCP process to complete

MyPi Industrial Raspberry Pi WiFI Configuration Step 3

More detailed configuration for the WiFi networking setup, including DHCP/static IP information, is contained in the file below :

/etc/network/interfaces

MyPi Industrial Raspberry Pi WiFI Configuration Step 4

 

Note that you should not need to edit this unless you need a custom configuration

If you run into problems with starting the wlan0 interface like the below :

root@raspberrypi:~# ifdown wlan0
root@raspberrypi:~# ifup wlan0
wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory
wpa_supplicant: /sbin/wpa_cli daemon failed to start
run-parts: /etc/network/if-up.d/wpasupplicant exited with return code 1

This can usually be resolved by running wpa_passphrase to generate alternate configuration information for use in /etc/wpa_supplicant/wpa_supplicant.conf

root@raspberrypi:~# wpa_passphrase testwifi wifipassword
network={
        ssid="testwifi"
        #psk="password"
        psk=c59eb9956f67f1adfddddddd3dd330f0384c5a5d391cecb1abcb1271c8f095c3
}

In the above example testwifi is the SSID and wifipassword is the password.

Alter the wpa_supplicant config file with this information for the network section and then reboot.

If you are using a mPCIe WiFi card you can disable/enable the card using

# echo 1 >/dev/pcie-disable

# echo 0 >/dev/pcie-disable

 

 

 

Contact us now to discuss your project

Ready to order, contact us today for pricing or samples

Contact Us