-
Improving a Kinetic bike trainer
The Kinetic bike trainer is generally a great device. It allows a bike to be attached easily for indoor training, and it is portable enough to hauled around to be used for pre-race warm-up. My biggest gripe with the unit that I have is that the only way to adjust the tension is to turn the knob at the back. This means that it can’t be adjusted while riding. Since it often takes several fine adjustments to get the right tension, it means getting off and on the bike to make each adjustment. Also, there is no way to change the adjustment during a workout without dismounting.
There are models that have a remote tension lever that attaches the the handlebar, but, I don’t have one of those. Thus was born the idea of using a motor controlled by an Arduino board to turn the knob by pushing buttons mounted on the handlebars. The real trick though was to hook up a motor to the knob. I wanted to avoid modifying the unit, and that included not wanting to drill mounting holes, or use glue on the knob. I tried using Vex robotic parts at first, this worked well enough to prove that the motor was powerful enough to turn the knob, but it was a wobbly contraption, not suitable for more than a proof-of-concept. I searched around for various things at the hardware store. Among them were hex nuts that matched the thread of the adjustment screw. I thought maybe I could use these to create a knob that could be easier to work with than the knob the came with the Kinetic trainer.

Notches in the PVC fit over the knob nicely. The back of the PVC adaptor has enough flat surface to screw the motor coupling plate in place.
The item that offered the most promise was a PVC adaptor. The part is intended to match a 1 3/4″ pipe to a 1/2″ pipe. What interested me is that the thought that the large end could be notched to fit over the knob, and that the small end had flat surfaces that might be sufficient to drill holes for the motor mounting plate. A Dremel tool and file were all I needed to notch the PVC adaptor so that it fit snugly over the knob. As I had hoped, there was enough flat surface to mount the motor securely. One thing I had to do, that I hadn’t planned was to drill a hole through the side to allow access to the set screw on the motor shaft collar that is on the inside of the tube. With a couple of pieces of flexible metal strap and twine I got the motor unit and PVC adaptor to press against the knob with sufficient pressure. Yes, I said twine. This is still a prototype after all. Imagine if you will . . .yadda,yadda, yadda.
The electronics were the easy part. Arduino has several digital ports that can drive a PWM controlled-motor. The Vex motor units I have are free running servos that can be driven very easily with the Arduino by using the Servo module. By using a value of approximately 90 in the Servo::write() method, the motor will be stationary. A value of 0-89 will cause the motor to turn in one direction. A value between 91 and 128 will cause it to turn in the opposite direction. Wiring is pretty standard. The black wire from the motor goes to ground. The red wire goes to the motor supply voltage. The white wire goes to the signal port, in this case the digital port 9 on my Arduino board. Controlling the motor is done with two button switches attached to digital ports 5 and 7. Each port is tied to ground with a 10K resistor. Each switch then is tied to the Arduino 5V supply. When pressed, the digital port is pulled up to make the digitalRead(portNumber) method return TRUE.
The Arduino code is very simple. The main loop looks for one of 3 conditions–left button pressed, right button pressed, or no buttons pressed. If the left button is pressed, then the motor is turned in a direction to decrease the tension (allow the wheel to spin more freely). If the right button is pressed, the motor, spins the opposite direction, increasing tension (making it harder to pedal). If neither button is pushed, then the motor is held stationary.
There are several things that I would change about the code. First, there is no need to continue writing the motor direction control during the whole button push. It can be done once, when the button is first pressed. The code runs fine as it is, but it is wasting time with continuous writes that do nothing useful. There should also be some sort of debouncing for each switch. Finally, it would be useful to have have some safety limits built in to prevent excessive tightening and loosening. This would likely require a third switch to put put the unit into a calibration mode. Once the calibration mode is turned off, then the unit would only allow a set number of turns in either direction.
Here is the code.
#include <Servo.h>// myservo will later be attached to an Arduino PWM port.
Servo myservo;// Use these digital ports for the motor control buttons.
int inc_tension_button = 7;
int dec_tension_button = 5;// In a perfect world, the stop value would be 90.
int motor_stop = 95;
int inc_tension = 140;
int dec_tension = 50;// Store the last state of the motor each time it is changed.
// TODO – still needs to be implemented.
int current_dir = motor_stop;void setup() {
// Port 9 is a PWM port, so it is suitable for Servo module use.
myservo.attach(9);
// We are going to read these ports to detect a button press.
pinMode(inc_tension, INPUT);
pinMode(dec_tension, INPUT);
}void loop() {
// TODO – Only issue each motor_control once when state changes.
if ( digitalRead(dec_tension_button) ) {
motor_control(dec_tension);
}
else if ( digitalRead(inc_tension_button) ) {
motor_control(inc_tension);
}
else {
motor_control(motor_stop);
}
}void motor_control(int direction) {
myservo.write(direction);
}





