For exercises such as running and cycling, power output provides an unbiased metric for effort as compared to, for example, speed, irrespective of external conditions, such as wind and terrain.
Power output is a widely used and well-defined metric in cycling. For power based training Functional Threshold Power (FTP), the highest sustainable power output of a cyclist over a period of 60 minutes, is first determined. The power training routine then consists of periods in predefined ‘power zones’ that are based on a cyclist’s FTP. Cycling power is typically measured with strain gauges at the crank.
For running, however, there’s no agreed way to measure power output. Of course, it can be measured with force plates on a treadmill, but it’s not a viable option for running on a track. There are multiple techniques of measuring running power, one of which is Stryd, that estimates power using an accelerometer mounted on top of a foot. Their technology is proprietary, but there is a proposed model for power measurements, External Energy Summation Approach (EESA), that is described by Ron George, and that seem to align well, with the results obtained from the Stryd power meter.
EESA is a comprehensive model that can approximate running power and how it changes over time, accounting for different conditions. Eventually, we would like to implement this model and perform such running power measurements, however, as a first exercise, we will only measure total work done (and hence average power) against external forces on a straight path with a much simpler model.
Hardware-wise we are using Arduino Nano IoT that will measure the acceleration and send it over Bluetooth Low Energy (BLE) to an Android smartphone.
Accessing and sending the IMU data
First, we need a way to record the acceleration. The Arduino Nano IoT has LSM6DS3 IMU (Inertial Measurement Unit) on board, providing acceleration and angular velocity via a library. With the default output data rate of 104 Hz, we can poll the IMU for measurements every 10 milliseconds using this code
In this code we use the variable reading that is defined as follows
- Firstly, we define a structure to store three components of a vector.
- Secondly, we define a structure to hold time of the reading (the internal clock is used), and two vectors for acceleration and angular velocity.
- Finally, we build a union of this struct with a byte array of the same size (that is needed for serialisation before sending via Bluetooth), which is then filled in with actual data within pollIMU function.
In order to collect the readings with the smartphone we will send the data over Bluetooth Low Energy (BLE) using the Arduino BLE library as follows:
- Define a BLE service (the UUID is arbitrary, and is used to filter for BLE devices that provide certain functionality)
- Define a BLE characteristic. This can be thought of as a register, that can hold some value, and allows some actions to be performed by a central device (the smartphone in this case). For our purposes, we define a characteristic of size of our record, that can be read and subscribed for update notification.
- Wait for a central device to connect, and update the characteristic value in pollIMU function while connection is maintained
The results can now be subscribed for, collected and stored with any BLE capable device. The full Arduino code and the accompanying Android app are available on Github.
Even though we cannot perform measurements done by Stryd straight away, we can still approximate the work done from accelerometer data against external forces, with a few assumptions. Firstly, we assume that we are walking in a straight line; that way we only have to consider forces in one direction. And secondly, we assume that our speed is constant in the duration of a walk.
Work done for a straight path can simply be defined as an integral of a force F over displacement s. F in this case is a force vector in the direction of the walk (work done in two other orthogonal directions is assumed to be zero). By the second law, we know that F=ma, where m is a mass of a body, and a is an acceleration vector in the desired direction. For this experiment we simply measure out the path of 4.5 metres, mount the power metre on the chest, and walk trying to maintain speed. After the recording is done, we can analyse the results in a Jupyter Notebook.
As a calibration step we estimate and subtract the gravity vector. Even though it is not strictly necessary if we know the exact direction we are walking at, as those vectors are supposed to be orthogonal, we only have the approximate direction (due to imprecise positioning of the sensor on the body).
To estimate it, we take a few seconds of standing still before walking when the only acceleration measured should be the gravity and take the mean average of that.
Estimate work done
With the resulting acceleration readings we can estimate how much work has been done. From here on we assume that the direction of the walk is -Z. Remembering our assumption of constant speed and known overall displacement, we calculate the work done and the average power as follows
To validate that our results are reasonable, we have also recorded acceleration with a built-in accelerometer of an Android phone. Straight away we can see that even though the exact values are different, the overall pattern is similar. The differences can be partially accounted for by the lower sampling rate of the Android accelerometre.
Performing the same calculations on this data yields similar results with only about 1 Watt of difference.
Even though the estimate of work with the current approach is reasonable, there are multiple limitations that need to be addressed.
First of all, we try to position the sensor such that -Z axis aligns with the path, but it is not perfect. There does not seem to be an obvious solution to calibrate for walking direction in a similar way we calibrated for the direction of the gravity. This results in the work done being underestimated (since work done in two other orthogonal directions is not exactly zero).
Secondly, this model will not account for turning, as we only consider work to be done along single axis.
Both of this limitations can be mitigated if we employ the EESA model suggested by Ron George. However, it requires the instant velocity to be estimated from acceleration. Where we come to our third limitation, imprecise measurements. Trying to integrate acceleration over time we get increasing velocity, whereas we expect the velocity to come back to zero at the end of the walk.
For the same reason (lack of instant velocity measurements), we cannot estimate instant power in a way Stryd does it. Therefore, this needs to be considered as the most important issue, the solution for which is yet to be found (be it some signal processing required, or use of a different sensor).
This is an on-going project, and there more things to come, but for now, we encourage everyone interested to see the current implementation, and try it out for themselves, on Github, that hosts the code for Arduino, Android app, and notebooks with analysis performed (along with some sample data).