Golang for Internet of Things — A perspective

poornima narasimhan
4 min readDec 23, 2019

Go, also called as Golang,an open source programming language, designed at Google is a statically typed, compiled programming language that it easy to build simple, reliable, and efficient software. Golang with the speed of a compiled language and the feel of an interpreted language is a popular choice for most of the development today. As i started exploring Golang, more from an embedded developer background, I was curious to see its adoption the world of Internet of Things (IoT). I would like to keep this particular write up open for edits, change in perspective and comments as it will be too early to take sides or to draw a logical conclusion

Golang for IoT

Golang for IoT

The world of connected devices, driven by Artificial Intelligence is the new normal. The possibility of integrating IoT applications with any and every variant of hardware opens up tons of opportunities to solve several business challenges. Real-time remote monitoring through IoT applications is enabling smart factories, smart cities, smart homes etc.,

An ideal Internet of Things framework requires a stable, good, quality and dependable programming language. With many tools that are available today, we have 2 or 3 popular options like getting the bare-bone done in C/C++ or to have a NodeJS integration. We need to keep in mind that these programs do not have sufficient modular support as they are made to work only on one particular device and their adaptive characteristics are not strong. Golang with its progressive traits is believed that it can be a good solution for IoT.

Programming Languages for IoT

A relatively new language, inspired by C without all its dangers, and feel of python (from a developer perspective), built in concurrency ( which corresponds to requirements of huge number of connected devices in IoT networks — by supporting huge number of simultaneous connections) with ability to define go routines that plugs well in to embedded devices. The sweetest deal with Golang is the concurrency model which is much safer and easier to implement, unlike the times that we had to deal with pthreads along with the mutexes, condition variables and semaphores

Frameworks

As I was spending time to comprehend the adoption of Golang in the world on IoT, I decided to classify the study in terms of adoption at device level, edge, cloud. In addition I also attempted to explore the adoption from Industrial IoT perspective as well. Some popular frameworks that I came across were,

https://gobot.io/ — Golang powered robotics/IoT framework with support for multiple platforms. Interestingly this also has raspberry pi integrated for IoT enthusiast to start with

https://www.edgexfoundry.org/ — A common platform for unifying the IoT edge . Golang replaced Java, reducing the footprint from 2.5 GB of memory to 50 MB. It also made components swap possible, so developers could use their preferred database, plugins, analytics and more

https://www.flogo.io/ — Project Flogo — open source framework for event-driven apps, IoT edge etc

https://github.com/mainflux/ — More focused on IIoT

https://www.scalent.io/ — Another Golang based IoT

https://www.gowitek.com/ — more focused on real time tacking and predictive analytics

https://www.thethingsnetwork.org/docs/applications/golang/ — receive activations and uplink messages from devices via The Things Network as well as respond with downlink messages. You can also use the SDK to manage devices.

Few things to consider

As Golang is primarily called as the language for high performance cloud applications, we overlook the fact that its also a great language for developing Internet of Things devices. The ability to handle requests efficiently, ease of development, a reasonably fair memory foot print and ability to interface well with C, makes go a fairly great alternate to JAVA and other programming languages for IoT

It is very evident and clear that Golang was not designed to replace embedded C and is not intended to be part of embedded tool chain. The idea of Golang is more towards handling the communication to and from these devices. At a device level, for example, garbage collection in Golang is too much, but it is very good for someone who is seeking greater control of resources without paying too much overhead.

Golang is in general considered to be very good for data and works very well for data gathering and data distribution to and from various sensors. For example, sorting an entire network of sensors and making use of the data. As said earlier with concurrency in place, and using channels, Golang can help one control an entire set of sensors but at the same time a developer’s glitch can cause the system to go unpredictable (different channels in Golang are not aware of each other)

References

--

--