dhague / vpower

ANT+ Virtual Power - currently for BT-ATS turbo & Kurt Kinetic. More to come...
MIT License
82 stars 34 forks source link

Implementing FE-C device profile? #6

Open cleeland opened 6 years ago

cleeland commented 6 years ago

I am interested in doing something similar--emulating a device--but rather than a powermeter I am interested in emulating an FE-C device asa bridge to a computrainer. It appears you implemented a pared-down Power Meter profile?

dhague commented 6 years ago

Hi Chris - yes, exactly.

cleeland commented 6 years ago

I have some questions regarding your use of python-ant that might be answered by python-ant documentation...but I don't find much in the way of documentation in that repo. Did you use some python-ant documentation, or did you just use the code?

If you're open to answering questions, what's the best way to that? In here? Or as comments on lines of code?

dhague commented 6 years ago

Probably best to discuss here, and you can include references to code using links such as this: https://github.com/dhague/vpower/blob/acab2ec78e15851ba5a3a9176ff2177f02ed36fc/vpower.cfg#L22 which shows up as: https://github.com/dhague/vpower/blob/acab2ec78e15851ba5a3a9176ff2177f02ed36fc/vpower.cfg#L22

cleeland commented 6 years ago

In https://github.com/dhague/vpower/blob/acab2ec78e15851ba5a3a9176ff2177f02ed36fc/vpower.py#L22 how did you choose the string 'N:ANT+'? Is that a required constant? Or just anything? I see that you used 'C:' as a name elsewhere and am trying to understand significance.

cleeland commented 6 years ago

I think I see where you got 'N:ANT+'...from the examples in python-ant.

Curious which USB stick you had. I have one of the USB-m garmin sticks, and its product ID is different from the hardcoded in python-ant.

So far I've hacked up your PowerMeterTx to look like an FE-C Trainer on the ant network, and my wahoo elemnt recognizes it as such. No data pages yet.

dhague commented 6 years ago

Yeah, exactly - I pretty much copied the example code then changed it to make it work for my case. I've used a range of USB sticks (Anself small & large, Suunto), but all with the same product ID.

cleeland commented 6 years ago

Also, did you run into any issues where python-ant just seems to hang? I've run into this both on startup and on shutdown. I've sent an email to the author, but considering how long it's been since there's been an update on the project, I'm not expecting a reply.

dhague commented 6 years ago

Yes, on repeated restarts that can happen. That said, on a Pi Zero I have deployed for a virtual power meter it works every time, which suggests it's fine after a reboot, but repeated restarts can otherwise lead to trouble.

MattW2 commented 6 years ago

Hi, just wanted to say thank you for the excellent project and join in on the conversation. I've implemented a similar bike trainer to ANT+ power for Arduino and a Cycleops Indoor Bike, CycleOpsPro300PTtoANTPlus. I was also trying to implement FE-C on my existing hardware but was running into problems getting the module to both receive and send on separate channels. A USB ANT+ stick in a Raspberry Pi doesn't seem to have any of these issues. In my case I have a indoor bike with a power meter but am adding in a motor to provide resistance as commanded over the FE-C protocol.

spatcho commented 6 years ago

Hi guys, First thanks for the project. I am tryring to fe-c enable my treadmill, it's a bh dual with pafers bluetooth dongle but this doesn't work well. Beside the ant+ communication, I need to understand what signals the treadmill console send to the motors (speed & incline), and then implement the protocol on my pi, I found no documentation on this. I also have a elite drivo bike trainer, it's already fe-c enabled. I want to control / read both devices with GoldenCheetah. Hope this project stay alive, there is so few places discussing this. Cheers.

MattW2 commented 6 years ago

@spatcho , I made some really good progress on my implementation of FE-C for a stationary bike trainer (It's working). The project is written in C for Arduino or any other similar microprocessor. The hardware this is designed for is documented here Cycleops Pro300pt to ANT+

The example with FE-C implemented can be found here ANTPlus_Bike_Fitness_Master. Should be very easy to implement the treadmill pages. Let me know if you need any pointers on where to go?

spatcho commented 6 years ago

@MattW2 thanks for the tip, I have some arduinos, I had a look on your project, and I just ordered the zigbee/ant dongle. I let you know.

spatcho commented 6 years ago

@MattW2 got the dongle, ran successfully the test here so the module is well wired and functional, compiled and ran ANTPlus_Bike_Fitness_Master, but I can't make it work. I m using a genuino zero and hw serial, this part work, I changed the dongle pins correctly in the code. I m excited but stalled, I guess I m not far from it. Maybe we should talk about this in pm.

Landixus commented 6 years ago

The Arduino zero have another chip then the pro mini. I suggest to check this first with a pro mini what has a ATMega 328 on top, the zero have a SAMD21 MCU, i run in the past in this trouble, code looks fine, but wrong chip :) pins can have different names/numbers

