If you like playing Grand Theft Auto, you’re pretty familiar with squeezing the triggers for accelerating and braking while driving around. [David Programa] decided this was too easy, and instead developed a system to allow him to pedal his way around the virtual world.
The device relies on a flywheel-based exercise bike, with six magnets placed on the flywheel that triggers a reed switch six times per rotation. The extra magnets give the system better resolution at slow speeds. A Hall Effect sensor would be a more reliable way to build this to survive in the long term, but the reed switch does work. It’s paired with a debounce circuit to keep the output clean. A Raspberry Pi is pressed into service, running a Python program to read a GPIO pin activated by the reed switch, counting pulses to determine the speed of pedalling.
The trigger control used in the Xbox 360 controller is a potentiometer that creates varying voltages depending on its position, allowing it to act as an analog accelerator input. 0 volts corresponds to no input, while the trigger reads 3.3 volts when fully depressed. The Raspberry Pi emulates this with its PWM output, paired with a low-pass filter to create the relevant voltage to inject into the trigger input on a generic Xbox 360 controller.
While it’s a lot less practical than simply using a regular controller, the pedal controls do allow you to get a great workout while playing Grand Theft Auto. Some of the more intense chase missions should be a great way to get your heart rate up, and that’s got to be a good thing.
Ironically, though, the system only works for cars and motorbikes in game. The bicycles in Grand Theft Auto are controlled by mashing the A button instead. Alternatively, you might consider a similar system for playing Mario Kart on the Nintendo Switch. Video after the break.
[Thanks to Zane Atkins for the tip!]
I think it would be easier to just get a small DC motor with a rubber wheel and rest it against the flywheel. Add a capacitor and a potentiometer to smooth and adjust the voltage. No meed for a microcontroller or any coding.
David Programa here. Certainly it would be an easier solution, but I’m a programmer (and a newbie in electronics) and that’s the way I could better adjust rates, voltages and so on. I agree that this solution is overkill… I made it some years ago, nowadays I would have used the cheapest Arduino I could find ;-)
Since a Pi is the middle man here I’m sure it should be easy enough to make some interface that lets the user toggle the action of the Pi to mash said A button while riding the bike. I picture a simple web interface with a toggle button, and perhaps some slider controls to adjust the sensitivity of things to match the users ability to peddle. :-)
David Programa here. Since I am using stereo female jacks and cable, I could relay the reed switch passes directly to the gamepad (thru the unused wire, the R channel), remove the A button and maybe simulate the switch using a transistor or something. I could have a physical switch for choosing the mode… an exercise for the future.
It’s insane that VR+google street view is still not wide spread :S
It has taken some time indeed, but Virzoom on Oculus, which does exactly that, is seeing an enormous jump in popularity these days.
It is quite easy to use a similar setup to replace gas/brake pedals connected to a PC racing wheel. I use two Hall sensors (two so the direction can be detected for braking) with eight magnets on the bike crank (wheel is not responsive enough due to inertia). A microcontroller converts the rotation speed to inputs for a digital potentiometer connected to the wheel. First I used Arduino, now it is ESP32, as it also works as Bluetooth bike sensor which can provide input for various training apps on my phone.
David Programa here! Thanks for featuring my work. Feel free to ask me anything here or in the video comments. Cheers!
https://www.gtbikev.com/
Guess the author has never heard of GTA Bike https://www.gtbikev.com/
And losing the pleasure of building the device myself? Never!
Yeah that’s great you were able hack this and would be a good option for others who do not want to buy a smart trainer. I wonder if you could hook up with the current dev’s of gta bike There is a Facebook group that the users and devs are on https://www.facebook.com/groups/1089053124812221/