Wireless Communications in Modern Mobile Technologies
You may want to create applications for a specific device. Before you break out your IDE and start tinkering with hardware, let’s take a quick tour of Bluetooth, Wi-Fi, NFC and mobile data to learn how these technologies work, and which applications each one is best suited for.
Join the DZone community and get the full member experience.
Join For FreeToday, technology users and consumers are interacting with more devices than ever. Using a smartphone, you can sync a smartwatch, make point-of-sale purchases, control your home's alarm system, or even fly a drone. Depending on the application, you could be using Bluetooth, Wi-Fi, NFC, or mobile data networks to connect to these devices.
As a developer, you may want to create applications for a specific device, or perhaps even develop your own connected device that can be controlled with a smartphone. Before you break out your IDE and start tinkering with hardware, let’s take a quick tour of Bluetooth, Wi-Fi, NFC and mobile data to learn how these technologies work, and which applications each one is best suited for.
NFC
Near Field Communication (NFC) describes a set of protocols that enable two devices in close proximity (up to 10 cm apart)to communicate with each other. Like many other proximity card technologies, it employs electromagnetic induction when two devices exchange information in the 13.56MHz range. One device can be an unpowered NFC tag in a label or poster, which means that the reader would simultaneously initiate data reads and provide power to the tag. Data rates typically range between 106-424 kbit/s. NFC supports three different modes:
- Card Emulation allows a device to act like a smart card. (This is, in fact, the mechanism used for Apple Pay andAndroid Pay.)
- Reader/Writer Mode enables a device to read and write data to NFC tags.
- Peer-to-Peer Mode facilitates information exchange between devices in ad-hoc fashion.
NFC has a wide range of applications, but of late, mobile payment solutions have been the main drivers for adoption on Android and iOS devices. Generally speaking, NFC is best suited for applications that require very close proximity between a phone and tag or device and secure data exchange.
At present, only a limited set of devices support NFC.Compatible iOS devices are iPhone 6/6S/6+/6S+ and AppleWatch models. Apple has not yet opened development access to these sensors via API, so they can only be used for Apple Pay. Android, on the other hand, does offer a development API, but, again, not many Android phones on the market include NFC support, especially not at lower price points.
Bluetooth
Bluetooth was conceived as a protocol for exchanging data over short distances. It uses the same frequency range as 2.4 GHz Wi-Fi but with 79 channels (for versions below4.0), and 40 channels for 4.0 and above. However, unlike most Wi-Fi implementations, it uses a technology called frequency-hopping spread spectrum which regularly changes the channel in order to avoid congestion caused by competing networks. Data throughput rates are also a lot higher, ranging from 1 Mbit/s for Bluetooth 1.2 to 24 Mbit/s for 4.0 and above. All iOS and most Android devices supportBluetooth. Some applications of standard Bluetooth include wireless headsets and data tethering.
Bluetooth LE
Bluetooth LE (Low Energy) is a subset of the Bluetooth 4.0 specification designed for low energy applications. It has a maximum data throughput rate of 0.27 Mbit/s and a power consumption that can be as low as 0.01 W, up to a maximum of 0.5 W (about half of what a standard Bluetooth device consumes.) To put this in perspective: Most smartphone batteries have capacities that range from 1400-3000 mAh (milliampere hours) but struggle to get more than a day or two of battery life, yet it is not uncommon for a Bluetooth LE-based fitness tracking device with a 100mAh battery to last up to a week or longer. Applications that use Bluetooth LE include fitness trackers, smartwatches, and many medical devices.
The LE stack also has a number of predefined generic attribute (GATT) profiles that specify communication mechanisms for various types of devices such as heart rate monitors, blood pressure gauges, or proximity sensors. This means that if a company implements a device to follow the specification, it wouldn’t require proprietary software to retrieve data from it.
While not quite as ubiquitous as standard Bluetooth support, device support for Bluetooth LE is, nonetheless, very good. All iPhone models upward of 4S support it,along with iPad 3rd generation or newer. On the Android side, things are a bit more complicated, since the support implementation that first appeared in Android 4.3 was somewhat buggy and limited to central mode (meaning that interaction is restricted to other peripheral Bluetooth LE devices) but the phone cannot act like a peripheral. Android4.4 provided more stable functionality, and Android 5.0 added support for peripheral advertising. By default, any device that supports Bluetooth 4.0 also supports Bluetooth LE, including older flagship phones such as the Galaxy Nexus and other more recent releases in the Nexus range, as well as tablets like the Nexus 7 2013 and newer models. These days, even inexpensive Android phones such as the LG Lucky, which retails for approximate $10, also offers Bluetooth 4.0 support.
Wi-Fi and Cellular Technology
Most people have used, and are familiar, with these technologies. Cellular networks use radio signals served by fixed-location transceivers (cell base towers) to transmit voice and data and connect mobile devices to the publicInternet at speeds that range from the slow 2G to lightning-fast LTE. A cellular connection is, generally speaking, more expensive from a cost per Mb perspective, but is more readily available when you’re on the move. All Android and iOS phones and select models of iPad and Android tablets support some form of cellular network connectivity.
Wi-Fi is defined as a wireless local area network connection,which may, or may not, connect to resources like the Internet. These networks usually offer faster transmission than cellular connections and are much less expensive per Mb, or even Free. Virtually all iOS and Android devices support Wi-Fi.
For applications that consume lots of data or need to communicate with devices local to a network, Wi-Fi is the recommended solution. As such, it is the typical mechanism used for home automation and video casting.
So, What Should I Use?
NFC has compelling use cases, but unless you’re creating an application that needs to scan NFC tags, or allows you to control the hardware and have rigorous security requirements, you may not want to use it in your project. It is obviously the perfect technology for mobile payment applications, but until Apple opens their APIs to application developers, you’ll only reach a limited audience.
Bluetooth is a great solution when you need to communicate with a device in close proximity to a phone. A smart device, such as a printer, might use Bluetooth to configure its Wi-Fi settings in order to connect to a network or wireless headphones. When you have a small device with a limited battery capacity that doesn’t need to transfer lots of data, such as a wearable fitness monitor or smartwatch, Bluetooth LE would be ideal.
For applications that consume lots of data or need to communicate with devices local to a network, Wi-Fi is the recommended solution. As such, it is the typical mechanism used for home automation and video casting. Some applications may be configured to only download data when connected to a Wi-Fi network, but when an application doesn’t consume a lot of data or, alternatively, needs to maintain a constant network connection, it’s usually best to let the operating system decide whether to use Wi-Fi when available, or to switch to cellular coverage.
Published at DZone with permission of Lance Gleason. See the original article here.
Opinions expressed by DZone contributors are their own.
Comments