Exercise Bike Controller

Parts List

Teensy 2.0 Microcontroller – US$19Teensy 2.0 Microcontroller

Teensy 2.0 uses 5v logic, so is easier to use with a rotary encoder that requires 5-20v.
Official Store – PJRC
 – US$19
Australian Stockist – Little Bird – AU$29

Rotary Encoder – $16Encoder 01

6mm shaft rotary encoder, ~360-400 Pulse/Rotation.
Amazon.com – US$16
Ebay Australia – AU$15

3D Printed Parts

Three parts are required: Encoder Gear, Crank Gear, and Encoder Bracket. All are available on Thingiverse.

Encoder Gear 3D print preview

Other Parts

  • Exercise Bike (or other rotation-based exercise equipment)
  • Game Controller (or Keyboard/Mouse)
  • Long releasable cable ties/velcro ties/tape to attach bracket to equipment
  • Long USB cable (optional)
  • Long headphone cable (optional)

Software

PC: x360ce (free)
Mac: ControllerMate (US$25)
Teensy Code: Exercise-Bike-Controller on Github

Construction

  1. Print all 3 parts
  2. Attach printed Encoder Gear to the encoder shaft
  3. Remove bike casing and the pedal on the opposite side to the drive belt
  4. Screw printed pedal gear on to crank, and then put pedal back on
  5. Connect encoder to Teensy, either solder pins directly or using a breadboard:
    Red Wire (Pulse): Pin D0
    Green Wire (Pulse): Pin D1
    White Wire (+5V): Pin VCC
    Black Wire (Ground): Pin GND
  6. Use Encoder Bracket and cable ties to attach the encoder to bike frame, so the gears mesh together. Cable ties allowed me to adjust the encoder position to ensure the gears weren’t pressed together too hard
  7. Use some more cable ties/velcro to keep cables away from moving parts
  8. Plug Teensy into your computer with long USB cable

Configuring Software

  1. Teensy – First follow the official TeensyDuino tutorials to get set up and ensure Teensy 2.0 is working correctly
  2. Download the Exercise_Bike_Controller arduino sketch from Github and open in Arduino software
  3. Upload the sketch to Teensy, open Serial Monitor and test that the encoder values are changing when the crank moves
  4. Test your maximum pedalling speed outputs a value of +512, increase or decrease the “speedMultiplier” variable (line 17) if you’d like to pedal faster or slower to output full speed on your controller
  5. Once you’re happy with your pedalling speed, change the “readDelay” variable (line 20) to 5, to make the controller latency faster

PC – x360ce

Connect Teensy and Xbox Controller (or other controller). Copy x360ce into game location (for Rocket League this is: /Program Files (x86)/Steam/steamapps/common/rocketleague/Binaries/Win32/)
When playing without exercise controller, you need to temporarily remove the xinput1_3.dll file, or the game won’t start correctly.

Configuration:

Controller 1: Xbox
Triggers Off (for throttle. remove trigger axis)
Advanced:
Pass through: Off
Combine this controller: Combine into: One
Controller 2: Teensy
IHAxis 1, HAxis 1 – added to triggers or other controller.
Advanced:
Combine this controller: Combine into: One
Options: Allow Combining

Mac – ControllerMate

ControllerMate script is available on Github. The “Bike Controller Axes” page should contain “Wireless 360 Controller” and “Teensy Keyboard/Mouse/Joystick.” If you’re using a different controller, you may need to add the axes yourself.
The “Bike Controller Combined” page should create a virtual controller.

Start your game, and enjoy the exercise!

 

Video Transcript

Hey there Internet. I’m Jaymis, and I have a project I’ve been working on, that I’d like to share with you.

It’s a game controller that attaches to an exercise bike. It takes your calories, burns them alive, and outputs joystick movements or button presses.
I wanted to create a system that could be used with many different games, would produce forward and backward, analogue-style controls, and which could utilise whatever rotation-based exercise equipment players already own.
My solution uses a rotary encoder connected to a Teensy USB development board, with a 3D printed gear and mounting system that can be customised to different equipment geometries. The circuit requires only basic soldering and electronics skills, and it uses very simple, customisable code. Everything can be put together for around $50 if you have access to a 3D printer, or a bit more if you need to order printed parts.
To integrate with an existing game controller requires 3rd party software which works on PC or Mac. This allows you to combine input from a standard game controller with the bike controller input.
I’ve been super addicted to Rocket League the past year, so I’ve mostly used it to control flying cars, however it works well for games like DayZ, Minecraft, and just about anything that involves plenty of walking or running.
You do lose a bit of in-game dexterity though, as real humans can’t change between forward and backward directions as quickly as in-game characters and vehicles, so if you’re playing online and are concerned about your rankings, it will probably make your scores a little sad.
If you feel that you’d like to convert some of your gaming time into exercise time though, it really is a great solution. I now regularly ride for hour-long sessions without getting bored of exercising, which seems like a Good Thing.
So I’m releasing all of the designs and instructions, to help other nerds to cultivate their own Good Habits.
Good luck. Have fun! (GLHF!), and if you’re interested in future updates or other projects involving gaming, performance, video, art, electronics, music, cooking, and other renaissance nerd topics, please do subscribe, or come find me on the internets.

3D Printable, Seamless, Friction-fit Lens Gears for Follow Focus

Working with digital cinema and motion-control has given me an appreciation for Cine Lenses With Gearing On Them. Working in a reality where things cost money keeps me appreciating Stills Lenses With No Gearing But With Less Numbers On The Price Tag. Adding gears to stills lenses has traditionally required relatively expensive/invasive modifications, or compromised solutions involving bolts, cable ties, or other fiddly things.

P1030652

Last year I figured out how to generate arbitrarily-sized gears for my selection of lenses, changing the internal diameter of each gear by 0.5mm at a time until they fit each lens perfectly.

All the while thinking, “if someone went through this process for a wide range of diameters and shared the designs, everyone’s lenses will get better, forever!” Continue reading 3D Printable, Seamless, Friction-fit Lens Gears for Follow Focus

My Own Pet Radio – No Great Mystery: Music Video

After having a lovely time working together on visuals for Ball Park Music, Sam Cromack asked me to help him create a world for the debut single from his solo project, My Own Pet Radio.

Combining 3D printed characters, robotic controlled animation and a twee black and white aesthetic, this shoot was just as much fun as you’d expect. Continue reading My Own Pet Radio – No Great Mystery: Music Video

Little Scout – March Over To Me: Music Video

After designing and 3D-printing modifications to convert our 3-axis camBLOCK motion control system into a monster 5-axis crane rig, I needed a project to test out the system. Fortunately my buddies Little Scout were about to release their new single, and the aesthetic perfectly fit the multi-pass, audio-reactive ideas in my head.

Motion control gave me some delightfully crane-y multi-pass camera moves, and audio reactive lighting made the band members magically appear only when their instruments made noise.

This clip won Gold in the Music Videos category at the Australian Cinematography Society’s 2013 Queensland awards. Continue reading Little Scout – March Over To Me: Music Video