About 4 years ago, a customer (and a good friend) approached us about an IoT use case: how to use a mobile app built with OutSystems to monitor solar panels. At the time, we built a demo without any devices, injecting fake signals into the system.

Since that time, we’ve had a few things to say about IoT. And, there are cool IoT connectors (AWS and IBM Watson) in the OutSystems Forge. With billions of connected devices generating data that can be useful to the world in so many ways, what we do with IoT is important.

Then, re:Invent 2017 (the AWS conference) rolled around, and I decided to “re:Invent” this demo.

The Thing

Part of the challenge was building a device that simulated the solar panel with several sensors attached to it and being able to update an IoT platform with the sensor data. The sensors were for power output (volts, amps, watts), temperature, and light level. Since temperature is important, we thought, “Why not add a fan attached to a business rule that turns on if the temperature goes above a certain level?”

The Hardware

The device we used was an ESP-32, which has a core microcontroller, a waterproof digital temperature probe, a couple of LEDs, a photocell, a 30mm computer fan, a mini solar panel, and a custom-made 3D printed enclosure.

It ended up looking like a classic Star Trek tricorder, but it does the job.

The ESP-32 can connect to a WiFi network. It collects data from the panel, temperature probe, and photocell and periodically sends this sensor data to the AWS IoT platform. It can also handle incoming commands like turning the fan and LEDs on and off manually or implementing the rule for automatically starting the fan at a certain temperature.

Programming the Thing

For the programming, I used Mongoose OS. I recommend it because it will cut development time by 90 percent, abstracting all the complexities involved. You could consider it a low-code tool for microprocessors.

You can take a look at the source code for this project in GitHub.

The App

Building a mobile app with OutSystems is easy enough, but my MQTT component did not support AWS MQTT because it requires encryption. Fortunately, AWS provides the JavaScript libraries and examples needed. After some copy-and-paste action, I had an updated MQTT component.

The requirements for the demo are very simple:

  • Display a page where the user can see the data from the solar panel in real time.
  • Turn the fan on and off the fan or set it it to automatic.
  • Change the temperature threshold that activates the fan.
  • Set the solar panel to maintenance mode, which will turn a red LED on to check to see if it’s the correct panel.

Interacting with the device, like covering the panel, the photosensor, and the temperature probe will update the app in real-time. You can see it in action here:

Stay Tuned

I don’t claim to have ESP (other than the ESP-32), but I fully expect that even now, people in your company are thinking of ways to use mobile apps in IoT use cases.

Are you ready?