Previous posts:
EasyConfigure - Modular/Configurable System Intro
EasyConfigure - Hardware Components
EasyConfigure - BASH scripting
1. Introduction
I still didn't receive Analog Devices kits but hopefully I will very soon. This is due to alternative route complications.
My time was used for software development. I managed to make an application to test performance of MQTT based solution.
2. MQTT broker
I'm using a Raspberry Pi model B as hardware platform for my MQTT broker.
RPi is connected to ethernet but I plan to switch to WiFi later.
My RPi is running Debian and mosquitto MQTT broker and clients are available from main repositories so installation was trivial:
pi@malina ~ $sudo apt-get install mosquitto
New MQTT user (monitor01) was added using mosquitto_passwd (used similarly to regular passwd)
pi@malina ~ $sudo mosquitto_passwd -c /etc/mosquitto/passwd monitor01
After users were added, I restarted mosquitto but I'm not sure I had to:
pi@malina ~ $sudo /etc/init.d/mosquitto restart
OK, at this point I had a working MQTT broker! You can test the broker and credentials using mosquitto_pub
3. Test MQTT publisher
Instead of sending some real sensor data, I created a small Bash script that's publishing some dummy (random floating point number in 0.0-15.0 range) data to the broker.
#!/bin/bash
for (( c=1; c<=1200; c++ ))
do
v=$[100 + (RANDOM % 100)]$[1000 + (RANDOM % 1000)]
v=$[RANDOM % 15].${v:1:2}${v:4:3}
echo $v
mosquitto_pub -t readings/unit-123456 -u monitor01 -P sddnmpct -h 192.168.1.99 -m $v
done
This script sends 1200 data values with no delay except for the delay that comes from executing bash script and mosquitto_pub within.
4. Test MQTT client (subscriber)
Test client was written in C++ using Qt framework and QCustomPlot (Qt Plotting Widget QCustomPlot - Introduction charting library + Paho C MQTT library (https://eclipse.org/paho/clients/c/).
I built the test application for Mac and it seems to work fine. Stability still needs to be tested over a longer time interval.
This application subscribes to a hardcoded MQTT topic name and plots the received data in real time:
Figure 1. Test application screenshot
Testing monitor application
5. Performance assessment
This test showed the following:
I was able to display~80(~70) samples per second. CPU usage for mosquitto was around 16% for single publisher and single subscriber but adding more publishers increased the CPU usage - for three publishers and a single subscriber I got a little less than 40%. I think that this is fine while I test the system but to be able to support a larger number of remote sensor units I would have to switch to something more powerful than original RaspberryPi model B (something like Gizmo or even a regular PC).
6. Next steps
I will continue working on monitoring client application. Test application will be used as a starting point for my monitoring application that will run on coach's or assistants device(s), be that tablets, mobile phones or even laptops.
Monitor application will be able to trigger device discovery and will provide a way to select device (player) that's currently monitored.
Currently only OS X build is tested but other platforms should be straight forward to support too.
Dragan
Top Comments