GITLAB Repository https://gitlab.com/bathhack26-group/bathhack26-project

Inspiration

Better Bike is a smart cycling system that helps riders stay safe and navigate more easily. Our helmet detects sudden movements like swerving or braking and alerts the rider immediately. The app also analyses data from previous rides, including the rider’s own experiences and any hazards they encountered, to suggest safer paths for future journeys. This personalised feedback helps users avoid potential accidents while learning from their own cycling patterns. The system is designed to give information in ways that do not distract the rider, keeping their focus on the road while staying aware of hazards.

What it does

Better Bike is a smart cycling system that helps riders stay safe and navigate more easily. Our helmet detects sudden movements like swerving or braking and alerts the rider immediately. The app analyses data from previous rides, including the rider’s own experiences and any hazards they encountered, to suggest safer paths for future journeys. Riders can review their ride afterward and remove any incidents they do not want to log, ensuring that only relevant hazards influence route calculations. This personalised feedback helps users avoid potential accidents while learning from their own cycling patterns. The system is designed to give information in ways that do not distract the rider, keeping their focus on the road while staying aware of hazards.

How we built it

Better Bike combines hardware and software to create a smart, responsive cycling experience. On the hardware side, we used an IMU sensor integrated into the helmet to detect sudden movements such as swerves, hard braking, and falls. The IMU data is processed in real time using a Madgwick filter to accurately calculate orientation, and thresholds are set to identify potentially dangerous events. When an incident occurs, the helmet triggers alerts and logs the event for later review.

On the software side, we developed a backend in Python using Flask to calculate safe cycling routes. The system loads logged incidents and uses a clustering algorithm to identify danger zones. It then queries OSRM for route generation, avoiding these areas whenever possible. The frontend is a dynamic web interface using Leaflet.js to display the route, danger zones, and unavoidable hazards on an interactive map. Riders can review their rides in a Tkinter GUI, visualising events along the route and removing incidents that they do not want to influence future route calculations.

Challenges we ran into

One of the main challenges was making the IMU data reliable. Normal cycling movements, bumps, or vibrations could sometimes trigger false positives, so we had to carefully tune thresholds and cooldown periods to accurately detect falls, hard braking, and swerves. Another challenge was handling route calculations around multiple clustered incidents, especially when some hazards were unavoidable, while still providing a clear and efficient path. We also faced challenges with the ride review interface, ensuring riders could remove incidents without breaking the route map or recalculation logic

Accomplishments that we're proud of

We are proud of creating a fully functional system that combines real-time sensor detection, route planning, and a post-ride review interface. The helmet reliably detects falls, hard braking, and swerves while allowing riders to review their trips and remove incidents that shouldn’t affect future routes. We successfully implemented automatic clustering of danger zones and route recalculation to suggest safer paths, as well as a responsive map interface that clearly shows unavoidable hazards. Integrating live sensor data with the backend and visualising it in a user-friendly GUI was a complex task, and seeing it all work together in a seamless way was a huge achievement.

What we learned

Through this project, we learned how challenging it is to process real-world sensor data and differentiate meaningful events from noise. We gained experience in combining multiple technologies, from Python and Flask for backend processing, to Leaflet for mapping, and Tkinter for interactive review tools. We also learned about clustering algorithms, route optimisation, and creating thread-safe, responsive applications that handle real-time inputs. Importantly, we discovered the value of user feedback in shaping safer cycling routes and how small design choices, like allowing incident removal, can greatly improve user trust and engagement.

What's next for Better Bike

Looking ahead, we want to add a community aspect where riders can report dangerous areas in real time, similar to how Waze allows drivers to share hazards. The helmet would vibrate to warn riders of these reported dangers, giving them advanced notice without needing to look at a screen. The app will also use user feedback from previous rides to suggest safer routes, continually learning and improving the paths it recommends. Adding a frequency-scoring feature would also improve the realism of the routing by prioritising areas with fewer repeated incidents and giving more accurate guidance based on how often dangers occur.

We are also exploring an RFID feature where the helmet can unlock the bike, verifying that it is the rider who is moving it. This means that when the bike is moved, it does not trigger an alert if it is the authorised user, improving security and reducing false alarms. This feature also encourages riders to wear their helmets consistently, reinforcing safety habits while adding a convenient and personalised way to access their bike.

Finally, we want to explore adding speakers to the helmet that provide directions verbally so riders do not have to use a phone or wear headphones. Together, these features aim to make cycling safer, smarter, and more user-friendly.

Built With

Share this project:

Updates