Peter Gamma (Physiologist & Director) Meditation Research Institute Switzerland (MRIS)

90.16 Mobile Platform for Sensor Data Acquisition and Processing with MQTT, LSL, Home Assistant, InfluxDB and Python

Last Updated on September 14, 2022 by pg@petergamma.org

  1. We connected the Polar Sensor Logger app over MQTT to Home Assistant running on a Rasperri PI, but we failed on our first attempt.
  1. Then we where attracted by the fact, that Polar devices can be streamed into Home Assistant, but then we found out, that the Polar Integration to Home Assistant is broken.
  2. Then, we bought a TEMPer usb temperature device, which can be found on Aliexpress, and tried to connect it to Home Asisstant, but we also failed. There is a TEMPer integration for Home Assistant available. But we need to edit the Home Assistant YAML file for it, and we could not yet find out how to do that.
  3. The Fitbit Home Assistant Integration requires also to edit the YAML file. We failed here, too.
  4. Strava data can be streamed into Home Assistant, and is heavily discussed. But the instruction is long, and looks like that it is something for coders. We failed due to lack of time.
  5. There is also an integration for Withings in Home Assistant. It needs editing of the YAML file, too. Failure.
  6. We did not try the option to sync Garmin wellness sensor data to HA, only the resting heart rate parameter is interesting for us for the moment.
  1. We did a Home Assistant installation on a Windows 10 PC, which is easy, easier than handling with a Rasperri PI. There is a one click instruction available for this.
  2. We then restarted at point 1. There are excellent instructions how to connect MQTT devices to Home Assistant, which can be found on Youtube:
  • MQTT is a good starting point for HA. Swiss biker Reto Roelli published a Rasperri PI which sends ANT+ sensor data to an MQTT broker (legally protected code, adapted probably from Andreas Bader PhD. for MQTT). Someone already connected a ANT+ MQTT device to Home Assistant, and described the result in the Trainer Road forum.
  • Once the sensors are connected to Home Assistant, it should be possible to visualize the data there. There is also a HA integration for InfluxDB, which sends data from HA to InfluxDB.
  • OpenBCI has a LabStreamingLayer Interface. Sensor data can be streamed from OpenBCI over LSL to Python via a Python LSL, and from there to InfluxDB with the Python client for InfluxDB.
  • Bitalino biomedical has LSL support, the same procedure as described above can be made with Bitalino devices.
  • Alexandre Barachant developed the Muse LSL to stream Muse data, so what is discussed here can also be done with the Muse headband.
  • Finally we have all our sensor data in a single InfluxDB which are synched in time, if anything works correct. The software described here runs on a mobile Windows 10 LattePanda Platform, for instance. It does not run on a Rasperri Pi. LSL Python does not run on ARM based platforms. Therefore, the LattePanda is an excellent mobile platform to acquire sensor data and process data in Python. It is not much bigger than a Rasperrri PI has a non-ARM based processor and runs Windows 10.
  • Is this device not better than carrying around a Laptop with Matlab Standard Edition?
  • Ok. we can choose a powerful LattePanda with 4 GB to run Matlab on it, but with the device described here, we can save the costs for a Licence for a Matlab Standard Edition, which is about 1000 USD, without Matlab Toolboxes, some of them cost extra and are expensive. Matlab Home is about 200 USD, but we are not allowed to use Matlab Home to publish data in a scientific journal.

Warning:

Let us avoid if possible Home Assistant and LabStreamingLayer, if we want a mobile platform. Both run better on x86 platforms, and x86 is partly required. Let us choose InfluxDB and MQTT instead: