Hacking the Everlast EV-410 Exercise Bike

I recently agreed to take part in the JDRF Ride to Cure Diabetes charity event. In preparation for the event I purchased an exercise bike, the Everlast EV-410. Relatively cheap and collapsible, it met every expectation, but could still be improved…

It comes with a “computer” which displays distance, speed, calories burnt, time, and pulse. This is all well and good whilst using the bike, but what about recording progress over a period of time?

The simple solution would be to manually record this information. However I’d prefer to automate it, so set myself this little challenge. My plan is to connect it to the PC, ideally using WiFi and record the information automatically.

Thankfully the “computer” on the bike isn’t hardwired. The wheel of the bike has a cable that plugs into the computer via a standard 3.5mm audio jack. A little bit of research suggested that the cable is used to transmit a pulse for every revolution of the wheel.

To test this theory I invested in two cables, a splitter and a standard 3.5mm auxiliary cable.

I used the splitter to intercept the signal (as shown above), and the auxiliary cable to connect the the bike to my PC via the microphone port. I then used the free software (Audacity) to record the input when riding the bike. As expected it produced a blip for every revolution!

Next I needed a way to use this information. To begin with I wrote a short bit of java that reads from a WAV file, interprets the amplitude (this page came in exceptionally useful), and counts the blips.

The next step was to get it to read directly from the bike. This involved learning a fair bit about how java handles sound, and to be honest, how computers in general handle sound!

Surprisingly there was very little existing code that demonstrates how to process sound input, so I had to write a majority of it from scratch. After some time experimenting I settled with the following solution.

  1. Find the audio mixers on the PC
  2. Select the desired mixer
  3. Open a line from the mixer
  4. Calculate frame size (in my case 4bytes per frame, 44100 frames per second)
  5. Use a stream to read from the line, frame by frame
  6. Split each frame into 2 channels
  7. Calculate amplitude of the left channel (right channel will be used to record pulse)

This worked fairly well, and seemed to record the blips as expected. The next step was to integrate this with some form of timekeeping. Unfortunately it took around 3 seconds to process 1 second of audio. I tried changing buffer sizes, sample rates, and even tried skipping frames but to no avail. I settled on using a timer to keep track of the time, instead of the frame count.

Even with the lag, I’d come this far, so moved on to calculating the distance travelled for every revolution of the wheel. This was done by eye through experimentation. I settled at roughly 4.44m per revolution of the wheel, which yields distance covered the same as the bike computer.

Next up will be trying to find a way to overcome the lag, and designing a suitable way to store and display the information. The code I wrote is below for reference.

Leave a Reply