This instructable explains how to integrate ANT+ transceiver with Arduino controller into a vintage 1987 exercise bike to allow PC based or Garmin sports watch/bike computer recording of exercise data such as 1) Cadence, 2) Power, and 3) Heart Rate.
The steps involved in this instructable are high level as follows:
1. Connections to exercise bike
a. Connections to the the existing cadence sensor
b. Connections to the power meter sensor
c. Connections to power (to power the Arduino)
2. Characterizing the sensor outputs of the Exercise Bike
a. Measurement of output voltage of cadence sensor from Hi/Lo to ensure within range of Arduino Digital Input
b. Measurement and calculation of power meter output voltage as a function of Exercise control panel load.
c. Measurement of the voltage used to power the Arduino to ensure within range.
3. Wiring of the Arduino to the exercise bike and to the ANT+ transceiver
a. Digital input connection for the Cadence Sensor
b. Analog input for the power meter sensor
c. Power connection
d. Transmit/Receive connection to the ANT+ transceiver
e. ANT+ connections
4. Arduino Code
a. Code for reading inputs, performing calculations, and sending serial data to be transmitted to and by the ANT+ transceiver.
5. Example of PC based Software to read ANT+ Data
Step 1: Connection to the Cateye Ergociser
I was able to find documentation for a similar model exercise bike (I have the Cateye 1000) on the internet and used this to figure out the connection locations for the Cadence sensor, power meter, and input power. Above are the schematics for the bike. In the documentation, there is a 5P (pin) connector that goes from the exercise control board to the head unit of the bike. I spliced into this wiring and pulled off the signal for the cadence sensor (cadence signal) and power meter (Solenoid Coil Current Control Signal). For the power connection for the Arduino, I spliced into the wiring for the CN4 connector (+ and -).
Step 2: Characterizing the Sensor Outputs of the Cateye Ergociser
A simple connection of a voltmeter to the signal wires that go to the cadence sensor and spinning of the bike crank showed a 0V to 5V signal transition when the sensor crossed the magnet. 5V range is acceptable to use with the Arduino digital inputs.
The power meter connection required measurement and calibration. The head unit of the bike sends a control signal (voltage) to the coil that provides a specified torque level of resistance. On the image above, it is the CTQ value. The units are in kg-m. I changed the CTQ value from 0.5 to 4.0 on the head unit (using load+ button) and connected a voltmeter to the spliced wires from the coil control signal and measured the voltage. I then entered this data into an excel spreadsheet and curve-fit a relationship between torque (kg-m) and voltage. I used a second order polynomial curve-fit. I then did calculations on the level of error I would get in power readings between the head unit displayed power and the Arduino calculated power (we will be using this curve-fit equation a little bit later into the Arduino code). They were within a reasonable level so I determined that this curve fit of the data was sufficient to utilize going forward.
Relevant equations used are below:
Torque (n-m) = Torque (kg-m) x 9.80665
Power (w) = (Torque (kg-m) x RPM) / 9.5488
Curve fit equation: Torque calc (kg-m) = 0.3413*Voltage^2+0.2852*Voltage-0.0238
Step 3: Wiring of the Arduino to the Exercise Bike and to the ANT+ Transceiver
The connections required for the Arduino (I used the Arduino Uno Special Edition, acquired at Radio Shack) to process the information and send serial data to the ANT+ transceiver are the following:
1. Torque Reading (Voltage) = Analog A0 on Arduino
2. RPM Reading (Digital) = Digital D3 on Arduino
3. RX In from ANT+ Transceiver = Digital D8 on Arduino
4. TX Out to ANT+ Transceiver = Digital D9 on Arduino
5. Vin from Cateye Control Board = Vin on Arduino (power input region)
6. GND from Cateye Control Board = GND on Arduino (power input region)
I used software serial subroutine (myserial) to use these digital pin locations on the Arduino (default TX/RX are on pins 0 and 1). I did this so I could still read the serial connection via USB from the Arduino to the PC for onscreen debugging of the data coming from the Arduino.
I also used an intermediate jumper board to make connections between the TX of the Arduino and RX of the ANT+ transceiver. I had to use a voltage divider to step down from 5V (the output from the Arduino) to the 3.3V (limit of the max voltage input on the RX signal for the ANT+ transceiver). The ANT+ transceiver I used was the Dynastream ANTAP281M4IB available at Digikey. It was a difficult to solder to and also get the proper jumper connections. If something new is available on the market, I would go this path next time. Resources for wiring the Dynastream properly were found on the web at the following URL: Digitalhack's Blog, especially the comment regarding Pin 17 RTS connection. The differences in my wiring were that TXD0 on the dynastream was connected to D8 (RX) on the Arduino and that RXD0 on the dynastream was connected to D9 (TX) on the Arduino. Further datasheet on the Dynastream ANTAP281 are available at the following URL: Datasheet ANT+. The connection description for all 17 pinout locations are described above (the version I used was the surface mount version of this ANT+ transceiver). Please note that in the method we pinned out the Dynastream, the baud rate to communicate to it will be 4800 baud. We need the Arduino code to reflect this.
Step 4: Arduino Code
The code for reading the voltage from the power meter (really torque reading but I refer to as power), cadence, and performing necessary calculations and outputting them on the serial pins to the ANT+ transceiver is presented below.
Please note that the ANT+ network key is not shown in the code I present as a requirement of ANT+ licence agreement as an ANT+ Adopter. This is in the SetNework() subroutine and they are denoted as 0xXX, buf to buf. It is free to join the ANT+ in which you after looking around the site, you can find the keys in documentation.
After viewing the RPM shown on the head unit versus what was read by the PC, there was an offset by about 1.5 RPM. Therefore, in the code, I subtracted 1.5RPM from the measured cadence to correct.
Step 5: Example of PC Based Software to Read ANT+ Data
Some of the links previously presented go through debugging methods to ensure the ANT+ transceiver is working so I will not touch upon this. My interest is to use the Cateye trainer with PC based software. I have found Traineroad to be an excellent program, especially since you can specify training intervals with desired power and time. The screen shots above show configure Trainerroad to the Power Meter we created by this hardware/software configuration as well as connection to an ANT+ Heart Rate monitor. The power meter device also collects the cadence information from our system. The screen graphs show that the wireless data sent from the 1987 Cateye Ergosiser is properly read by the Traineroad system!
The Cateye trainer was ahead of its time by incorporating power, so I am happy to continue using it with modern PC based monitoring and training software. I hope this instructable assist you with connecting similar older exercise equipment to your computer for datalogging and use!