Getting Started with Python for the Internet of Things
上QQ阅读APP看书,第一时间看更新

Getting ready

You will need to obtain a suitable USB Wi-Fi dongle, and, in some cases, you may require a powered USB hub (this will depend on the hardware version of Raspberry Pi you have and the quality of your power supply). General suitability of USB Wi-Fi dongles will vary depending on the chipset that is used inside and the level of Linux support available. You may find that some USB Wi-Fi dongles will work without installing additional drivers (in which case you can jump to configuring it for the wireless network).

A list of supported Wi-Fi adapters is available at http://elinux.org/RPi_USB_Wi-Fi_Adapters.

You will need to ensure that your Wi-Fi adapter is also compatible with your intended network; for example, it supports the same types of signals 802.11bgn and the encryptions WEP, WPA, and WPA2 (although most networks are backward compatible).

You will also need the following details of your network:

  • Service set identifier (SSID): This is the name of your Wi-Fi network and should be visible if you use the following command:
sudo iwlist scan | grep SSID  
  • Encryption type and key: This value will be None, WEP, WPA, or WPA2, and the key will be the code you normally enter when you connect your phone or laptop to the wireless network (sometimes, it is printed on the router).

You will require a working internet connection (that is, wired Ethernet) to download the required drivers. Otherwise, you may be able to locate the required firmware files (they will be the .deb files) and copy them to Raspberry Pi (that is, via a USB flash drive; the drive should be automatically mounted if you are running in desktop mode). Copy the file to a suitable location and install it, using the following command:

sudo apt-get install firmware_file.deb