Many low-power wireless interfaces and protocols such as Bluetooth low energy, ZigBee, Thread, and others are popular for smart home and smart industry sensor mesh applications. However, as developers are finding out, these RF protocols were designed before the Internet of Things (IoT) became a reality, and as such typically lack interoperability with Internet protocols (IPs) IPv4 and IPv6 making it challenging to connect designs to the IoT for smart sensing, automation, and control.
There are ways around this IP interoperability issue, such as transforming packets or using an IP-compatible wireless interface. The first option is inefficient, and the second narrows designers’ options to Wi-Fi.
This article will focus on a third option: IoT gateways. These serve as network aggregators and often come with advanced security and multiple I/O options for backhaul. The article will describe their function and characteristics before introducing suitable solutions and how to get the most out of them.
Wireless options for IoT
Despite lacking direct IP interoperability, many of the popular low-power wireless interfaces and protocols are characterized by good range and throughput, coexistence with other 2.4 GHz technologies, and mesh networking support. (See Digi-Key article “Comparing Low-Power Wireless Technologies.”)
Bidirectional wireless connectivity allows users to remotely monitor and control systems while at the same time enabling data from the process to be analyzed by powerful cloud-based algorithms to, for example, optimize performance, save energy or increase productivity.
As mentioned, there are three ways to overcome the low-power wireless protocols’ lack of IP interoperability. The first is to select a protocol with a network adaptation layer that ‘transforms’ packets such that they can be carried over an IPv6 network. Some manufacturers offer Bluetooth low energy, ZigBee, Thread, and other RF protocol ‘stacks’ incorporating an IPv6 over a low-power wireless personal area network (6LoWPAN) transport layer. Generally, such stacks work well but are more complex to implement in addition to demanding more processor resources and power consumption at each node.
The second option is to use a wireless protocol with native IP support. Wi-Fi is perhaps the best example. Strictly speaking, Wi-Fi defines just the physical (PHY), media access control (MAC), and logical link control (LLC) layers of the stack. However, such is Wi-Fi’s ubiquity for Internet connectivity that vendors typically supply a complete TCP/IP stack based on the Wi-Fi lower layers. The trade-off is that Wi-Fi nodes are larger, more expensive, and demand more power than competing wireless technologies and are therefore not suitable for all applications.
A third approach is to take advantage of an IoT gateway. These devices are self-contained units that include all the software and hardware required to bridge the gap between LAN and IoT (Figure 1). Gateways are also a good option for developers with limited RF expertise, or those that want to add Internet connectivity to a legacy low-power wireless network.
Figure 1: Designers can select from three alternatives to connect wireless sensor networks to the IoT. The first option shown here describes how to link wireless nodes to an IoT gateway, which acts as a bridge to the Internet. (Image source: Texas Instruments)
The difference between gateways and routers
It is important to draw a distinction between a gateway and a router. A router is a simpler device because it services nodes that share a common protocol and is required to solely relay data carried over the protocol to the Internet and back the other way. Wi-Fi routers are a good example; the devices route data between IP-enabled mobile devices such as smartphones and portable computers and the Internet with no interaction.
In contrast, an IoT gateway aggregates data from disparate wireless sources and interfaces and bridges them to the Internet. In some cases, a gateway is used in conjunction with a router to ease implementation. The key advantage of a gateway is that it eliminates the need for individual network nodes to support IP with its associated complexity and cost.
Gateways can be either simple or complex. A simple unit organizes and ‘transforms’ packets received from nodes so they are suitable for transport over the Internet. In addition, a simple gateway transforms packets received from the Internet and distributes them across the network to the nodes.
More complex gateways not only serve this role, but also incorporate advanced security features as well as resources to handle all or some (sharing the load with the nodes) of the application processing. The advantage of this system is the nodes can be simpler, less expensive, and feature lower power consumption. In a system comprising many nodes, it costs less to concentrate processing power at the gateway than it is to distribute it across all the nodes. More complex gateways can also ensure the LAN continues to operate when Internet access is interrupted and can buffer node data for transmission to the cloud when Internet access is re-established.
A number of manufacturers supply commercial IoT gateway solutions. The devices typically take the form of mains powered units configurable to leverage a variety of wireless interfaces including a selection of low power RF protocols. Bridging to the IoT is typically via a wireless IP-based wide area network (WAN) interface such as Wi-Fi (or a wired type like Ethernet). Some more recent designs include Internet access via the cellular network or proprietary WAN technologies such as LoRaWAN.
WAN technologies typically employ heavyweight stacks controlled by operating systems (OSs) such as Linux. To cope with the computational demands of such firmware, commercial IoT gateways are equipped with powerful embedded microcontrollers.
More advanced gateways support multiple network platforms, for example, HSDK, NAT64, PC-BLE-Serialization, and LoRaWAN Gateway Bridge, as well as multiple cloud services such as those from Amazon, Microsoft, Ayla, and IBM. These advanced units also offer features such as remote management for installing apps, firmware updates and configuration changes, end device firmware updates and remote management of mesh network topology and devices.
Rigado’s Vesta Series IoT Gateway is a good example of the latest generation of configurable gateways. The product is powered by an NXP i.MX6 UltraLite Arm® Cortex®-A7 application processor running the Yocto Linux OS. The unit supports both 2.4 and 5 GHz Wi-Fi (IEEE 802.11a/b/g/n), Bluetooth 4.2, Bluetooth low energy, and IEEE 802.15.4 (including Thread). The gateway also includes Ethernet with IEEE 802.3af Power over Ethernet (PoE) and USB 2.0. It runs off a 4.5 to 5.5 volt supply, or via the PoE connection. Cellular and LoRaWAN expansion options are on the way, according to Rigado.
Sierra Wireless’ FX30 IoT Gateway also boasts an Arm® Cortex®-A7 application processor and uses the open-source Yocto Linux OS (Figure 2). Internet connectivity is via cellular infrastructure (LTE Cat 1), and the unit can accept Wi-Fi, Bluetooth, and ZigBee inputs via an IoT Connector expansion slot. The standard unit is designed to work with wired interfaces such as Ethernet and USB only, and it runs off a 4.75 to 32 V supply. The unit is notable for its low power consumption, requiring less than 1 W in idle mode and 2 milliwatts (mW) in sleep mode, and rugged construction. It meets MIL-STD-810 for vibration and mechanical shock and has an operational temperature range of -30° to +75°C, which makes it a good option for industrial applications.
Figure 2: Sierra Wireless’ FX30 IoT Gateway connects to the Internet using cellular technology. (Image source: Sierra Wireless)
A third example of a commercial IoT gateway comes from Laird Technologies. Its Sentrius RG1xx Series is notable for its use of LoRaWAN, a long-range, low-power WAN technology for Internet connectivity. The unit uses an Atmel A5 embedded microprocessor and runs the Linux OS. In addition to LoRaWAN, the unit offers both 2.4 and 5 GHz Wi-Fi, Bluetooth 4.0, and Bluetooth low energy wireless interfaces, plus an Ethernet interface. Because of its long-range connectivity, Sentrius is targeted at smart meter, industrial automation and agricultural applications.
Commissioning a gateway
IoT gateways like those from Rigado, Sierra Wireless, and Laird Technologies let designers connect their low-power wireless networks to the Internet and cloud services without having to design complex bridging hardware and firmware. However, some development work is required to ensure seamless operation. Fortunately, the manufacturers of IoT gateways typically offer products, tools, and services to ease this development process.
Laird’s Sentrius, for example, is designed to connect with the company’s RM186/191 series LoRaWAN/Bluetooth low energy wireless modules for wireless sensor applications. These units combine the convenience and smartphone interoperability of Bluetooth low energy with the extended range (up to 15 km) of LoRaWAN. Laird offers a development kit, the DVK-RM186-SM-01, which eases the process of connecting the modules to the Sentrius gateway. Using the company’s Node-RED development environment and related guidelines, the process becomes relatively straightforward.
Sierra Wireless suggests the Legato Open Source Linux Platform should be used to connect its FX30 IoT gateway to the cloud. Legato features an application “sandbox,” providing a secure environment to run and control multiple applications. The platform also offers application programming interfaces (APIs) enabling developers to connect to the cloud.
For developers that need to design advanced networks, Legato offers an Eclipse based integrated development environment (IDE) with multi-language support, and a suite of diagnostic tools to enable local and remote debugging, troubleshooting, monitoring and profiling.
Sending data to the cloud
Rigado has further simplified wireless network and cloud connectivity with its VG3-23E4-WIB0C0-ASA-DEK IoT development kit, comprising a Vesta Gateway and a Nordic Thingy:52 Bluetooth low energy development kit (Figure 3). The development kit allows engineers to prototype solutions that link Bluetooth 5/Bluetooth low energy sensors to the cloud. The advantage of working with the IoT development kit is that no RF experience is required because the Thingy:52 sensor is already configured to communicate with the Vesta Gateway. Prototyping is further simplified because Rigado’s Node-RED development environment includes a demo application which forwards data from the Thingy:52 sensor via the Vesta Gateway to the Amazon Web Services (AWS) cloud service.
Figure 3: Rigado’s VG3-23E4-WIB0C0-ASA-DEK IoT development kit comprises a Vesta Gateway and Nordic Semiconductor’s Nordic Thingy:52 IoT development kit. Rigado’s Node-RED development environment simplifies configuration of the gateway. (Image source: Rigado)
Sending data from the Nordic Thingy:52’s various sensors to AWS via the Vesta Gateway is straightforward. Vesta is first configured as a Wi-Fi access point and connected to the developer’s Wi-Fi network via a browser. Clicking on a supplied URL starts the Node-RED application which then automatically scans for the Nordic Thingy:52, attempts to connect and scans for the Universal Unique Identifier (UUID). Once a connection is established, sensor data is read from the Nordic Thingy:52 and sent to both the AWS and the Node-RED application dashboard. From the dashboard, the developer can make changes to filter what information is transferred and how often it is sent.
The Node-RED development environment also provides a simple way for experienced developers to create browser-based workflows to connect hardware devices, application programming interfaces (APIs) and cloud services.
Connecting a sensor network to the cloud via an IoT gateway multiplies the usefulness of the system. Cloud service providers typically provide infrastructure to handle the sensors’ raw data, manipulate and analyze that data, and present useful information or feedback derived from it.
When using the AWS cloud system, for example, the Vesta Gateway interfaces with AWS’s API Gateway (Figure 4). Using the API Gateway, a developer can create, configure, and host an API to allow Vesta Gateway applications to access the cloud. For example, an application can use the API to upload temperature and humidity data from the Nordic Thingy:52’s built-in sensors. The raw data can then be stored in an Amazon S3 “bucket” or Amazon DynamoDB database service.
Figure 4: The Vesta Gateway takes advantage of Amazon’s AWS cloud service to collect data and run any associated code. (Image source: Rigado.)
Another element of AWS, AWS Lambda, offers a computing service that lets the developer run cloud-based code without having to provision or manage servers. AWS Lambda supports Node.js, Java, C#, and Python.
For example, a developer could use code running on AWS Lambda to notify of temperature and humidity extremes and mean values over a day, week and month using raw data sent from the Nordic Thingy:52.
It is relatively straightforward to configure AWS Lambda to run code in response to trigger events, such as specific changes to data in the bucket or database. For example, a developer might choose to run code that sends a notification to a smartphone if the temperature or humidity exceeds a set threshold.
Once prototyping is complete, Rigado’s family of Nordic Semiconductor-based modules for Bluetooth 5/Bluetooth low energy wireless sensor network applications can be substituted for the Nordic Thingy:52 to produce a finished design for production.
Cloud connectivity is essential to maximize the benefits of smart wireless technology, yet it remains a tough technical challenge because of the lack of interoperability between the popular low-power wireless protocols and IP. A convenient and rapid solution is to employ an IoT gateway, a drop-in device that bridges wireless sensor networks to the cloud with minimal design overhead.