Today I’m going to talk about my Internet of Things (IoT) experiments.

While IoT needs little introduction, the choice of platform for your own IoT project carries far-reaching implications for how you spend your energy deploying more than a single instance of your project to the real-world. This is the first of two posts about the types of IoT frameworks that I have used that represent fairly different approaches. This is my experience with Mongoose OS.

I was put onto the idea of Mongoose OS after enjoying some fun possibilities with the AWS IoT Button. Since general availability of the IoT button was not great, I naturally wanted to compose something with more readily available hardware. I stumbled upon mention of the ESP32 running Mongoose OS featured in the AWS Partner Device Catalog and so I thought I’d go learn more. While Mongoose OS enables rather trivial registration of your IoT device with major cloud services, I noticed that Cesanta had its own IoT Cloud product which was really all I needed.

As a brief aside, anecdotally, I found my Mongoose-enabled devices would be much more reliable staying connected to WiFi than when building an application using the ESP libraries included with the Arduino-IDE development environment. This likely boils down to more sophisticated handling of connectivity done out the box by the Mongoose firmware.

With Mongoose OS, you can choose to integrate with their API in either C-style language or in mJS.

By installing the mos tool, you can quickly register your IoT device, get WiFi configured and then build and flash your project firmware to your device in minutes. Using mDash, you can register a few devices in their free-tier to interact with the device shadow. Here you can get details about the device’s network connectivity, and interact with RPC methods to further configure and manage the device, including OTA updates which can be separately staged and committed. This is useful when testing some new functionality where a panic-reboot would restore the previously committed firmware. All these are fairly standard device management features in IoT.

My projects make use of an ESP32 on a NodeMCU dev-kit board, a common form-factor for use by hobbyists. Mongoose projects are rather straight-forward but have a specific layout, which you can find by following their quick start guide. The mos.yml file contains application specific configuration variables and also library definitions to include as part of the firmware build. It is useful to know that the variables in the YAML configuration are also made available to the device shadow. The API documentation will indicate which libraries are needed for the desired capabilities.

Using mJS as an example, the fs/init.js script contains your application code which can then access the deployed values using Cfg.get. Here are examples of my Mongoose OS projects:

In each of these projects, you’ll notice heartbeats sent using MQTT messages. This pairs well with visibility tools like Uptime Kuma which I will talk about in a future post.

I use mDash not only for occasional device management on their dashboard, but I also use their REST API for device discovery. I have an example of this in one of my larger projects which I will open-source and discuss in a future post.

In the next post, I will discuss my experience with the Balena Cloud IoT platform.

Hits