"Gateway devices make the relationship between cloud services and Internet of things (IOT) terminal devices closer, accelerate processing speed, reduce latency and maintain high utilization. However, when designing the gateway, developers quickly found that they need to clarify a series of confusing hardware and software options in order to connect various IOT peripherals to the cloud.
Now, using raspberry pi from Mozilla and open source software, developers can quickly and efficiently implement gateways based on emerging Internet of things standards.
In order to guide designers to understand the whole process, this paper first briefly reviews the role, key requirements and related implementation challenges of gateway in the Internet of things, then introduces the role of standards, and focuses on the method of World Wide Web Consortium to describe entities in the Internet of things.
Finally, it focuses on introducing developers how to use Mozilla's raspberry PI 3, wireless plug-ins and open source software to quickly deploy gateways. At the same time, this article will especially introduce how developers can easily extend their gateway using Mozilla software framework to support any number of peripheral plug-ins to meet specific connection requirements.
The demand for gateways is growing
On the web, although there are great differences in the underlying hardware and software between the browser platform and the server platform, users can use a variety of browsers to contact a variety of servers by using standard protocols. Although the Internet of things is based on many of the same standard protocols mentioned above, it faces much greater challenges in achieving sustainable web driven interoperability. Just as the web browser identifies its identity and function in the request header, IOT devices also need standard methods to identify its function and the nature of the data provided.
However, in a typical multi-layer Internet of things architecture, the number and type of entities may be very complex, especially in the lowest layer containing sensors and actuators. In order to meet the different connection requirements of these devices, gateway devices have become the preferred solution. With its ability to support a variety of wired and wireless connection options, the gateway provides key services for complex Internet of things systems. Internet of things developers not only use the various connection capabilities of the gateway, but also provide more substantive services in the complex Internet of things through the gateway. Therefore, the role of the gateway can be significantly expanded.
Role of gateway
The simplest function of gateway devices is to buffer the communication between high-throughput cloud connections and hundreds of Internet of things peripherals. The data flow rates generated by these peripherals are different from each other, or even different by multiple orders of magnitude. If you cannot connect to the cloud, the gateway can provide a local version of cloud services to IOT devices. On the contrary, if the IOT device is offline for any reason, the gateway can provide a virtual IOT device to the cloud to simulate the basic functions and the latest known state of the corresponding physical IOT device. In either case, even if the connection is interrupted, higher-level Internet of things applications can continue to operate normally.
IOT edge devices are usually not limited by the real-time and power of IOT peripherals. Therefore, high-performance processor architecture can be used to provide powerful processing power close to IOT data sources. By migrating more advanced cloud services and even advanced machine learning algorithms to these devices, IOT experts further make use of this local processing capability to provide faster response cycles for local processes, or reduce the size of data streams from upstream streams to cloud applications.
Commercial IOT platforms such as Amazon Web Services IOT, IBM Watson IOT and Microsoft azure IOT all provide their own proprietary interfaces and protocols in their end-to-end service products (Figure 1). However, for many reasons, including fear of being trapped or based on broader needs, Internet of things application developers continue to look for solutions that can simplify the application of more different Internet of things devices and services.
Although other organizations are also defining the elements of the standard IOT architecture, the World Wide Web Consortium (W3C) is the leader in defining IOT standards. In its evolving specification, the W3C world wide internet of things (wot) establishes some key interfaces that allow a single device to communicate with a gateway, cloud server, web client or even another IOT device (Figure 2).
Although the details of the W3C architecture are beyond the scope of this article, there are several key definitions worth mentioning. One of the most important items is the thing, which contains a physical device and its metadata (or thing description), which is represented by a small triangle in Figure 2.
The thing description not only lists the basic metadata such as name and human readable description, but also directly supports applications with various functions, including data classification, verification and specific endpoints that other entities can call to perform the unique functions of the specific thing.
Using the standard communication method (wot binding templates in Figure 2), different participants in the same Internet of things application only need to use the thing description of the new device or gateway to understand its use method and data function. With its data model and application programming interface (API) definitions, Mozilla provides developers with one of the first available frameworks for building such interoperable gateways.
Mozilla gateway
As part of its W3C wot work, Mozilla's thing gateway specification includes a data model for describing things, related thing types, and a simple API using WebSockets or basic rest mechanisms. Mozilla's transaction description specifies basic metadata, including name, type, description and various attributes, such as "on" and "Brightness" of networked LED lights.
Other entries in the transaction description contain more complex objects that encapsulate different operations, such as dimming lights. By accessing the fade operation in the transaction description, the gateway or other entity can find the entry point of the function to perform the fade operation according to the specified attributes, such as fade level and duration. Therefore, thing description provides a standard method for identifying IOT devices and performing various operations of their design.
In order to interact with things, developers can use the familiar rest web protocol to read (get) or write (put or post) the thing attributes defined in the thing description. A normal rest response, in turn, will provide the status of a read or write operation for the requested data.
For example, to lighten the LED brightness to 50% within the transition time of two seconds, the developer will post the corresponding JSON body to the associated fade endpoint, and then receive the 201 response and JSON body to confirm the attributes and status of the request operation queued by the device.
Although Mozilla documentation provides a detailed description of its data model and API, developers still have to write a large number of software packages to transform this theory into a practical gateway. Fortunately, Mozilla solved the theoretical problem of its specification by providing a complete implementation scheme designed for raspberry PI series.
Gateway Platform
As mentioned earlier, the basic role of the gateway is to provide a variety of connection options to mix and match different IOT peripherals, so the design requirements of the gateway are relatively simple. In fact, the raspberry PI series provides an effective hardware foundation for building such devices. The latest version of raspberry PI 3 model B + is an upgraded version of the series, while significantly improving the throughput of wired and wireless networks. In addition, this development board is based on quad core arm ® Cortex ®- A53 application processor provides an effective platform for exploring the complex local processing functions mentioned above.
Without fully using the processing potential of raspberry PI 3 model B +, developers can explore basic gateway functions. They just need to load a firmware image that can be downloaded free from Mozilla GitHub database on the development board. The firmware implements a basic gateway. Developers only need to insert the wireless controller adapter into the standard USB connector of raspberry PI 3 development board to connect wireless peripherals. Mozilla software implementation provides out of the box support for various wireless USB adapters, such as sigma designs acc-uzb3-u-sta Z-Wave USB controller.
After the development board is powered on, the software will guide the developers to complete some basic initialization steps, and then immediately start searching for devices in the local wireless environment. By using the web interface, the developer can connect the discovered device to the gateway by clicking the button (Figure 3a), and then view or modify the device attributes defined in the corresponding thing description (Figure 3B).
Using ecosystem hardware to enhance the gateway
In addition to being easy to implement the basic gateway, the combination of raspberry PI ecosystem and Mozilla open source code also provides developers with a comprehensive environment for extending the basic design. Developers can download the complete source code package of the design to better understand the gateway operation, change specific operation characteristics, and even create custom gateway applications. The source code is designed to run on node.js and shows the key design patterns of each component of complex gateway software application.
Using this development platform, developers can quickly create gateways that can support a wide range of connectivity options with the help of a large number of available hardware expansion boards. For example, adding pimoroni pim213 automation hat to the raspberry PI development board enables the gateway to support high voltage and high current wired connections required in industrial environments.
For the operating environment with poor Internet connection or no connection, add narrowband LTE connection to the gateway by connecting the raspberry PI development board to the nimbelink nl-ab-rpi development board equipped with nimbelink nl-sw-lte-svzm20 LTE cat M1 module and taoglas limited 4G LTE antenna.
Developers' choices are not limited to the raspberry PI plug-in. They can also insert different adapter cards into their raspberry PI development board to access a series of plug-ins provided by other interface standards. For example, using seed technology 103990079 Arduino adapter, digi international xk-wdm development board can add digi's energy-efficient digimesh mesh network connection function to the gateway. For applications requiring standard mesh connection options, you can insert digi's xkb2-z7t-wzm ZigBee development board.
Similarly, developers can use the seed 103010002 grove adapter to support lorawan mesh networks with the seed 113060006 grove lorawan development board, or support sub GHz networks with extended coverage with the seed 113060000 grove RF link plug-in.
With abundant available plug-ins, developers can quickly expand their hardware platform and provide a variety of connection options. In terms of software, the Mozilla project provides a set of clear requirements and examples for implementing the software interfaces required to support new hardware.
To build plug-ins for things gateway, developers need to provide code for three types of entities: devices, attributes and adapters. Device code usually extends the basic device class by using the properties and methods (functions) unique to a specific device or device type.
For example, a device module may contain separate classes associated with different variants of the basic device – for example, one class of the basic led and another class of the smart light bulb. The property module extends the basic property class to provide a set of property categories that contain methods to update specific device properties, such as the color or brightness of LEDs.
Finally, the adapter module will extend the basic adapter class to provide classes to initialize the device communication channel, support network debugging, and support other device or communication specific functions.
Although the main gateway package is implemented in JavaScript for node.js, the platform also officially supports python. Conceptually, however, developers can build compatible plug-ins in any suitable language. For example, developers have created plug-ins using rust (Mozilla's C + + like memory security language). For developers who can use the existing node.js backend, this relatively simple plug-in method provides a powerful function to quickly create gateways that can connect various IOT peripherals through different connection options.
summary
For IOT gateways, the challenge for developers is to ensure interoperability between different IOT devices, gateways and servers. Although the corresponding standards bodies are rapidly developing appropriate specifications for Internet of things interoperability, developers need to turn the specifications into feasible solutions to a great extent.
As described in this article, by combining Mozilla's transaction gateway software with raspberry PI 3, developers can quickly and efficiently evaluate gateway applications and easily expand the gateway to support different connection options.
Article source network“
Our other product: