Case Study: Industrial Equipment Monitoring
The hardware platform was based on an ESP32 board. The ESP32 board queries the existing system through a SPI base command interface, and makes the data available over JSON-RPC interface. The mobile application runing on iPhone / Android mobile, queries the data periodically over the JSON-RPC interface, and displays it on the mobile application interface, in a format that is convenient for the user.
Problem
Industrial equipments like welding machines and cutting machines, have various parameters that are to be monitored, to ensure their optimal utilization and performance. These parameters are generally available locally from the device user interface. The customer wanted the live data available in machine, to be made available on a mobile application. The machine and mobile phone could be on the same local network, or could be connected over the Internet. The mobile application should be cross-platform and should be made available on iPhone / Android mobile.
Solution
The hardware platform was based on an ESP32 board. The ESP32 board queries the existing system through a SPI base command interface, and makes the data available over JSON-RPC interface. The mobile application runing on iPhone / Android mobile, queries the data periodically over the JSON-RPC interface, and displays it on the mobile application interface, in a format that is convenient for the user.
The firmware on the ESP32 was implemented using Arduino framework, and the ESP Async Webserver was used to implement the JSON-RPC interface. A network manager was implemented on the ESP32 to configure the WiFi interface of the ESP32, and to connect to the configured AP.
The mobile app was designed to be cross-platform across Android and iOS. The mobile application was written in Python using the Kivy framework, and the WebSocket interface was built using Async IO and aio-http framework. The mobile application can be configured to monitor multiple machines, with any one machine active at a given instant. The wireless AP to connect to and the IP parameters of the ESP32, can be configured remotely from the mobile application, as well.
Project Highlights
Cross Platform Mobile Application
The choice of Python and Kivy for building the mobile application allowed to use a single code-base across both the platforms. While there were other contenders for a cross-platform solution like React Native, Python and Kivy proved to be a simple and maintainable alternative that suited the requirement at hand.
Remote Device Management
The application and the firmware had all the features necessary to manage the device remotely. Remote upgrade capability was built into the firmware, and the wireless network was remotely configurable from the mobile application. The ESP32 is available in AP mode, as a fallback option, and can be used to re-configure the ESP32 to connect to different wireless AP.
Automated Testing
Automated testing was used to weed out bugs both in the JSON-RPC interface and the UI. The UI was automated using Telenium, to exercise and test the UI for extreme input cases. The JSON-RPC interface was fuzzed with out of range values, to ensure that the network interface was robust, and was protected from buggy clients and deliberate attacks.