At Digi, we are constantly innovating and iterating to bring the best wireless solutions to our customers, partners and OEMs. Our rich set of wireless modules, resources and tools enable developers to build connected products and applications for a massive range of applications across agriculture, industrial, medical and smart cities use cases.
In this post we will share enhancements made to the MicroPython capabilities in our XBee® line, and the new features we have rolled out. We will continually add enhancements to support edge intelligence in IoT applications. "We've only just begun!
With the latest release of the Digi XBee 3 MicroPython firmware, the feature set now enables customers to build real business logic on the XBee itself over the lifecycle of the end product.
Heres a quick review of some of the new features:
- We've expanded the MicroPython capabilities across the product line.
- We added MicroPython custom module support to our short range products.
- Additionally, we added the ability to update the MicroPython application remotely over the air.
Let's talk more about the enhanced functionality.
Expanded MicroPython Capabilities
The new MicroPython capabilities mean that you can expect the I/O interfaces to look the same across the XBee 3 product line. Whether you want to use PWM to drive a motor, interface to an I2C thermostat or sensor, or just turn a light on and off, you will be able to use your Digi XBee 3 device to add intelligence and interact directly with the real world. As we'll see, potential real world use cases include everything from home automation to industrial IoT applications.
Custom MicroPython Support
On Digi XBee 3 short range products, customers can now add their own custom MicroPython modules. A Python environment without modules is severely limiting. Modules are fundamental to Python programming and software engineering best practices. They make it straightforward to share common code between different XBee 3 modules and even different customer end products.
MicroPython Over-the-Air Updates
Over the air updates (OTA) mean if you find a bug in your code or you want to enhance the capabilities of your devices in the field you can push out new code to your XBee's without having to roll a truck to each one.
In many applications such as street lighting, having to physically access the devices to fix a bug or add some new features is simply not practical. This feature lets you update your devices without having to physically disassemble them, which saves time and labor.
Over-the-Air Updates for Short Range and Cellular
Digi XBee 3 short range products that include 802.15.4, DigiMesh and Zigbee cannot connect directly to Digi RM and also have an over the air MicroPython update feature. Since they have more limited space than XBee 3 Cellular, we utilize the firmware update features that were already present in the product to upload a simple filesystem image that contains the Python application and its supporting modules.
For Digi XBee 3 Cellular products, you can use Digi RM to directly interact with the filesystem on your XBee. Not only can you upload your Python code, but you can set it so updates only occur when sleeping devices wake, for optimal battery usage. This capability uses a feature unique to Digi devices connected to Digi RM called Short Message (SM) Query. It allows you to minimize data usage and even to connect on demand via SMS or at the next check-in interval via UDP.
Benefits of Using MicroPython
MicroPython enables customers to add intelligence to end products without the added time, cost, and complexity of designing in a host microcontroller. Of course, this is not a one-size-fits-all model; the choice of using MicroPython or host processor depends on the complexity and requirements of the application.
A host microcontroller may be appropriate, and the two are not mutually exclusive. MicroPython can serve to add functionality to the communications module that might not be there otherwise (e.g. MQTT), and thereby save the time required to implement it on the host MCU. , to perform some sequence of the following actions:
- Read an input (I2C, GPIO)
- Track an interval
- Send some data
- Perform a simple calculation
- Check for a condition to change
- Turn a device on or off
- Wake up
The actions above combine . A typical XBee 3 running MicroPython might sleep for five minutes, wake up to check whether the status of a GPIO has changed from low to high, then go back to sleep. If the value changes it could send a text message to issue an alarm that something is has gone wrong.
Sample Use Cases for Digi XBee 3 MicroPython
There are many practical everyday uses for this functionality, as well as field applications for industrial IoT. The various types of use cases may require the functionality of the XBee 3 Cellular line (Cat 1, LTE-M, NB-IoT, 3G), or XBee 3 short range products (Zigbee, DigiMesh, 802.15.4), depending on the required topology and distribution of devices and the frequency and amount of data to be sent.
Let's explore examples that show the range of possibilities.
Water Level Sensor
In certain climates, homes can experience sump pump failure due to excessive snow melt and run-off, or rainstorms that produce a high volume of rain. A simple high-water-level sensor can alert the homeowner to the issue before it results in basement flooding.
Daily Data Reading Application
In another example of a typical Digi XBee 3 MicroPython application, the module sleeps for a day, wakes up, reads an I2C sensor, transforms the data with a simple calculation, formats the result, and then transmits the data point upstream to the desired IoT cloud or to a local gateway for aggregation, depending on whether the XBee 3 is cellular or short range, respectively.
Industrial and Agricultural Applications
Using MicroPython on Digi XBee 3 is gaining traction with our customers to solve real world problems.
For example, one customer used MicroPython on XBee 3 Cellular LTE-M to build the logic into battery powered soil sensors to monitor the temperature and humidity of fields of mulch piles. This application utilized several MicroPython libraries including MQTT to publish the data to the AWS (Amazon Web Services) IoT cloud.
Another customer used an FTP client library to log data to the filesystem and then transmit it to their own application server.
In another use case, a customer used MicroPython on XBee 3 Zigbee to read the current temperature and send it to a remote node in a steam metering application.
MicroPython Code Simplicity
The great thing about these solutions is they involve incredibly simple MicroPython code. A skilled developer can create a useful application in 100 lines of code or less.
MicroPython solutions are limited only by the imagination. For example, you can use MicroPython with Digi XBee 3 devices to do any of the following and more:
- Drive a simple display
- Interface with BLE
- Add a simple network protocol
- Enhance API mode with the User Data Relay Frame
- Handle requests from the cloud
We've only just begun to deliver edge intelligence solutions on Digi XBee 3. Digi is actively working to expand our MicroPython development tools, libraries, example programs, and applications that we host on our github repository. These developer resources provide building blocks that you can use to solve real problems by adding intelligence to IoT your products and applications.