IOT

5 Best IoT Libraries

The whole idea of the Internet of Things (IoT) is to have many small devices that collect data and control the environment around them, all this while being connected. Also, with an option of small amounts of data back to the cloud. One example is home automation, in which you may have your server on a Raspberry Pi to collect all data and make calculations or make decisions.

These libraries will help you with your IoT development.

You Need More than Libraries For an IoT System

Depending on what you desire, you will have different demands on your IoT deployment. If you want to use it for automating your home, you will get away with very little to get it running. After having supported your specific hardware, you will need to consider the protocols you will use.

You will need a server that collects, analyses, and presents your data for more advanced projects. Well, you have entire services for that within the extensive cloud services, at a price, of course. There are solutions that you can create and design on your own, independent of your cloud provider. What you need to support are protocols.

These protocols handle messages under a publish-subscribe model, making it very efficient for small packets of messages. Precisely what your IoT solutions should do. If you are streaming video, we are talking about different services.

MQTT – You need this for sending your data from your microcontrollers to servers. You can start your own server using Mosquitto, an open-source message broker. You can put this on anything from a single-board computer to a cloud server.

SMQ – This is a secure version of MQTT.

For handling radio, you need something that requires extremely low power. To solve this, you can use the proprietary LoRa protocol owned by Semtech. There are many boards and gateways to achieve this. Note that you can also use wifi but make sure that your device supports it and consider the power it demands.

Here are some links to libraries using LoRa/LoRaWAN:

An open-source alternative to LoRa is DASH7; you can find hardware and other information here, and development kits from WizziLab.

More followers are using the SigFox boards and libraries for low-power wide-area networking. Note that this entails a network similar to a mobile operator and direct contact to the cloud.

Protocol Libraries

For each of the protocols, you will need libraries. Commonly, you will get documentation from the hardware you buy. However, you may want to read more about it before you make any purchases. There are also libraries for the server end, so bear in mind that you want to know whether it is possible to use a cloud service. Indeed, you want to make sure that it is possible to run your project WITHOUT a cloud connection. Automating your greenhouse may not require you to control it from the web.

LoRA Libraries

LoRa has its own alliance, where you can dig through its specifications and other things. You can find a library for a node on https://github.com/Lora-net/LoRaMac-node. This is a standard that is meant to use a network similar to the mobile cellular networks we all love to hate. However, you can set your own gateway up and connect it to a local server.

DASH7 Libraries

DASH7 is also an alliance, aimed more at industrial applications. You can still use it for your home projects since it is fully open-source. There is a good library at https://github.com/MOSAIC-LoPoW/dash7-ap-open-source-stack. Use it to get a node running that handles a few devices at home. If you are bent that way, there is also Python support: https://github.com/MOSAIC-LoPoW/pyd7a!

MQTT Libraries

MQTT is one of the most used protocols in the IoT space. It comes from a proprietary protocol that has been released as free software. You can find a lot of information here. A client library for use on the ESP32 and ESP8266 is available and active on GitHub: https://github.com/plapointe6/EspMQTTClient

SMQ Libraries

SMQ has the most support from Relatimelogic, a California-based company that does a lot of consulting. They host several repositories on GitHub: https://github.com/RealTimeLogic/SMQ/. You can clone this and compile it on your own system. They also provide an IDE and compiler as a Virtual Appliance (OVF file!) so you can do all your coding in that VM.

SigFox

SigFox operates its own network for you to connect. They have an Arduino library on the Arduino site: https://www.arduino.cc/en/Reference/SigFox

Hardware Libraries

As mentioned earlier, you need to pick your hardware first and then find the libraries that suit your hardware.

Frameworks

When you get serious about it, you may want to connect it all to a cloud of some sort. Here are a few suggestions.

Thingsboard

Thingsboard offers a cloud service where you can host all your services and data. The professional edition starts at $10/month, but you can install the community edition on Ubuntu, CentOS, and more. Docker instances are also available from their website. You can also clone the source from GitHub.

DeviceHive

DeviceHive has servers, client libraries, and many example projects on their GitHub page.

MainFlux

Mainflux are members of the Linux Foundation, no less! So, they need a mention here. Check out their fully open-source offerings! It is a consulting firm, so its webpage looks professional and has a lot of content.

Node-RED

If you are a web developer, remember the foremost framework for working in Node.js. Use it to create the logic and processing. https://nodered.org/

Conclusion

Before you start an IoT project, take some time to think about the total system; Are you going to control something small in your own house or garden, or are you aiming higher and further. There are many ways to hook up your self-watering plant to a cloud service, but is that what you are looking for?

About the author

Mats Tage Axelsson

Mats Tage Axelsson

I am a freelance writer for Linux magazines. I enjoy finding out what is possible under Linux and how we can all chip in to improve it. I also cover renewable energy and the new way the grid operates. You can find more of my writing on my blog.