Zwift is a neat cycling simulator app that lets you experience a variety of bicycle adventures from the comfort of your living room. You can participate in bike races, cruise your favorite trails, or go on a leisurely ride through the country. Zwift’s key feature is that it reacts to your pedaling and vice-versa. So an uphill section increases the pedaling difficulty and your in-game speed correlates to your pedaling speed. Gene’s Green Machine found a way to integrate an existing bike with Zwift using Arduino.
In order for this to work, you will need an indoor bike setup with a pedal generator. The generator creates resistance and its voltage output is proportional to the gear ratio and pedaling speed. By monitoring the voltage, you can tell Zwift how fast your virtual bike should move. Conversely, Zwift can adjust the real world pedaling resistance based on the virtual conditions. Steering isn’t a factor here, but that isn’t a major part of cycling at speed anyway. You also don’t get to experience the virtual weather elements, but that is a good thing as far as most people are concerned.
The primary component for this project is an Arduino Nano 33 IoT board, but you can also use a Nano 33 BLE, Uno WiFi Rev2, or MKR WiFi 1010. The Arduino will monitor the voltage coming from the pedal generator through a DPS5020 charge controller, which also charges up batteries — no sense in wasting all of that sweat you’re putting into pumping the pedals. The Arduino connects to Zwift over Bluetooth by utilizing the Bluetooth Low Energy Fitness Machine Service that exists specifically for this purpose.