Internet-of-Things Gateway

Internet-of-Things Gateway

IoT Gateway

In an IoT context, a gateway is a device that communicates both with applications on the internet, and with Things on a local network (fog-devices).
There are many good hardware devices to choose from.

For prototyping we recommend the infamous Raspberry Pi,
and for industrial environments we recommend Option CloudGate.

We did not build our own gateway hardware. We considered it, but concluded that there are already so many good ones available in the market and that the market doesn’t need another one.

Instead we focused on the software to be installed on the gateways. This software that we built is open source and available for free on our github repository. You can also learn how it works by following the video on our YouTube channel. We even provide it on an MIT license, because we want you to succeed with it commercially.

Features of our free opensource IoT Gateway

  • Talaiot REST API implementation
  • Fetching/reading data from serial connections
  • Presuming unstable internet connection(s) to secure all data
  • C++ (Qt) and/or Python utilization

Software

As explained in the Gateway-Hardware Article, a gateway must be able to collect the data locally and send it over the Talaiot.io cloud solution. In order to do that a tailored software is required. This software may change a little based on the hardware configuration used in the gateway. For example ,reading sensor data from a RS232 serial ports require different code from reading data from a modbus device. So here we can explain what are in short, the actions that a gateway software must do. At very least it must:

1. At the FIRST STARTUP must store the token (password). This token can be inserted manually by the user or the device can automatically fetch it from the website by using our APIs. In order to get a token, the device must be registered on our Talaiot.io website with its MAC (or other ID).

After this one time setting the gateway is ready to send data by:

2. Read the sensor data (from file or from serial,  etc).

3. Send data over the Talaiot.io Cloud solution by issuing a HTTP POST request. The HTTP post uses Basic Authentication using as username the device MAC (or the choosen ID) and as password the token. The communication with server is encrypted by SSL.   The data PAYLOAD must be in JSON format.  An example of valid data can be seen here:

Example of Json data

We already prepared several version of the Gateway in different languages available on our

GITHUB

page and released under MIT license!. Please notice that our version (expecially the Python version) may seems really complex but is not. The reason why is relative long, is because error recovery. Indeed the PyGateway software is meant to be used in enviroment where the internet connection is not reliable, and thus it locally store the data if it fails to send it. From time to time will then try to resend the stored data to the cloud (and if is successfull it will delete it). It also include a complete logger, and handles the position, automatic token fetching and relative errors (for example if the user reset/revoke the token of the device from the website). Those things are not required in a minimal gateway version!

If you need help to use/modify our code, or develop a new version in another language, We will be happy to help you out! So, just contact us!

Hardware

The purpose of a Gateway device consist on collecting sensor data locally and forwarding to the Talaiot cloud solution. Any device capable of doing that is by definition a gateway. There are no special hardware requirements. As far as can connect to the internet and push some data over it, can be (at some extend) considered a gateway.

Normally Gateways have two “interfaces”; One interface is needed for communicating with the Cloud Layer. Ethernet port (LAN), Wi-Fi interface or GSM/3G modules are normally used to accomplish this. The second interface is needed to collect data locally. Serial ports, USB ports, USB Dongles, ZigBee, or other local communication systems are good example of this.

Since each of the two interfaces can have multiple faces, a gateway configuration can vary from application to applicaitons. For example in some applications where security is important, all the trasmissions may be wired, using ethernet ports for internet connection and RS232/485 on the sensors side. In other applications, where security is not the main concern, a different configuration may be preferred, for example using standard Wi-Fi card for the internet access and a zig-bee for the sensor network.

For same applications, even your phone can be considered a gateway, since is able to connect to sensor side and Cloud side.

One question that may rise at this point is why use gateway at all? would be possible to only use sensor board to push data direcly on the internet skipping the gateway middle part? The short answer is no. Sensor boards are in general low costs, running on a tiny Microcontroller without any O.S. They are not powerfull and are optimized for low power consumption. This makes those systems unable to properly handles all the communications with the cloud. Authentications, encryption, network certificates are some of the issues that a gateway can handle but a sensor board cannot. Also a sensor board may be running on battery and sleeping mostly of the time, reporting for example the temperature reading once per hour. A complex sensor network can have hundred of those sensors. So instead of making each of them communicating with the Cloud, is better to make it communicate locally to one more powerfull and complex device (gateway) capable of filtering data, authenticating to the server and handling SSL and other encryption mecchanisms.

There are thousands of gateways avaialable in the market, with different interfaces, reliability etc. If you want to start with something easy and cheap, we reccomand to start with the

Raspberry Pi.

This is a perfect startup point, and extremely easy to work with.

If a more rubust and reliable solution is required, we reccomend to use the

Cloudgate from Option.

This is more complex (and more expensive) system made for real industrial application.

Are you in dubt on which gateway to use? Feel Free to contact us… we will be happy to assist you!

Leave A Comment

Your email address will not be published. Required fields are marked *