Last Updated on January 21, 2023 by pg@petergamma.org
We described on our site a setup with three devices:
1. a balenaHealth Raspberri Pi with heart rate, MQTT, InfluxDB and MQTT
- From the Trainer Road Forum we know that it is possible to stream in sports sensor data from a Raspberri Pi over MQTT to Home Assistant.
- We do not want to have multiple InfluxDBs, but only a single one with all the sensors we are interested in. This is preferentially in Home Assistant.
- So many sports sensor devices are available. The Adafruit Pyloton has heart rate, speed, cadence. As far as we know most of the ANT+ sensors can be replaced by BLE sensors.
- It would be highly desirable to have all sports sensor data in one InfuxDB, for instance on a balenaHealth, with all the BLE sports sensors which are available, which can be synchronized to Home Assistant, where it can be exported to InfluxDB.
- We can choose the path over the balenaHealth to balenaCloud to Balena Home assistant. Eventually, we get support from balena.
1. Home Assistant Sensors on the LattePanda 1
- As soon as we have a sensor in Home Assistant, it is easy to export sensor data to InfuxDB.
- We do not want to develop new soft- and hardware, and leave everything as it is, if possible. We do not have the goal to modify any devices.
- We tested a Home Assistant image which can be flashed via balena etcher on a x486 Lattepanda. This image does allow an easy way to modify the home assistant .yaml file, a feature which is essential for developers.
- This Home Assistant LattePanda 1 has no user interface, we need to control it from a second device, or run it in a virtual box, but we do not want to create virtual boxes, if possible.
3. OpenBCI with Python and an InfluxDB client for Python on a LattePanda 2 (*1)
- We suggest to use OpenBCI with Python to be able to do create our own code for OpenBCI.
- We want store our OpenBCI sensor data in an InfluxDB.
- We can connect OpenBCI Python example of Harrison Kingsley with the InfluxDB client for Python, or connect OpenBCI GUI to Home Assistant or InfluxDB, or the OpenBCI WIFI shield.
- The OpenBCI GUI stores sensor data in a .csv, but we want the data in an InfluxDB, in a single InfluxDB synchronized with sensor data from other devices.
- With the InfluxDB client for Python we can read and write OpenBCI sensor data to and from whereever whe want to.
- In Python, there are many tools available to prossess for instance ECG data, for instance HeartPy, or EEG data, for instance MNE-Python.
- If we want only a single InfluxDB, we can connect two devices, for instance two LattePandas, one running OpenBCI software with Python on a LattePanda 2, with a LattePanda 2 running Home Assistant. We choose a LattePanda for EEG devices, since w do not know whether we sooner or later want to use Python Lab Streaming Layer, which requires an x86 processor, since it does not run on ARM based devices.
- We can connect LattePanda 1 with LattePanda 2 by an ethernet cable, and write data from OpenBCI with the OpenBCI Python InfluxDB client to the Home Assistant InfluxDB. We do not urgently need Lab Streaming Layer for OpenBCI, and we have the sensor data from all three sensor devices in a single InfluxDB.
- This setup is not easy, and we do not have any plans to make it real, soon. But we are convinced, that sooner or later, most BLE sports sensors, Home Assistant sensors, and OpenBCI sensors can be streamed into a single InfluxDB, and since the code for these devices can be found on GITHUB pages, coders will develop it further, and successor devices will be found on new GITHUB pages.
We can also connect balenaHealth to the balena cloud and the balena cloud to balena Home Assistant, which is experimental. Eventually we get support from balena for our project. The advantage is that we have a supported pathway.