RideThru transforms a dull stationary bike workout into a virtual reality experience that makes exercising fun. Combining sensors, a spin bike, and an Oculus Rift, a user can experience virtual terrains and live video game action all while working out.
This project was completed for the class 18549: Embedded Systems Design Capstone.
Stationary bikes are a very popular indoor exercise choice. Many people prefer outdoor biking, but due to weather, busy schedules, or other reasons, staionary bike exercises become the next best workout. The predominant issue with stationary bikes is that they are extremely boring since you do not actually move anywhere.
If people don't enjoy working out, they are less likely to continue working out. RideThru makes stationary biking fun and allows users to play games or ride through new terrains in virtual reality. Ultimately, this encourages people to stay healthy and active as much as possible.
The first step was to create a written proposal which defined our necessary specs, project requirements, architecture, and parts list.
The proposal document can be found here and has been updated to include lessons learned.
Our final architecture consisted of two major components:
The physical sensors and PCB on the stationary bike
Reed Switch Sensor to calculate user RPM
PS2 Handlebars to allow user to turn and use in-game buttons
DC Variable-Speed Fan that responds to in-game actions
Microcontroller (PCB) handles communcation b/w hardware components and game
The virtual reality experience using Unity3D and the Oculus Rift
Processing application that acts as driver to enable communication between PCB and Unity3D
Unity3D: Mario Kart style racing game
Oculus Rift to render an immersive 3D experience
In order to determine the user's RPM (Rotations per Minute), we placed a reed switch sensor on the bike frame and a small magnet on the wheel. The switch in the sensor is normally open (0), but when the magnetic field is present the switch is closed (1). We implemented AVR code to detect this via interrupt handling and to calculate user RPM every 5 seconds.
We mounted a PS2 Yamaha controller onto our stationary bike. We seperated the wires in the traditional tubing and attached them to pins on our PCB. Building from an open source library for controlling PS2 controllers via an arduino, we developed code for reading controls and commands from the Yamaha controller.
DC Variable-Speed Fan
In order to create a fully immersive user experience, we developed a fan which responds to the user's RPM in real-time. The faster the user pedals, the harder the fan blows. We built a laser cut mount for the fan to ensure user safety and implemented the functionality to control fan speed via PWM (Pulse width modulation).
After researching the necessary schematics that we would need to run all of our sensors, we began designing the PCB. We went through many iterations of the design and settled on a schematic that included all of our required features plus the ability to add motor-controlled bike resistance in the future. The PCB design was done using CadSoft EAGLE PCB Design Software. Finally, we soldered all of the necessary components onto the PCB and connected it to our 3 sensors on the bike.
Processing + Unity3D
For the game development side of the project, we designed our game using Unity combined with OculusUnityIntegration. Initially, we built a racing game using a traditional car, but during user testing we discovered that the physics behind a traditional car in Unity made it very hard to control.
We found that using a kart style physics engine and movement was much more natural to the bike and Yamaha controller style of turning. Finally, we combined the kart style racing game with a more realistic environment to create an immersive experience for the users.
We handled communication with the PCB by building an application in Processing that would allow our Unity game to communicate with the PCB over serial communication. This driver mimics keyboard presses which allows our stationary bike to work for any game in Unity.
Putting it all together