Mountain Bike Data Logger




​
Reason for Project
​
Continuing on from my STM32F4 Library, as part of my quest to learn embedded software, I wanted to apply my skills to a real world project and get experience writing application level code. It was important to me that the project I chose cover a range of embedded topics but also be something I could use. As a result I chose to make a data logging system for my mountain bike.
​
The general idea is I could collect information from my bike and use that to gain a better understanding of how I ride and my bike setup. From a software perspective I could learn how to handle large amounts of data, manage and schedule tasks, and interface with a user. From a mountain biking perspective I could observe how my suspension is behaving and how I'm using the bike. Recording and analyzing data is not necessarily needed to understand how to set up a bike, however I went with this method for the sake of learning new skills.
​
My goal for this project was to simply collect and observe data as opposed to doing an in-depth analysis of it. Doing analysis would help to make sense of the data but I felt the potential benefits I could gain were outweighed by the time and energy I'd need to invest into it. Using the raw data and some basic interpretation would still allow me to observe the following:
-
Geographical location
-
Ground speed
-
Suspension position
-
Bike orientation
​
However, if a proper analysis was to be done, a list of things that could be determined include:
-
Dynamic sag - average suspension position while riding.
-
Bike balance - front vs rear axle compression distance and rate.
-
Grade - how steep the trail is.
-
Time spent not in contact with the ground
-
Impact force - how hard the bike makes contact with various obstacles.
​
Knowing these things could help me make adjustments to my suspension setup, such as air pressure or compression and rebound settings, but as mentioned before, collecting data is not strictly necessary in order to set up a bike the way you need it.
​​
Design and Build
​
The data logger was designed to fit entirely on my bike and be as non-invasive as possible. The system consists of a main enclosure mounted where the water bottle normally goes, user controls placed on the handle bars, and sensors placed at different points on the bike. The main enclosure houses an STM32F4, GPS, IMU, SD card, screen, Bluetooth module, and one 12V 1500 mAh battery along with some power distribution and circuit protection. The user controls consist of buttons to navigate the system and LEDs for visual feedback. Rotary potentiometers are mounted in such as way to determine the front and rear suspension position/travel and a Hall Effect sensor is mounted to the fork to record wheel RPM. All sensors are wired back to the main enclosure.
​
While riding, the bike moves quickly to accommodate changing terrain. This means that to properly capture the bikes movement, data must be collected at a high frequency. It must also be captured at known intervals to understand how the data changes in time. The system software is designed to collect and record raw sensor data on a predefined schedule. Due to the high volume of data and speed at which data is recorded, any interpretation is left for post processing. Using this collection method and the setup described above, the system is able to record suspension position, wheel speed, geographical location, acceleration, and points of interest on the trail (input via user controls). For each data logging session, a log file is created on the SD card where all data gets compiled and stored for use later. System information such as suspension compression and rebound setting are saved internally and get included along with each log file to provide context for a data set. Using the onboard Bluetooth module, the system can connect to an external device to update system information and offload data logs. The user is able to navigate all these actions using the buttons as input and the screen and LEDs for feedback.
​
Testing and Data Collection
​
Due to the rough nature of mountain biking, I was worried that I'd have issues with parts moving around or breaking while riding. After taking it out I realized the setup was quite solid and it didn't affect my ability to ride too much. I was also concerned about the quality of the data I'd be able to collect but after getting some samples I was happy with the results I was seeing. Front and rear suspension travel, wheel RPM and GPS location were all recorded quite well. Acceleration recorded from the IMU was good, however it was hard to draw conclusions from the dataset due how much the IMU bounces around while riding. This made it difficult to discern the orientation of the bike throughout the ride as well as notable points of impact.
​
During one of my rides with the system connected, I went off a drop and landed hard on the ground. This was normal behaviour from a biking perspective, however the impact with the ground bottomed out my rear suspension which in turn over rotated the rotary potentiometer I had connected to the shock through a linkage. The linkage rotated past 180 degrees during compression, so when the suspension rebounded the linkage continued to rotate in the same direction instead of back the way it came. This resulted in the potentiometer reaching it's hard stop which then caused the mechanism to break. Luckily I was able to go back into the data log and observe the exact point at which this failure happened. At this point, I felt like the data logger had done what I wanted it to do and I didn't want to rebuild the system so I decided to end the project here. This wasn't exactly how I envisioned using the system to determine adjustments to my suspension setup, but it helped me figure that out nonetheless!
​
Conclusion
​
I enjoyed making this project and I learned a lot about writing software in the process. It was cool to be able to go back and visualize the paces I put my bike through while riding my local trails. As mentioned earlier, I wanted to do this project to gain more experience writing software, however I found a lot of time was consumed on the mechanical and electrical aspects of the build. Making everything compact enough to fit on my bike as well as designing parts to fit the odd shapes of the frame while still being robust and non-invasive was a big challenge. I'm happy with what I came up with but the final product was still far from ideal. Going downhill didn't have much of an affect on my ability to ride but I found that my legs would often bump into some of the parts while pedalling uphill. The main enclosure was also a bit heavier than I'd have liked it to be. Although I'm sure the software I wrote is far from ideal, the main areas of improvement for this project I could see going forward were in the mechanical and electrical build which was not my main focus. Because of this I didn't end up pursing the project any further.