spatcho commented 6 years ago

@Landixus thanks. Ok, I m trying now with a linkit smart duo, it's like a yun, ATMega 32u4, it should be similar enough (?) It behave the same but I try to understand more precisely where.

Landixus commented 6 years ago

try out and post somewhere images and code snipplets, also what you exactly want to do. You can use your github page. If you have all together start a reddit post to earn more people who can help. good luck. This is not a vpower issue :) but dhaque must be a nice man :)

spatcho commented 6 years ago

No, you were right, the issue was the zero, with the linkit it work, just this time I mixed rx and tx :-) now it s functional, I can add the arduino as "fe-c" device on goldencheetah and connect to it. Now the fun begin. And thanks lot for the support!

cleeland commented 6 years ago

Are you using the hardware serial for communicating with your treadmill?

On Tue, Jan 9, 2018 at 12:14 PM, Bernard Spatcho notifications@github.com wrote:

No, you were right, the issue was the zero, with the linkit it work, just this time I mixed rx and tx :-) now it s functional, I can add the arduino as "fe-c" device on goldencheetah and connect to it. Now the fun begin.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dhague/vpower/issues/6#issuecomment-356368098, or mute the thread https://github.com/notifications/unsubscribe-auth/ABMIR9ggtsXAf77moD-gFh-xUf8NWt8Vks5tI6xygaJpZM4P4n-Z .

-- Chris Cleeland

spatcho commented 6 years ago

@cleeland If you mean communicating with the ant dongle from the arduino, which was the subject of my last posts, I started with hardware, then softwareserial lib, both work. Pins 2/RTS_PIN/, 3/SUSPEND/, 4/SLEEP/, 6/RESET/ and 9 & 10 for softwareserial. To communicate from the arduino to the treadmill, I never tried hardware serial, had issues with softwareserial lib, and use the AltSoftSerial lib thru (hardcoded) pins 5 & 13.

Alanimus commented 4 years ago

Hello, I realise this is an old thread, but anyone have some hints on how to get this functioning with FE-C? I am trying to read resistance data page from Zwift, on Raspberry Pi. I am not sure how the parsing works. The "tutorial" code for Ant+ is nothing at all like python-ant. For instance, you can see it being used here: https://github.com/WouterJD/FortiusANT/blob/70cc8f46c4bf2cc6e794b88b17ce8d2c001468c7/pythoncode/antDongle.py#L846

But I have no idea if I can get this to work with python-ant so I can use this virtual power meter.

B-Moo commented 4 years ago

The example with FE-C implemented can be found here ANTPlus_Bike_Fitness_Master. Should be very easy to implement the treadmill pages. Let me know if you need any pointers on where to go?

@MattW2 , I would be so helpful for any pointers you could give this newbie to get FE-C working in this time of lockdowns and isolations!!

I've got both a nRF52832 breakout board (https://learn.sparkfun.com/tutorials/nrf52832-breakout-board-hookup-guide?_ga=2.44787238.342330191.1588072170-142582865.1586242768) and a nRF52840 Mini Board (https://learn.sparkfun.com/tutorials/sparkfun-pro-nrf52840-mini-hookup-guide), as I couldn't find the nRF24AP2. I now realise I'm way out of my depth. (Logic was the nRF52832 had more references for ANT+FEC, but the ..840 came with presoldered USB connector for bootloading. Anyway...)

I have tried to compile the code from your ANTPlus_Bike_Fitness_Master.ino. I copied the original "antdefines.h", "antmessages.h" and "types.h" from brodykenricks into similarly named folders in my Adruino library. When I try to compile I get mountains or errors, such as "'MASTER_DEVICE' was not declared in this scope".

I would be so grateful if you could explain what libraries I need, and how they should be structured, and any other tips you can give me.

JibberJim commented 3 years ago

Hello, I realise this is an old thread, but anyone have some hints on how to get this functioning with FE-C? I am trying to read resistance data page from Zwift, on Raspberry Pi.

Did you get anywhere with this, I'm about to look at intercepting FE-C controls and adjusting them from zwift (zwift assumes too much frontal area for how I would like to run the neo so want to adjust it / give me a tailwind to change the inertia set up in the turbo)