I recently bought a Samsung S7 (which is really great – great camera, nice responsiveness and overall the best mobile I’ve had until now). There was a marketing campaign here in Germany where you got a Gear VR when you bought an S7 for a limited time. That was one of the many reasons I wanted to have exactly this mobile phone.

I had a fun idea when I was sitting on my exercise bike one night – it can get kind of boring when you sit on that thing — and so I put on my Gear VR and started “Smash Hit” (a fast, casual, I-can-break-things game). I was completely immersed in that game and forgot the time while I was cycling (though it can get a bit sweaty under the goggles). That brought me to the idea of using my new Raspberry Pi 3 in order to get the movement of the bike and create a mobile VR game that corresponded to the speed of my cycling.

early prototype in Unity 3d

early prototype in Unity 3d

My bicycle has a very basic speedometer (there is a phone jack, with every turn of the cylinder the circuit is closed), so I attached it to my Raspberry and wrote a small NodeJS app that checks the GPIO and opens a socket server where the other app can connect and get the movement of the bike.

raspberry_setup

Next I created a Unity project with Oculus support and put an avatar into a scene. I got a bit confused on how I could get the speed of just a tick of the cylinder, but when I got everything up and working (for details and updates you can have a look at my blog) my avatar moved forward when I started cycling and moved faster whenever I cycled faster.

excercise_bike

I will update the project in the next few weeks — mostly the game, the server is working as it should at the moment.