M5Stack Node for The Things Network

Alasdair Allan
3 min readJul 10, 2018


Stacking microcontroller boards to add additional functionality isn’t a new idea. There have been a number such systems in the past—the TinyDuino is a good example of a stacking system—and even classic Arduino shields can be stacked. However with the rise in popularity of hardware rapid prototyping, sitting alongside ‘connector’ systems like littleBits and SAM Labs, a number of new ‘stacking’ systems have made their way to market.

Amongst these is the M5stack. The system is based around 5×5×1.2 cm stackable modules, with the core module built around an ESP32, making it programmable both from the Arduino development environment and using MicroPython.

The intention of these sorts of systems is to take building infrastructure out of your hands, and let you concentrate on solving just the problem that you care about. Which is what Xose Pérez did when he put together an M5Stack node for The Things Network.

A battery-powered M5stack node for The Things Network. (📷: Xose Pérez)

Since its Kickstarter days, The Things Network has grown into a global crowdsourced data network for the Internet of Things, and arguably has become one of the main driving forces in making LoRaWAN the leader in the war for low-powered, long-range, but low-bandwidth wireless connectivity.

Despite this, it’s only recently that LoRaWAN hardware has started to become cheaper and more accessible. Which is why it’s still interesting to see LoRa capability being integrated into existing systems, like M5stack.

Building a Things Network node from the M5stack. (📷: Xose Pérez)

While there is an existing LoRa module for the M5stack, it is 433MHz only, with no support for other frequencies like 868MHz or 915MHz. So Pérez created his own using an RFM95 module mounted on a custom PCB, which he then put in an M5stack-compatible, and 3D-printed, enclosure of his own design.

The M5Stack RFM95 PCB in a 3D-printed enclosure. (📷: Xose Pérez)

The code running on the node makes use of the M5stack Arduino Library which handles the LCD screen, speaker, and buttons on the Core, along with the Arduino-LMIC library by MCCI Catena, a fork of the original library by Matthijs Kooijman.

Running the M5stack TTN Example code. (📷: Xose Pérez)

If you’re interested in replicating Pérez’s build, you can pick up M5stack modules on their official store on AliExpress. Meanwhile, Pérez has documented everything on his blog, and published his source code under the GNU GPL, and the PCB and enclosure files under the CC-BY-SA-4.0 license, on GitHub.