Digital Twinning: Programming the Device

Digital Twin
Digital Twin

We are spoiled for choice in the abundance of IoT hobby and industrial devices and ecosystems today. I am reminded of the explosion of effects pedals and keyboards that came out in the eighties, and my attempt at soldering up a ring modulator stomp box from parts I bought at Radio Shack.

In order to program the Stack I had to “burn” it, which I would normally refer to as “flashing.” This means replacing the default demo firmware with one that supports running custom programs.


Before I could burn and start programming I had to pick a programming language and environment. I chose UIFlow over Arduino and EDNEX-Maker (Python). Why? It seemed similar to the Lego Mindstorms environment I used when working with students at a local school on a First Robotics challenge.

Blockly Vs Python

UIFlow’s Blockly is the visual code tool. You can display the equivalent Python code to the visual blocks it uses in case you want to switch or learn how to do something new in Python. And you can always load other environments and save your work for each on your computer or and/or a repo.

One downside is that you are warned that any edits in the Python view are lost if you switch back to Blockly. And I saw some pretty ugly Python generated where I was concatenating strings, LOL. But overall I wasn’t surprised or disappointed to find that doing meaningful programming involved some awkward arranging of blocks because I made rapid progress getting the device to do things.

The first “program” I created simply displayed the MAC address of the device in a label on the screen to help me find it on my router and give it a name and stick an IP address to it.

Getting rotational data to emit required constructing a loop to read the MCU sensor. I added a toggle button to the screen as an interrupt. It didn’t take more than an hour to get positional information updates via mqtt and start working on a display. I highly recommend this device if you are interested in getting data and don’t feel like breaking out the soldering gun and magnifying glass.

My project files saved with a .m5f file suffix, but they are json files. They can be generated, edited and re-imported at your peril I suppose. I didn’t find a way to save the Python equivalent code, but it is easy enough to copy-paste into a new file and open it in the EDNEX-Maker Python environment to see if it is compatible.

Github Repo

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

Captcha loading...

This site uses Akismet to reduce spam. Learn how your comment data is processed.