Connecting Old Pro-form TDF Bike to Zwift
by Old_Tekkie in Circuits > Arduino
7155 Views, 3 Favorites, 0 Comments
Connecting Old Pro-form TDF Bike to Zwift
In 2012 I purchased a Proform Generation 2 TDF bike in order to bolster my off season cycling. Seemed like a great idea at the time, being able plan a route on Google maps and have the bike follow the route adjusting resistance, elevation and incline. On top of that the bike was extremely quiet, easily able to watch TV without cranking the volume to the point of scaring the neighbors.
As with most "great ideas" things didn't work out exactly as advertised. In order to use the mapping feature you required a paid account with IFIT.com. The first year was included with the purchase, but the first year was also plagued with server problems and never did seem to work right. The membership was extended for another 6 months, but the reality was the bike was most usable as a spin bike with built in TDF legs. All the fancy bells and whistles were more of a pain to use then was worth it. So, the bike did a lot of gathering dust until...
Zwift and RGT came out. These virtual biking programs provided an interactive means of keeping indoor cycling interesting. A few of my friends were using Zwift and I started to research into requirements etc. Could I leverage my existing TDF spin bike? Alas others were thinking the same way and a software solution was developed called the TDF Databridge . This appeared to be the perfect solution, but sadly my old version of the TDF Bike was not compatible.
Then I stumbled on a posting by Thomas Schucker regarding his Arduino Zwift Interface for a folding exercise bike. Through his documentation, and largely his code I was able to adapt it to my old TDF bike (Big Thank You Thomas!). Thomas's solution used the magnetic properties of the bike's flywheel to derive cadence and power. My TDF bike has a magnetic resistance motor with integrated position potentiometer and a magnetic pickup for pedal cadence. Between the two I was able to derive bike power (at least matching what the TDF Console said the power was) and cadence. With this I was able to send the data to Zwift via bluetooth on an Arduino Nano BLE microcontroller.
At this juncture, my TDF bike sends power and cadence data to Zwift. I manually monitor the Zwift displayed incline and adjust the bike's incline accordingly. While this is perfectly usable, I hope in the near future to "close the loop" and use the output from Zwift to automatically activate the incline control switches on the bike.
Part of my "requirements" for this project was to have minimal modification to the TDF Bike. That is - I did not want to break it! The bike interface requires tapping into the wiper of the magnet position potentiometer, ground, and the supply side of the magnetic pickup. This does require some disassembly of the bike cowling and soldering into some wires.
Note: As of May 8, 2021 I noticed that the Arduino Nano used in this project is not compatible with computers running Windows 10, that is it will not pair properly with a Windows 10 laptop running Zwift. The work around for this is to use the Android/Apple Zwift companion applications on a smart phone and pair the Arduino Nano to the companion app. Zwift can then be run from the Windows 10 laptop with sensor communication handled by the companion app.
Note: As of December 18, 2021 I changed the Arduino INO program file for the cadence reported to the game to better match the bike display RPM. I also added a variable (RPMPowerFudge) that allows fine tuning of the power value fed to the game to better match the power display of the bike. I found that setting this variable to 0.9 worked well for my particular bike.
Supplies
5v cell phone power supply with micro USB connector to power arduino
Resistors: 5K, 10K, 200 ohm (all 1/4 watt)
If Bike Supply Voltage is 5.0V then will require Resistors 68K and 39K (1/4 watt)
3.3 Volt Zener diode
2N3094 (or equiv) NPN transistor
4 x RCA female phono jacks (or other connector)
RCA cable (if using RCA jacks) - 3 foot length of twin connector male
Plastic box to hold arduino.
rosin core solder, heat shrink as required
crank puller
Volt/Ohm meter
small tie wraps
8 X 12 inch sections of 24ga stranded wire (assorted colors)
1 x 2 inch piece of perfboard
Disassemble the Bike
First, ensure that the bike you have is compatible with this solution. I know it works on my TDF Generation 2. It should work on any Proform Bike with the "cell phone like" console shown above. There are many variations out there with different names and production dates.
If the display is similar and not the big "IPAD" or "Tablet" style, you are probably good to go.
Remove the cowling on the both sides of the bike. This is best described in the video below.
Note that the author of this video removes the pedals, this step is not required as the entire crank will be removed.
You want to disassemble to the point that you have access to the control board wiring and also to the wiring feeding the resistance motor that straddles the flywheel.
Identify Magnetic Pickup Wiring
Ensuring the bike power cord is disconnected and once the cowling is off the bike you should have access to control board and wiring. Identify the magnetic pickup (reed switch). You will have to trace these wires ( 2 black wires) back to a point where you can access them. You may have to cut some tie wraps to loosen the wire bundle to provide access. One side of the reed switch is connected to the supply voltage via some resistance. The other side of the reed switch is connected to chassis ground. The reed switch closes when the magnets on the crank pass the switch. As there are two magnets on the crank we get two pulses per revolution. You have to determine which wire is connected to ground and supply. This can be done by cutting the wires between the reed switch and control board. Then using an ohm meter check for continuity to ground on the wires feeding the control board. One of the black wires, formerly connected to the reed switch should show zero resistance to ground. Label this wire as ground.
Now comes the dicey part. We have to determine the system supply voltage. I have seen some documentation stating the bike's logic circuitry as 5 VDC. I measured 3.3 VDC on my TDF bike. This is important as the Arduino will only handle a maximum of 3.3 Volt input. The easiest way to do this is by connecting the negative lead of a voltmeter to the ground wire you just labeled feeding the control board. Take the positive lead of the voltmeter and attach it to the other black wire (formally from the reed switch) and set the voltmeter on a > 5V range.
Now, call your wife, girlfriend, significant other, and have them stand by with a phone to call the paramedics.
You want to carefully plug in the bike, and turn it on without electrocuting yourself as live AC will be present on the control board and power switch. Let it take 20 seconds or so to stabilize then have a peek at the meter. If it says 3.3 Volts, great. If it says 5.0 volts, then we have to add a few more resistors to our circuit.
Pull the plug on the bike and call off the paramedics.
Solder the wires to the magnetic pickup (reed switch) back together adding a 12 inch length of wire (different colors) to the joins so you will have a tap on each wire. Label the ground wire as ground and supply wire as Cadence.
Connecting the Magnet Position Potentiometer
Now go to the rear of the seat post and you will find the wire harnessing for the Resistive Magnet motor and the Incline motor. Ignore the Incline motor wiring, I am noting it here as a reference that it exists and not to be confused with the Resistive Magnet motor.
The Resistive Magnet Motor will have a harness with 5 wires, blue, yellow, red, white, black. You will want to fish out the white wire (potentiometer wiper) and tap into it as you did the reed switch wires. Bring a 12 inch length of wire out and label it as Power. Heat shrink or tape the joins after soldering. Route the wires towards the front of the bike so they will be exposed though the clear plastic window by the steering pillar. Tidy up the wiring with tie wraps and secure it so there is no interference with any moving parts.
Reassemble the Bike Cowling
Reassemble the cowling on the bike reversing the procedure in the previous video. Prior to replacing the clear plastic window and black center cowling, drill two holes to accept the female RCA connectors as shown in the photo. Solder the end of the "cadence" wire from the reed switch to the center conductor of the RCA jack. Solder the "power" wire from the resistive motor potentiometer to the center conductor of the of the other RCA jack. Solder the "Ground" wire from the reed switch to the outside conductor of both RCA Jacks.
Replace the plastic window and black cowling. Label the RCA jacks as cadence and power,
The bike portion of the project is now complete.
Program the Arduino Nano
The heart of this project is the programming of the Arduino Nano 33 BLE microcontroller. Basically this involves either installing a programming environment (IDE) on your PC or using an online version available through Arduino.
Once the environment is setup the board may be plugged into your PC via a USB port. The software is loaded into the IDE, compiled (converted to machine code) then sent to the microcontroller. The Microcontroller is then disconnected and used in the circuit. The procedure is simple but is best described by the "Pros". Playing with the simple examples such as "Blink" will give you a feeling of how everything works. It will be an hour or two of your time well spent.
Once the file "FinalTDFGen2Zwift.ino has been loaded to the Arduino Nano (without errors), it can be disconnected from the computer USB.
Downloads
Wiring the Nano
Next we have to wire the Arduino. Carefully solder approximately 4 pieces of 6 inch wire to the following terminals of the Arduino Nano. We require a ground connection, 3.3 volt output, digital input 3, and analog input 2. The rest of the components are input protection for the Nano (yes I learned the hard way). Solder the remaining components to a piece of perfboard according to the schematic. Note that the 68K and 39K resistors are only required if you found that your bike had a 5 Volt supply. If you have the 3.3 Volt supply, omit these resistors connecting the 200 ohm resistor directly to the bike magnet potentiometer wiper (via the RCA cable).
Once all the wiring is complete, cut a hole in the mounting box to accommodate the USB connector for the Nano. The Nano may be secured with velcro, hot melt glue, and wedged with some thin plywood. I leave that to your own ingenuity as every box will be a bit different along with the mounting requirements. Attach the final two female RCA connectors to the other end of the box from the USB.
Getting Ready to Ride
At this point you should be almost ready to go. Take a 5 volt cell phone power supply with usb micro jack and plug it into the Nano controller. This will power up the Nano.
Power up the bike and let it boot up and stabilize. Put the bike into "manual mode" and adjust the bike display to show % grade and gear on the bottom window (my preference).
Now connect the RCA cables between the controller and bike, keeping "Power to Power" and "Cadence to Cadence". I have been connecting the bike and controller in this sequence to minimize the chance of "zapping" the controller inputs from power up voltage spikes. I also disconnect the leads from the bike prior to powering it down.
Start up Zwift (or RGT) on your PC/Tablet. Go to the pairing screen and click on Power Source. The Nano 33 BLE should become visible (if not try powering down the controller and restarting it). Select this as your power source. Click on Cadence and also select the Nano 33 BLE.
At this point you should be good to ride. Since there is no feedback from Zwift to the bike I typically monitor the grade displayed by Zwift and manually increase or decrease the bike incline. Speed and cadence are calculated by Zwift. I keep the bike display with the RPM and Watt windows open. I have noticed that the "power calculation" within the Arduino software that sends the power data to Zwift tracks very well with the power displayed on the TDF bike console (I sweated quite a bit figuring out the quadradic equation on that one!). That is not saying the power is correct, just that it agrees with what the bike manufacturer figures the power should be based on resistance and RPM.
Powering Down and What's Next
When it is time to end your ride I strongly recommend powering down the bike in this order:
1) disconnect cables between bike and controller
2) unplug the cell phone charger to the controller
3) power down the bike.
I have completed the 2nd phase of my project - automatic incline control. It can be found in Part 2 of this Instructable.