The program works, however, the code hasn't been cleaned up as yet, since I'm still tweaking the program.
The basic principle is that the Universal 2Pin Treadmill Speed Sensor Magnetic Sensor triggers an interrupt whenever it detects the magnetic field of a magnet on the flywheel.
(In my case, i've used the existing flywheel magnet on my Reebok Jet 100+ treadmill.)
The interrupt records the time between rotations to calculate the flywheel RPM. The belt speed and distance traveled are then calculated and displayed on the ESP32 webpage.
This software can be adapted to any treadmill by setting the belt_distance variable, which is the circumference of the flywheel and treadmill belt. (Distance traveled between interrupts)
A basic solution could just read the rpm and send the current speed over bluetooth.
This project displays the speed(kph), distance(meters), uptime, bluetooth kph speed upshift speed, current rpm, total revolution count.
Webpage UP/Down buttons are used to vary the bluetooth kph speed. (which is the sum of the treadmill belt speed and the manually adjusted speed.
The Reset button can be used to reset all counters.
I don’t know if you know CSAFE protocol. Many treadmills and other kind as rowers or bikes has a CSAFE port, this can send the status of every parameter (speed, slope, cadence) of the treadmill and receive from other platforms to modify speed as example (only available) just need to make a BLE FTMS to be a bridge between this port and Zwift and other platforms.
north pole engineering has a solution for that. But would be great an open source solution.