VR Cycling for $40

I’ve made an Arduino thing that can wirelessly talk to a mobile device over BLE and can now meter the revolutions of a wheel with an optical tachometer. I’m using these two hardware features to make a virtual reality (VR) cycling experience and I’ve got a working demo to share! Here’s how this works:

First, the Arduino thing is positioned to point at the back tires of a stationary bike. (I’m using a mountain bike on an indoor trainer but the beauty of this non-invasive approach is that you could use it with treadmills, ellipticals, rowing machines, or anything that has a looping/revolving surface.)

A strip of paper is taped to the tire. Each time the wheel makes a complete rotation, the Arduino will detect when the piece of paper passes by and then sends a wireless message to the mobile phone.

The mobile phone is placed in a viewer that is strapped to my face. (I used a $10 headset that more comfortably fits the iPhone 6S Plus, but any ol’ viewer will do.)

In software, a virtual bike is created to travel in a virtual environment. The virtual bike will only nudge forward whenever the app receives a message from the Arduino reporting that the physical bike’s wheel has made a complete rotation. We are effectively mapping the physical action of pedaling to movement in the virtual space to make an oversized gaming controller.

The virtual environment is constructed in Unity. To render for virtual reality, I’m using Google Cardboard — a free software SDK for mobile VR. The SDK for Unity is drop dead simple — just drag and drop a prefab into your scene and you’ll instantly have a stereo camera rig to manipulate.

This camera rig is set to move along a spline path whenever the app receives a BLE ping from the Arduino. That’s pretty much all it takes! So there you have it, a VR cycling experience for a whopping total of $40:

  • Arduino thing? $30.
  • Mobile VR headset? $10.
  • Software? Priceless.

Yes it’s DIY, but to put things in perspective, take a look at the current offerings on the market today:

  • Peloton: $2,000 bike with built in touchscreen monitor. No VR. Pedaling does not affect the video screensaver :(
  • Virzoom: $300 bike ($600 Oculus + ~$2,000 PC not included)
  • Ciclotte: $10,700 bike?!

This was a fun little personal project and I’ve learned what I set out to learn, so this is where I move on — but if you’re going to try something similar, here’s some things I’d consider in retrospect: It wouldn’t be too much of a stretch to have the physical bike steer the direction of the virtual bike. Why not give the player total freedom to explore? Also, does the virtual bike have to be a bike? I’ll just leave this right here: http://goo.gl/fRWY6Z.

Tinker away!