iaroslavn / peloton-bike-metrics-server

Web server that reads metrics (e.g. cadence, output) from Peloton® Bike screen and exposes them via REST API.
MIT License
40 stars 5 forks source link

Simulate ANT+ without raspberry pi? #2

Open maurera opened 4 years ago

maurera commented 4 years ago

@iaroslavn - thanks for sharing this code. I have a Peloton without a subscription and this allows me to still record my data. I'm in the process of modifying the code to write to a TCX file with cadence/power/speed/distance, rather than send over the REST API with Flask. At least I can then save my rides to Strava / Garmin Connect

I saw in your zwack-bike project you show how to send cadence and power data over a BLE sensor and raspberry pi. I'm wondering how you could get Zwift working on the same computer that's running peloton-bike-metrics-server. Do you know if you could simulate a BLE or ANT+ device on the PC without having to actually have a raspberry pi and send the data? Eg SIMULANT+ seems like a possibility.

Note - I'm new to Github. I'm not sure if there's a "comment" section - the only area I could find to send this message is "Issues", even though this isn't an issue.

Note2 - Tesseract seems to have issues maybe 10% of the time. The most common issues are reading 1 as "]" or 0 as "O", but there have been others, like 4 as "A". It looks like maybe this could be fixed somewhat with different tesseract config parameters?

iaroslavn commented 4 years ago

Hi @maurera, Thanks for the interest in this project. Unfortunately, I will be away from my Windows laptop for about 2 months, so I can only provide limited support at the moment.

This project was a one-day DIY effort to connect Peloton with Zwift, and like any DIY project it has many limitations, the biggest of all is having to grab metrics from the projected screen image which has some lag and most importantly has to be adjusted every time Peloton UI changes. Thus, if you are very early in your journey I would suggest evaluating the option of attaching physical Cadence/Speed sensors to your bike and retrieving data from them (some models can post to Strava automatically). This will completely detach you from the specifics of Peloton implementation and might require zero coding efforts to achieve your goals, as some sensors come with mobile apps that post data to Strava or even have TCX file export capabilities. E.g. you can have a look at https://youtu.be/xyUPrT5rvT8?t=49.

Do you know if you could simulate a BLE or ANT+ device on the PC without having to actually have a raspberry pi and send the data?

The software that runs on Raspberry Pi in my setup is from this repository: https://github.com/iaroslavn/zwack-bike. It uses https://github.com/noble/bleno module to do all the BLE simulation. This module claims to have support for Windows, thus if your Windows machine has a physical Bluetooth module you might succeed in starting https://github.com/iaroslavn/zwack-bike on your Windows machine instead of Raspberry PI. I would simply try to follow the installation instruction given on https://github.com/iaroslavn/zwack-bike page and see if they work (instructions are given for Mac/Linux machines but essentially what you need is to check out the project and make sure npm install command completes successfully). Please note that if you manage to start the zwack-bike BLE simulator on your Windows machine you still would need to use the Zwift Companion app on your mobile device. In my video I showed the Zwift app running on my laptop, but I am also able to take Zwift rides just on my iPhone and it communicates with Raspberry PI BLE simulator just fine.

Note2 - Tesseract seems to have issues maybe 10% of the time... It looks like maybe this could be fixed somewhat with different tesseract config parameters?

You are absolutely correct. Ideally, we need a way to tell Tesseract to just recognize 0-9 digits. You might want to check this thread: https://github.com/tesseract-ocr/tesseract/issues/751. If whitelisting digits doesn't work as expected you can try general techniques to improve digit recognition, e.g.: https://www.freecodecamp.org/news/getting-started-with-tesseract-part-ii-f7f9a0899b3f/