Tracking Health and Fitness with SmartGym
From May to August 2022, I was privileged to be a software engineer intern in GovTech’s Sensors and Internet of Things (SIOT) SmartGym team. Previously, I worked mostly on data analytics projects and this was my first software engineering project, where I had to work with IoT, mobile app development and data. My main focus during this internship was to work on the Blood Pressure Monitor project (BPM), continuing from where Aveek and HengKai left off during their internships. I also worked on Impact Analysis, a data analysis exploratory project.
Find out more about SmartGym here!
BPM
The main objective of the BPM is to provide easy tracking and recording of a senior’s blood pressure measurements. With the prototype created by Aveek and some of the backend services created by HengKai, I continued to work on the project to integrate BPM into the SmartGym backend and mobile app, and get it ready to be deployed.
During this internship, I worked on completing the data flow from sensors to backend and to the frontend mobile app. Various backend services were added to save the blood pressure readings to the SmartGym backend database tagged to the user account, and to retrieve this data on the frontend mobile app. A schema for the BPM data was also created to include the respective readings data in a structured format from the raw sensor data collected. The data could then be saved and displayed on the frontend app after the user completes a measurement.
To complete the dataflow for BPM, I worked on the frontend mobile app using Flutter to create new pages as part of the user flow. With the new pages created, users are now able to see their readings on the mobile app after they record it with the BPM. The BPM readings are also part of the kiosk, where users can login and view all their past workout data and body metrics measurements, which now also includes the BPM readings.
Users are also able to view their historical records of the blood pressure readings in the form of graphs. They will be able to view the trend for individual measurements to better keep track of their blood pressure.
I was fortunate to be part of two exhibitions (Digital For Life 2022 @ Suntec & Health District Pop-Up Exhibition @ Queenstown) throughout my internship, where I interacted with users who used the BPM. With their feedback, I made various changes to the frontend mobile app before arriving at the final version of the frontend design. Since BPM is designed to be used for seniors, it is important to understand more about their interactions with the system to identify possible gaps in the implementation.
In addition, the backend service is also hosted on a cloud platform through Consul, which allows it to run automatically once the raspberry pi is connected to the network. The blood pressure readings will be sent to the backend without having to manually run a script, which makes the project one step closer to becoming deployable.
Impact Analysis
The Impact Analysis project aims to provide the number of steps a user takes while working out on the treadmill using the sensors mounted on the treadmills used for other SmartGym projects. Inertial Measurement Unit (IMU) data was collected and analysed to explore the possibilities of providing real time step count using the sensors.
This was my first time working with IMU sensors, and the raw data had a lot of noise that had to be cleaned up before visualisation and data analysis. The main steps taken were to set up the IMU sensor to collect suitable data using the Raspberry Pi Sense Hat, and choosing the best data to use, before optimising the data collection frequency to increase the accuracy of the step counting. I obtained various datasets with the help of the SmartGym team, who walked and ran on the treadmill to get data with different weights, cadences, and speeds.
I used functions from the Python library SciPy which had various filters that were tested with the dataset in order to get a filter that works best for most of the datasets collected. Data from another IMU sensor from Shimmer was also collected by mounting it on the treadmill, which were of similar data collection frequency, but had less noise to filter. I was able to produce fairly accurate step counting using the Shimmer data (average 95% accuracy), but the accuracy was lower for the Sense Hat data due to the quality of data collected. Sense Hat data were much harder to work with as the data did not contain very clear peaks (used to identify steps) in the magnitude.
Since it was an exploratory project, I tried different ways to filter the data instead of a low pass filter to filter out the noise from the treadmill, and fine-tuned the range for the two different sensors. While more could be done to improve the quality of data from the Sense Hat, I was happy to be able to get a working filter that gave a good result in step counting.
Takeaways
I definitely enjoyed the working environment in SmartGym and I was lucky to be able to go to the office to interact with the team, as the COVID measures were eased when my internship started, allowing me to have many fun moments in the office with the rest of the team. There were many learning opportunities and I was able to witness my project being deployed to production, which was very rewarding. Do join GovTech’s SIOT if you are keen to learn more about software engineering and work with sensors!