Page 253 - Hacking Roomba
P. 253

234       Part III — More Complex Interfacing




                             on the network seamlessly. In Wi-Fi there are analogous events of connecting and disconnect-
                             ing from an access point, but there are two complications:

                                 A Wi-Fi device can get turned off without properly disconnecting.
                                 A Wi-Fi device can roam to a new access point.

                             Both situations happen regularly. The former is dealt with by regular keep-alive signals. These
                             signals approximate the electrical cable detection of Ethernet. The access points deal with the
                             latter transparently. When a Wi-Fi node detects an access point on the same network but with
                             a stronger signal, it sends a request to that access point to switch to it, and the access points
                             communicate so that the old one gives up ownership and the new one takes it over. This
                             takes a little time so if you’re unlucky enough to be in a situation where your computer thinks
                             two access points are about the same strength, you may bounce back and forth between them.

                             Power Consumption Concerns

                             Wi-Fi is inherently more power hungry than Ethernet. This is mostly due to the radio trans-
                             ceiver that must be powered all the time. Bluetooth is a great improvement in terms of power
                             consumption, because the protocol allows devices to power down their radios for small amounts
                             of time. Wi-Fi devices must be on all the time or they’ll be disconnected from their access
                             point. The 802.11 standard does define an optional power save mode which allows the device
                             to periodically power down and the access point will buffer data until it wakes. Getting into
                             and out of this mode requires extra logic on the parts of both the device and the access point.
                             Most devices support power management, but most don’t enable it because it drastically affects
                             real-time behavior. When in power save mode, the device wakes up only once every 100 ms or
                             so. For web browsing, 100 ms isn’t noticeable, but for embedded device control it can make the
                             difference between a robot falling down the stairs or not. Even if the Wi-Fi radio could micro-
                             sleep the way the Bluetooth radio can, the Wi-Fi data protocol and TCP/IP require a certain
                             level of computational complexity that prevents truly tiny low-power devices. As embedded
                             systems get more powerful, this issue will be addressed, but for now it means Wi-Fi embed-
                             ded systems draw about two to three times more power than equivalent Ethernet systems.

                             Debugging Wi-Fi networks
                             Debugging network problems on a wireless network is almost entirely the same as debugging a
                             wired network, as discussed in Chapter 11, in the sidebar “Debugging Network Devices.” The
                             same tools (ping, arp, nmap, traceroute) can be used. You should have additional tools and
                             techniques at your disposal, too, such as a stumbler, described below, and a wireless access point
                             or router you can control. If you don’t have a wireless access point of your own yet, Chapters 14
                             and 15 describe two different inexpensive ones you can use and then later reconfigure for use
                             with Roomba.
   248   249   250   251   252   253   254   255   256   257   258