Skip to main content
shopping_basket Basket 0

Building a Remote Power Monitoring Platform with the Zerynth ZM1-DB


Zerynth ZM1-DB IoT development board

Taking a look at the Zerynth ZM1-DB IoT development board, and using it to construct a LoRaWAN gateway power monitoring system.


As part of The Things Network Calderdale we maintain a LoRaWAN gateway located at the top of Wainhouse Tower in Halifax. The gateway is currently being upgraded with newer hardware and in the process of this, we wanted to add monitoring to a mini uninterruptible power supply (UPS) that will be installed to provide backup power should the mains supply fail.

Adding a monitoring solution would allow us to keep an eye on the power status of the unit, and could potentially help us avoid a time-consuming 405 step climb to the top of Wainhouse Tower.


Zerynth ZM1-DB

Zerynth ZM1-DB Main board

The Zerynth ZM1-DB development board (220-8608) forms the heart of this project and is packed with peripherals that show off the many features of the ZM1 IoT module.

ZM1 module features

The ZM1 module is a customised version of the ever popular ESP32-WROOM module, and thus packs a powerful 32-bit dual core processor, with Bluetooth & WiFi on-board. Zerynth has paired the ESP32 processor with 16MB of SPI Flash to provide plenty of application space, and a Microchip ATECC608A secure element chip.

Provided on the ZM1-DB breakout board is a wide range power supply that accepts 9-36Vdc input, a MicroSD card slot, ethernet, three RGB status LEDs and then a USB-C socket for power and programming. Also included is a “zBUS” socket which allows up to three expansion boards to be plugged in — a choice of six different boards are available from Zerynth.

Zerynth Operating System block diagram

Zerynth also supplies a license for Zerynth OS with the ZM1-DB board, providing an environment in which Python and C can be run. This includes a Python execution engine, a HAL and “VOSAL” abstraction layer that provides features related to multitasking.

Zerynth EXP-IO

Zerynth EXP-IO expansion board

The Zerynth EXP-IO (220-8609) is just one of the zBUS compatible expansion boards offered by Zerynth. Providing two analogue inputs, two digital inputs and then four solid-state relay outputs provides an ideal platform for prototyping industrial sensing and control applications — thanks to the 0-10V/4-20mA and resistive sensing support of the analogue inputs.

The remaining IO on the board (two digital inputs, four SSR outputs) will tolerate up to 36V circuits being connected, perfect for 24V industrial applications.

resistor divider for analogue input

As we need to connect four 12V signals, a resistor divider will need to be used to bring down the voltage into the safe range for the analogue inputs. A maximum voltage input of 15V was chosen, to produce 10V at the output — this gives a small amount of headroom so we don’t risk damage to the analogue inputs.

Phoenix Contact MINI-DC-UPS

Phoenix Contact MINI-DC-UPS

As all the equipment that runs the gateway operates off low voltage DC, we selected a suitable UPS from Phoenix Contact (665-7851) that provides monitoring outputs, and one control input.

The UPS contains a power supply that takes 230Vac input and outputs 12Vdc at up to 4A, and includes management circuitry for charging a small sealed lead acid battery (665-7863) .

Three status outputs are provided from the UPS — battery charge, battery mode & alarm. These will be connected to the two digital and one analogue input on the EXP-IO module, and the second analogue input connected to the output of the UPS to enable voltage monitoring.


Zerynth provides a development environment built around Visual Studio Code, with an integrated plugin that handles all the integration with the Zerynth Device Manager.

To get started, we downloaded the installer from the “Getting Started” guide, and followed through. It’s worth noting that you’ll need a Zerynth account as the installer asks you to sign in before finishing. The installer does not need administrator privileges, thanks to the way that VSCode is installed as a user application on Windows.

VSCode - getting started

Zerynth provides numerous examples ranging from simple getting started examples, through to expansion board samples and more complex examples like utilising the C language interface offered by Zerynth OS.

We followed the getting started guide to the point of getting the example project running on the device.

MQTT error

As shown here and in the guide, an MQTT error will be displayed due to the device not being provisioned for Zerynth Cloud. Depending on the project, this is not necessary but we opted to perform this step. Provisioning the device is as easy as clicking “Claim device” (the guide does differ slightly here, as the command name has changed from “provisioning”) in the control panel (within VSCode), then giving the device a suitable name.

Part of the provisioning process involves erasing any firmware on the device, then uploading a temporary firmware. This means the code we have just compiled and flashed onto the device will need to be reprogrammed. Again, this is done by clicking the “Run” button.

screen showing device had successfully connected and was sending data

With the device reprogrammed, we opened the device manager by clicking “Cloud device” underneath the “Claim device” button. A webpage pops open with the interface to the Zerynth Cloud, and from here we could see that our device had successfully connected and was sending data.

As data was being received successfully by the cloud platform, we proceeded to start writing code that would then look at all the inputs and publish their status to the cloud. This was a fairly trivial process as we took the original code as a starting point. The use of the WiFi connection was swapped out for Ethernet, which is as simple as replacing references to WiFi with eth.config() and eth.start() — a fixed IP configuration can be provided, but we opted to keep it set to DHCP for simplicity.

Callbacks were then added to handle the analogue inputs and add a multiplication value (to convert back to the original 0-15V of the resistor divider input), and then all of this was published to the cloud, just as in the original example.

screen showing that we successfully received data from the device

As can be seen above, we successfully received data from the device including the analogue voltage input. This code can then be built on, for example to publish to a different broker as well as the Zerynth platform, and to support further features such as the ability to reboot the gateway using one of the digital outputs present on the EXP-IO module.

To Wrap Up

This post has been a look at some of the development board offerings from Zerynth, and how we combined them with other hardware to quickly prototype and build a power monitoring platform for our remote LoRaWAN gateway.

Engineer of mechanical and electronic things by day, and a designer of rather amusing, rather terrible electric "vehicles" by night.

Recommended Articles

DesignSpark Electrical Logolinkedin