Close
0%
0%

Exercise Bike to a Wireless Gamepad [ESP32]

Hacked an old exercise bike into a wireless gamepad using the ESP32 Microcontroller.

Similar projects worth following
The past few weeks I have been exercising a lot, here's why, I managed to hack my exercise bike into a wireless gamepad using the ESP32 Microcontroller.

Within the bike housing there is a magnetic switch present, by hooking up the two wires coming of magnetic switch to the ESP32 GPIOs we can get a pulse as we pedal. The faster we pedal more pulses are received, thus we can write a frequency counter program to figure out how fast we are pedaling. I have used a couple of metal pads as touch inputs for our gamepad.
The following library is then used to turn the ESP32 into a BLE Gamepad with our pedal and touchpads as inputs: https://github.com/lemmingDev/ESP32-BLE-Gamepad

Checkout the video below for a demo and a brief explanation of the build process.

The below video contains a demo and a brief description of the build process:

x-zip-compressed - 134.20 kB - 07/03/2022 at 15:53

Download

Standard Tesselated Geometry - 70.20 kB - 07/03/2022 at 15:53

Download

Standard Tesselated Geometry - 6.92 kB - 07/03/2022 at 15:53

Download

x-zip-compressed - 61.72 kB - 07/03/2022 at 15:53

Download

x-zip-compressed - 35.08 kB - 07/03/2022 at 15:53

Download

View all 25 files

  • 1 × ESP32 Developement Board.
  • 4 × TP233 Touch Modules
  • 4 × 47pF Ceramic Capacitors
  • 1 × 0.96 inch OLED Display
  • 1 × Wires

View all 6 components

  • 1
    Introduction

    Note that your exercise bike might be completely different from mine and the procedure might be a bit different but this tutorial should give you a rough idea on how it’s done. These instructions assume that you have basic knowledge on Arduino and electronics.

    Here’s a close look of the exercise bike.

    I have used the ESP32 microcontroller as it comes with Bluetooth and I wanted to turn my bike into a wireless gamepad,

    it is powered using a power bank and there’s an OLED display to show the distance pedalled as the built-in display isn’t working.

  • 2
    Using the exercise bike pedal as an input

    The first thing I wanted to do was to figure out how fast I was pedalling. So I took apart the bike’s display and found that there were 2 wires connecting the base of the bike to the bike’s display circuit. 

    The wire’s are probably connected to a magnetic switch.

    I connected these two wires parallel to the ESP32 assuming one was gnd and the other having some type of signal. 

    I then wrote a program in Arduino IDE to monitor the signal pin and got a square wave when pedaling. You can find the code here: https://ivthdimension.wordpress.com/portfolio/exercise-bike-hacked-into-a-wireless-gamepad/

    The faster I pedaled the more pulses I got, note that I had to pull the input HIGH to get a square wave.

    Thus we can figure out how fast we pedaled based on the number of pulses obtained in a second. 

    The distance can be computed by counting the total pulses. 

    Most exercise bike’s give an approximate distance value, as distance travelled on a bike is based on the bike’s wheel diameter and we do not have a wheel. You can find the code here: https://ivthdimension.wordpress.com/portfolio/exercise-bike-hacked-into-a-wireless-gamepad/

  • 3
    Using the exercise bike touch pad / buttons as inputs

    Now we need some buttons to interact with the game.

    My exercise bike came with these metal touch pads, they were originally used for the heart rate sensor. 

    But as the built in display wasn’t working, it isn’t possible to see the heart rate

    and so I decided to use them as gamepad buttons.

    The ESP32 comes with capacitive touch sensitive GPIO pins,  thus we could just hook up the metal touch pad to the specified GPIO pins and monitor if the touch pad is being touched or not. 

    But unfortunately when I used long parallel wires connecting the Touch pads to the GPIOs, I managed to get accidental presses, probably due to parasitic Capacitance.

    Touching one pad would result in two GPIO pins going high.

    Although sometimes this did work fine, I couldn’t get it work all the time and there were far too many accidental button presses.

    So I decided to use these TTP233 touch modules, although this made the wiring more complex it worked well.

    Note that I had to use a ceramic capacitor to adjust the touch sensitivity.

    You can find the code here: https://ivthdimension.wordpress.com/portfolio/exercise-bike-hacked-into-a-wireless-gamepad/

View all 7 instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates