Test rig software - browser based data logging
General data logging and viewing (numeric values) from any source.
- Data distribution and communication via MQTT broker
- Data viewing via page on web server
- Data logging via Python script
- Currently implemented on a Raspberry Pi but other hardware could be used
- Must install mqtt broker such as Mosquitto. The system currently expects the mqtt broker to be installed on the same machine (same ip address)
- MQTT broker must be configured for port 1883 and websockets on port 9001
- Tested with Apache server with php
- Place files in Apache public docs folder (/var/www/html)
- Start Python script
python/processor.py
to send processor heartbeat - OPTIONAL - Start Python script
python/simulatedData.py
to generate simulated data - OPTIONAL - Start Python script
python/apiCarbonIntensity.py
to retrieve data from a web api (in this case, UK carbon intensity)
Publish data to the mqtt broker to display it and log it.
The topic should start with data/numeric/
followed by the channel description (no spaces in description). For example, for the outside temperature, the topic could be data/numeric/temperatureOutside_degC
The payload should be a numeric value such as -15.5
or 12340
The logging module is meant to be implemented as a separate Python script. This script (not completed) performs the logging operations and broadcasts its status for display in the user interface
Log file location is currently hardcoded to directory /var/www/html/logging
The module should broadcast a heartbeat so that the user knows that the module is operational.
The topic broadcast is processor/heartbeat
The payload is a JSON string that indicates whether the processor is currently logging. For example:
{"logging":true}
processor/logging
start
processor/logging
stop