EMIT

Environmental Monitoring for the Internet of Things

Aug 13, 2020

Project update 4 of 15

Being Reminded That IoT Is About More Than Just Hardware

by Jon Luke

It’s easy to think of EMIT as a ‘hardware project.’ Even for us. But the past week has been full of stark reminders that there’s a lot more to IoT that just the hardware! The good news is that, after a fairly stressful week, we have improved EMIT’s firmware significantly and released an open source MQTT monitoring tool that you might find helpful when implementing your own projects.

The Lessons of This Past Week

It all started around this time last week, when we released the EMIT ‘LIVE’ dashboard, a real-time environmental monitoring dashboard built for EMIT project. After completing and testing the dashboard, everything seemed ready to go, so we made the announcement…and then watched in horror as it fell apart. (Apologies if you tried to visit the dashboard during that time. Please try it again!)

After a brief panic and a not-so-brief investigation, we confirmed that the dashboard itself and the MQTTHQ broker were both solid. So what was making the dashboard unstable?

Ultimately, the culprit turned out to be a handful of uncaught exceptions in the firmware code. Despite the many, many hours we spent testing EMIT’s ‘hardware features’, we were again reminded that IoT solutions involve a lot of moving parts and a lot of simultaneous interactions. IoT products require a rigorous and professional approach to development and deployment.

To that end, here is what we learned (and built) over the past week:

Lesson 1: IoT Implementations MUST Be Monitored to Maximize Reliability

Bench testing quickly identifies frequently occurring bugs, but IoT solutions have a lot going on under the hood. It takes time to see every possible fault condition, and the better your solution gets, the harder it becomes to drive out that last bug.

With issues occurring so infrequently, a robust monitoring solution can really help you find and fix those final bugs. Monitoring also helps maintain reliability once your product has been deployed to the field.

We struggled to find a reliable solution immediately…so we built one! Our ‘Super Simple Monitor’ is written in Python and uses a background timer thread to monitor the interval between messages received. If it exceeds a pre-determined period (which indicates one or more missed messages), it triggers an alarm. We even added push notifications, so I now get a message on my phone if EMIT goes down.

We thought others might find it useful, so we’ve made it available on our GitHub repository.

Lesson 2: Micropython’s umqtt.simple2 & umqtt.robust2 Are Awesome!

Although the standard umqtt.simple library for Micropython is really easy to learn and use, it is generally not considered to be the most reliable tool. It just doesn’t have the error handling it would need to deal with all of the challenges—like temporary drops in broadband connections—that arise in the real world.

Rather that continuing to add patches, we decided to have another Google and came across umqtt.simple2 & umqtt.robust2, both of which have error handling built in! All you need to do is decide how you want to handle those errors.

Although they’re not quite ‘drop-in replacements’ for the standard libraries, integrating them was quick and easy. EMIT is now far more reliable, and we’ll be using these new libraries in all of our production code.

That’s all for now. Sorry this was such a long update. Hopefully it was interesting or at least informative!

Thank you for your continued support.


Sign up to receive future updates for EMIT.

Subscribe to the Crowd Supply newsletter, highlighting the latest creators and projects