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.
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 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 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:
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?