In collaboration with OYM, Atticode GmbH developed an edge device solution that seamlessly transmits fitness data to the cloud using MQTT, Golang, and Microsoft Azure. A modular system for an efficient, flexible, and scalable fitness experience.
It's a well-known challenge in digitization and not easy to overcome: analog components from third-party manufacturers! If these are an integral part of the workflow or service offering, they must either be replaced or somehow made "digital-capable".
Many fitness studios face this specific problem when they want to offer comprehensive digital solutions such as fitness apps for measuring and managing training sessions and calorie control, and so on. This is because many fitness devices are either completely analog or, while digital, lack any interfaces for extracting data. For those digitized devices that do have interfaces, these interfaces are often not equipped with an open standard, barely documented, and must be reverse-engineered painstakingly. Also, the device manufacturers are not always helpful or cooperative when it comes to querying data from their fitness hardware. All of this makes it extremely challenging for studio operators to develop a well-integrated digital solution for their fitness customers, especially when they have a heterogeneous mix of devices from different manufacturers. Nevertheless, there is indeed a possibility for studios to integrate their device fleet into their own data network with some effort.
One of the studio operators who embarked on this journey with Atticode is OYM (On Your Marks). In addition to various sports facilities for professional athletes, OYM has a comprehensive athletic hall that allows training of all body parts and muscle building. For those devices with accessible interfaces, we had planned to read out measurement, health, or sports data such as rotations per minute, speed, heart rate, or calorie burning, etc. The majority of fitness equipment should thus be digitized and connected to the customer's data network. Our planned target hardware included brands such as Wattbike, Concept2, Woodway, Assault, Precor, and Cycle.
When we speak simplistically of "connecting" or "feeding into the data network", something more complex is actually meant. Behind this simplified statement lies the multifaceted process of reading data from the devices, "preparing" the data into a uniform format on intervening hardware, and sending it to the cloud server or the responsible data broker. In the context of data preparation, an initial step is data normalization, i.e., standardization of the data. This process often involves removing erroneous or incorrect data points, correcting formatting issues, generally adjusting units, specifically units of measurement, standardizing variables, and preparing the data for consistent analysis and processing.
Microsoft Azure was chosen as the cloud service from the outset, as the customer had already successfully implemented other infrastructure projects with it, and Azure IoT Hub provided optimal server-side support for this case. Thus, it was planned to rely entirely on the Azure Cloud for the backend, and all central systems were to be integrated into the Microsoft ecosystem.
Solution Search & Technical Evaluation
So, how can the measured sports data from the fitness equipment be efficiently transmitted to the cloud? The optimal solution is simple but somewhat labor-intensive and is called an "Edge Device": An edge device is a physical unit, usually a computer or an IoT device, that processes and analyzes data near its source of origin. This approach minimizes latency since less data needs to be transmitted over the network. Edge devices are typically used in distributed networks to enable real-time processing and decision-making.
This concept finds broad application in various industries, whether it is for digitizing analog systems for environmental data capture or for process monitoring in factories. In the present case, this simply means that each of our fitness devices needs to be assigned a special microcomputer. Depending on the available interface types of each device, the most efficient communication method is selected and connected to the edge device. The latter is configured to support the chosen connection method and correctly capture the data from the respective fitness device.
Naturally, the choice fell on the Raspberry Pi as the edge device: it stands out for its cost-effective procurement, widespread use, excellent programmability, as well as easy maintenance and interchangeability. Moreover, it is equipped with the necessary basic components, including USB ports, Bluetooth, Wi-Fi, and RJ45. Two different variants were used, depending on requirements: the powerful Raspberry Pi 4 and the compact Raspberry Pi Zero.
The possible connection types to the fitness devices could all be accommodated with the Raspberry Pi. In some cases, adding a USB dongle was necessary, e.g., for ANT+ to establish the connection. The following connection types had to be supported:
- USB (Cable): Direct connection via a USB cable provided reliable and stable communication.
- RJ45 (Cable): Using an Ethernet network cable offered a robust way for fast data transfer.
- RS232 Serial Port (Cable): Utilizing the RS232 ports enabled communication via serial interfaces, suitable for specific fitness devices that offered only this type of data transmission.
- Bluetooth Dongle: A wireless technology for communication between devices in close proximity.
- ANT or ANT+ Dongle: With a special USB dongle for ANT or ANT+, it was possible to establish a wireless connection to fitness devices.
Thanks to the diverse support for these connection types, the Raspberry Pi solution seamlessly interacted with a wide range of fitness devices, creating a flexible and adaptable overall system. To avoid complex cable routing and simplify the positioning of the Raspberry Pis, we preferred to use wireless technologies.
The technical implementation of this project involved a series of custom software implementations and technologies that, in a sophisticated combination, allowed for a seamless flow of fitness data from the devices to Azure Cloud services.
For querying, normalizing, and processing fitness data, as well as transmitting it to Azure Cloud, an edge client was developed in Golang. This edge client played a crucial role in data processing before forwarding. The uniqueness of the architecture of this edge client was its modular structure: Depending on the fitness device, various types of connectors, sensors, and associated drivers could be dynamically combined at deployment time. This allowed the configuration of the appropriate combination of modules for each existing fitness device. This approach allowed flexibility and scalability since new devices could be easily added.
The principles of Golang, such as language simplicity, support for concurrency, and a focus on efficiency, make it an excellent choice for a variety of software projects. In this context, Golang (also known as Go) was chosen for developing the edge client due to its versatile features and technical advantages. It excels in terms of performance, speed, and runtime stability. These aspects are particularly important when it comes to smooth and fast real-time collection and processing of fitness data. The modular structure of the edge client, which could dynamically combine different connectors, sensors, and drivers depending on the fitness devices, was easily implemented using Golang. The flexibility of this language allowed us to quickly and effectively meet different requirements and link various components together. This proved to be extremely advantageous for seamlessly integrating both existing and future fitness devices into the ecosystem.
As the communication protocol between the edge devices and Azure Cloud, MQTT was selected. MQTT (Message Queuing Telemetry Transport) is a lightweight protocol that is excellent for IoT applications. It enables reliable and efficient message transmission, ensuring the safe and effective transport of fitness data. MQTT is based on the Publish-Subscribe model, where edge devices act as publishers sending data, while Azure Cloud acts as the subscriber receiving and processing the data.
To simplify the configuration of the edge devices, Docker was used to create specific IoT images for these devices. Azure IoT also played a crucial role by allowing the deployment of the developed modules on the edge devices. By specifying the device ID, the appropriate "module" can be easily deployed on the corresponding edge device. Additionally, all relevant parameters and configurations, including fitness device type, telemetry, and sensor data, are directly transmitted to the device. This approach enables a fully automated and efficient configuration and deployment pipeline for the edge devices.
The project utilizes a range of Azure services that seamlessly integrate to create a powerful and scalable solution. These include Azure Cloud itself, Azure IoT Hub for device communication management, Azure App Service for application deployment, Azure Functions for serverless data processing, Azure Synapse DB for data analysis and reporting, and Azure Data Lake for storing and managing very large data volumes. The Azure IoT Hub Device Provisioning Service (DPS) played a crucial role in scaling IoT devices by enabling automated device provisioning.
The OYM dashboard serves the purpose of displaying live sports data on a display directly in the gym. It opens the opportunity for any number of Wattbikes, rowing machines, and other devices to participate in a competitive tournament. Active devices are automatically displayed on the dashboard for seamless competition participation.
Technically, the process works as follows: The Typescript client of the dashboard connects to the Azure Event Hub via Microsoft's SignalR WebSocket implementation. This connection enables efficient streaming of extensive datasets—so-called Big Data streaming—to the custom-developed web service that communicates with the dashboard. In this setup, the Azure Event Hub acts as the central hub that receives incoming sports data from active devices and forwards it to the dashboard client.
This architecture enables smooth and fast communication between the various sports devices and the dashboard. Fitness data is captured, transmitted, processed, and visually presented in real-time. This creates an interactive online competition environment that provides participants with a lively and engaging experience and drives them to peak performance!
Overall, the combination of the aforementioned technologies and Azure services created a robust and efficient system for capturing, processing, analyzing, and visualizing fitness data from various devices, enabling the implementation of a solid data streaming pipeline in the health and fitness domain.
The choice of technologies proved to be highly successful: the combination of MQTT, Golang, and fitness device interfaces, as well as Azure services, could be seamlessly integrated into the project. Managing configurations and deploying edge devices requires minimal effort as this process is largely automated.
In a holistic view, data collection and analysis become a seamless process that can be effortlessly handled and persisted thanks to the use of Azure Synapse and Data Lake. The combination of all technologies used enables effective processing and analysis of the collected data, allowing valuable insights to be gained. Overall, the chosen technologies not only harmonize efficiently with each other but also provide a solid foundation for the current and future project requirements.
Maintenance and opportunities for further development, especially the integration of additional fitness device models with new sensor drivers in the Golang edge client, are easily achievable without significant effort. However, larger challenges could arise from changes in the Azure environment, which could necessitate updates in the rest of the service stack.
For companies facing similar requirements or challenges in the area of digitizing fitness devices, measurement stations, or process monitoring, we are happy to offer our support. Our expertise and tailored solutions can help you tackle your challenges. Contact us to discuss your concerns and find an appropriate, innovative solution together.