I'm adding WiFi because I want to use it for easy programming and for the FPV video link.
It's a good idea to use a very standard WiFi adapter, for example any adapter with a RealTek chipset, like this one:
-
150Mbps 11n Wi-Fi USB Adapter, Nano Size
because that is known to work well.
Just plug it into the Raspberry PI, and then add the name of your WiFi network and the password:
1. Run this command: sudo nano /etc/network/interfaces
2. Edit the file so that it looks like this:
Code:
auto lo
iface lo inet loopback
auto eth0
allow-hotplug eth0
iface eth0 inet manual
auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
3. Save the file by pressing CTRL-O
4. Exit the editor by pressing CTRL-X
5. Run this command: sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
6. Edit the file so that it looks like this:
Code:
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="TheNameOfYourNetwork"
psk="YourPassword"
}
network={
ssid="TheNameOfYourOtherNetworkIfAny"
psk="YourPassword"
}
I'm typically adding both my home WiFi and my mobile phone Wifi HotSpot so that I can access the Raspberry wherever I might be.
7. Save the file by pressing CTRL-O
8. Exit the editor by pressing CTRL-X
9. Restart with command: sudo shutdown -r now
When the Raspberry has restarted, you can see if the WiFi connection was successful by running this command:
- ifconfig wlan0
This command should output something like this
Code:
pi@raspberrypi ~ $ ifconfig wlan0
wlan0 Link encap:Ethernet HWaddr 00:0f:13:05:12:4e
inet addr:192.168.0.107 Bcast:192.168.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:142807 errors:0 dropped:21 overruns:0 frame:0
TX packets:21617 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:34717556 (33.1 MiB) TX bytes:3289493 (3.1 MiB)
If you get an IP ("inet addr") here, then the WiFi has connected successfully. You can try the connection with a simple ping command:
- ping 8.8.8.8
(CTRL-C to exit)
Should output this if successful:
Code:
pi@raspberrypi ~ $ ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_req=2 ttl=56 time=30.8 ms
64 bytes from 8.8.8.8: icmp_req=3 ttl=56 time=32.3 ms
64 bytes from 8.8.8.8: icmp_req=4 ttl=56 time=23.2 ms
^C
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 3 received, 25% packet loss, time 3005ms
rtt min/avg/max/mdev = 23.209/28.797/32.357/4.000 ms
pi@raspberrypi ~ $
After I have set up the WiFi, I disconnect the monitor, keyboard and mouse, because I can now logon to the Raspberry Pi from my laptop by using SSH to the IP listed in the ifconfig output. I'm using the program Putty for the connection:
-
http://www.chiark.greenend.org.uk/~s.../download.html
but any SSH-client can be used to connect to the device.