Golang application on IoT

Guys, can Go language be used for programing IoT devices ?
The main requirements for programing is
> Connect to many devices
> Able to store data
> Should support [Arduino] or [Raspberry Pi]
> Should be considerably fast
Is Go reliable for IoT programing ?

As long as you run Go program on supported platforms (microprocessor), you’re good.

For Arduino, not feasible as Go is specifically designed for computing. It’s best to stick back C/C++. If you want to have Go supported down to embedded level, you can consider develop for the team.

For Raspberry Pi, you need to remember to cross-compile your program like:

$ env GOOS=linux GOARCH=arm GOARM=5 go build <path/to/program>

Go is reliable for edge data processing and back-end server. For sensor/actuator interfacing, depending on your design, microcontroller assembly / C / C++ will be more suitable.


There’s also TinyGo which is designed for such use cases https://tinygo.org/

You can compile and run TinyGo programs on several different microcontroller boards such as the BBC micro:bit and the Arduino Uno.


Yeah, Thank you sir.

Sorry for some typo. Thanks for the backup @bklimczak. :smiley:

I was trying to convey that “you can help the developer team to enable Go on embedded microcontroller”. As far as I tested TinyGo, you must adhere to a few rules:

  1. avoid heap memory allocation (https://tinygo.org/compiler-internals/heap-allocation/)
  2. no map type yet (https://tinygo.org/lang-support/)

Given the easiness to import Go packages across the Internet, you must be very, very careful with importing Go packages as a lot of them are using map data type internally. The programming experience is like walking by tip-toeing most of the time. In my opinion, it’s quite taxing which is why I do not recommend Go for microcontroller (yet).

If you can solve those puzzles and contribute to the developer team (E.g. TinyGo / Go dev team), I’m pretty sure the entire Go community will appreciate your effort. :smiley:

If you need to have small board but for some reason, strictly using Go, you can consider those very tiny single-board-computer like the following so that you don’t need to tip-toeing around:

  1. https://www.raspberrypi.org/products/compute-module-3-plus/
  2. https://www.friendlyarm.com/index.php?route=product/product&product_id=132

Happy exploration.

1 Like

Regarding my humble experiences pis are not reliable. Take look at up board. Little pricy but they are a stable products with optimized linux kernel.

1 Like

Definetely, yes. I wrote a SCADA IIoT system in Go (real time monitoring and commands) connecting to many devices in real time thanks to goroutines. I also worked on Raspberry Pi (see here how). And yes, it’s extremely fast and reliable.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.