Previous posts:
EasyConfigure - Modular/Configurable System Intro
EasyConfigure - Hardware Components
EasyConfigure - BASH scripting
EasyConfigure - MQTT test setup
EasyConfigure - Remote sensor unit preparation
Configuration tool
Some progress has been made on EasyConfigure configuration tool and I would like to share the current status.
This tool will be used to configure remote sensor units and allow them to start sending their sensor data to central MQTT broker (Raspberry Pi).
Application relies on two helper scripts that are running on Raspberry Pi. These scripts are used to scan available remote units (scan.sh), and to send settings to each of them (configure.sh).
These two BASH scripts are being run remotely over ssh. Scripts output is parsed and used to update UI.
Figure 1. Sudden Impact configuration tool after two remote units were detected (ESP8266 and CC3200 Launchpad running in AP mode)
Usage
First step is to set the SSID prefix for remote units. My units are set to have SSIDs in si_XYZQW format, where XYZQW is a 5 digit number and si_ is common prefix. This is required for enumeration of available units. Each unit is assigned with a unique password and ssid/password pairs are stored in a text file at the moment, but I plan to make that table editable using this tool.
Units switch from AP to STATION mode after configuration is received. To be able to connect to main AP, all units must receive it's SSID and password - these are set using Wireless AP Settings inputs.
It is also required to set the MQTT Broker address, port, username and password (in this implementation, all units will be using the same MQTT username).
After all fields are set, administrator should click Configure Remote Units button to send configuration to remote units. Units then switch to STATION mode, connect to MQTT broker and start publishing sensor readings.
ESP8266 firmware
This application "talks" to ESP8266 based remote sensor units. Each ESP8266 is running a firmware that's built using Arduino IDE for ESP8266 (https://github.com/esp8266/Arduino). I built Arduino IDE from source - it was trivial. Initially, I had a lot of trouble with watchdog resetting ESP8266 but after I posted a few comments, GitHub project maintainer was kind enough to introduce a change. He exposed WTD enable/disable functions through special ESP object and I was finally able to run the script without interruption.
Further improvements
1) I plan to add status indictors for each remote unit in the list so that it's clearly visible if some unit is not sending updates. This tool will subscribe to all units updates. As soon as message from remote unit arrives, online indicator will be turned on (green LED image) and corresponding timer will be set. Timer will reset every time a message arrives. After timer expires, offline indicator will be turned on for corresponding unit raw (red LED image).
2) Raspberry Pi (MQTT Broker and DB) can be automatically found on the network and this would enable automatic setup function.
3) Reconnect feature should be implemented. Currently, after connection is lost, unit has to be restarted to be able to connect to MQTT broker again.
This application is also built using Qt framework to make it easily portable to other platforms.