Exercise Bike + PS2 Controller + Google Street View

I discovered that Ben & Jerrys ice cream goes quite nicely with cheesecake or tiramisu - so I'm sure you'll agree some exercise was in order... I can't see very well so riding a bike on public roads might be a somewhat shortlived idea - but cycling around Google Street view seemed like the next best thing.

The exercise bike has a display which shows distance / speed / time etc. I had initially planned to interface with this - but concluded that may require wire cutters and wasn't too keen because the exercise bike was still very new.

I had a spare ultrasonic range finder that I thought I could use to detect when the pedals went round. But a quick look at similar projects revealed a far better method was to use a magnet sensor (reed switch) so I went on eBay and found some burglar alarm window sensors. The arduino can read this is a digital pin HIGH or LOW. I attached the sensor to the stationary part of the bike and the magnet to the pedal / crank. When the switch is activated, the Arduino sends the Up Arrow to move forward and lights an LED. This only needs to happen once each pedal revolution so the Up Arrow won't be sent again until the reed switch has changed state again and eg at least 1 second has passed.

Various Arduino models (including the Leonardo as used in this project) can emulate a USB keyboard. It is a good idea to only start emulating a keyboard if eg a certain pin is LOW so it doesn't cause problems when trying to reprogram the Arduino.

Going forwards now works great but I wanted to be able to steer as well. I considered just attaching push button switches to the handlebars for Left Arrow and Right Arrow - but I came across a better solution. Thanks very much to Bill Porter for the Playstation 2 controller library and wiring info which enabled me to steer using the L2 and R2 buttons on an old Playstation 2 controller. Do have a look at Bill Porter's projects - I'm going to need a bigger MIDI Christmas Hat to compete with Bill's Christmas Lights!