Wednesday, March 6, 2013

Python script to launch the UI, monitor the serial/USB port with the Arduino and to update the UI. The source of the template code I modified is in the comments
The UI (python/Qt4 on Linux, Fedora 16). Simple so far but effective

Here's the circuit as scheched using Scheme-it

Scheme-it was easy to get this far with - only took a couple of minutes. Didn't need to log-in.

L1 is toggled on/off by Pin 12 as the reed switch gets activated and grounds Pin 2.

Adafruit is a good place to get basic Arduino tutorials. The basic interrupt code example I buit from came from the main arduino site.

Sunday, March 3, 2013

Code for the Arduino - double click to select and copy...

Saturday, February 16, 2013

Power

One goal of this project was to have the computer display power. Since my old Cyclops trainer is not adjustable, power should be a function of speed. Fortunately power curves for some Cyclops trainers are published : http://www.cycleops.cz/files/trainers.pdf. I decided to use the Fluid2 curve - my trainer's older than that but hopefully close enough. A curve-fit using Excel gave :
Power[W] = 0.0128V3 - 0.0163V2 + 8.2864V where V is speed in [mph]

The Computer End

Here's the Arduino interface. Black and yellow wires at left come from the reed switch on the bike. Pin 2 senses the reed switch (yellow wire). The 100ohm resistor is to protect the Arduino in case pin 2 gets configures as an output by mistake. A 10k pullup resistor connects to the 5v pin (red wire). Then LED is activated by pin 12 (green wire)  - it is programed to change stage as the magnet passes the reed switch and is helpful for quickly checking the system works.