Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Grade Simulator for Indoor Bike Trainer - ANT+ RxScanMode Question

Rank

Total Posts: 16

Joined 2018-10-23

PM

Hi all,

generally I'm facing an challange with how to sniff Data Page 51 (0x33) – Track Resistance which are transmitted via ACKNOWLEDGED DATA (0x4F).

Let me first describe my project idea and come back than to my request again. I would be happy If I find interests here and maybe some help.
Thanks

The goal is to build up by self a Grade Simulator for Indoor Bike Trainer, which reacts automatically onto Grade given by a Bike Simulator Software like Zwift or others.
The idea is inspired by the Wahoo Kickr Climb (https://eu.wahoofitness.com/devices/bike-trainers/kickr-climb-indoor-grade-simulator?stay), but unfortunately it cost round about 500$ and it requires finally a Wahoo Bike Trainer, otherwise you just can manually adjust the grade.


The concept is:
1. Create an software which is sniffing ANT+ Traffic (in detail the grade) from a Bike Trainer Simulation such as Zwift.
2. The specific grade-Value needs now transferred to an mechanism who raise/lower the front of the bike.
I’m having this already get working for less than 100$ of equipment cost, some programming and working skills.
The project could be solved in different ways. Means which programming language is used, which system to raise/lower the front of the bike, how to transmit and sniff data.

Actual State
Actually I’m sniffing the important ANT+-Traffic via AntWare II Software (available via https://www.thisisant.com) out of the generate LogFile.
The sniffed grade data transmitted than to an Arduino Uno Board which is controlling a 12V Linear Actuator.
That’s all!      
Rank

Total Posts: 16

Joined 2018-10-23

PM

Ok, i got it solved! smile

I dived deeper into the ANT+ Documentation especially into the OpenScan Mode.

As the OpenScanMode Demo not worked in Visual Basic I copyed CodeSnipes into the DEMO_DLL from AntLibary.

Finally with getting more in touch with C++, I got it right now working... smile

Now its just more understanding ANT+ and C++ to clean up code and understood what I was doing. wink      
Rank

Total Posts: 2

Joined 2017-09-16

PM

Hi Steffen,

I am just looking at the Grade info. Did you work out what the scale is? It seems to consist of 2 bytes that make up the grade.

I am trying to figure out to convert this back to a gradient.

     
Rank

Total Posts: 16

Joined 2018-10-23

PM

Hi Zaddo,

as written the Grade is send via: Data Page 51 (0x33)

Its quite good described in the: ANT+ Device Profile Fitness Equipment, finally on page 58: 8.8.4

Data Page 51 (0x33) – Track Resistance

> It seems to consist of 2 bytes that make up the grade.

Yes you are right!

> I am trying to figure out to convert this back to a gradient.

This is the part in Script which calculate it back:
// HEX Werte umrechnen in STEIGUNG
int testint1 = int(stMessage.aucData[ucDataOffset + 5]);
int testint2 = int(stMessage.aucData[ucDataOffset + 6]);
float grade = ((testint2 * 256) + testint1) *0.01 - 200;      
Rank

Total Posts: 2

Joined 2019-01-23

PM

Great topic. Excellent answers by experts.      

Signature

Rank

Total Posts: 2

Joined 2018-09-04

PM

Hi Steffen,

Could you provide details on the linear actuator? ie, manufacturer & model, max load, max speed, max travel.

Thanks,

Stu      
Rank

Total Posts: 1

Joined 2019-11-20

PM

Old thread but it inspired me to build my own 'grade simulator' to work with my Tacx Neo. I ended up using an ANT+ to BLE bridge because Arduino has no official ANT+ support (sadly). Posted some details on how I worked back to incline from the power and speed data as well as a full write up of the build and the linear actuator on Instructables if any one is interested. https://www.instructables.com/id/Open-Bicycle-Grade-Simulator-OpenGradeSIM/      
Rank

Total Posts: 7

Joined 2014-10-29

PM

For reference for future users, this is the code for the nRF52 SDK15.3 that just does that

/**@brief initialize application
 */
static void continuous_scan_init()
{
    uint32_t err_code
;

    
// Set library config to report RSSI and Device ID
    
err_code sd_ant_lib_config_set(
        
ANT_LIB_CONFIG_MESG_OUT_INC_RSSI ANT_LIB_CONFIG_MESG_OUT_INC_DEVICE_ID);
    
APP_ERROR_CHECK(err_code);

    
// Configure channel 0 for scanning mode
    
ant_channel_config_t channel_config =
    
{
        
.channel_number    CT_CHANNEL_NUMBER,
        .
channel_type      CHANNEL_TYPE_SLAVE,
        .
ext_assign        0x00,
        .
rf_freq           FEC_ANTPLUS_RF_FREQ,
        .
transmission_type 0x05u,
        .
device_type       FEC_DEVICE_TYPE,
        .
device_number     TACX_DEVICE_NUMBER,
        .
channel_period    FEC_MSG_PERIOD,          // Not used, since this is going to be scanning
        
.network_number    ANTPLUS_NETWORK_NUMBER,
    
};

    
err_code ant_channel_init(&channel;_config);
    
APP_ERROR_CHECK(err_code);

    
// Activate message reception from the slave as well
    // This function starts receive scanning mode feature. Channel 0 must be assigned.  All other channels must be closed.
    
err_code sd_ant_rx_scan_mode_start(0);
    
APP_ERROR_CHECK(err_code);

     
Rank

Total Posts: 2

Joined 2018-09-04

PM

I've been looking at the Trainer resistance data sent on page 51 from Zwift and the slope value is fixed at the default value regardless of the actual grade.

My guess is that zwift is changing the trainer resistance rather than the grade so smart trainers that do not support gradient can simulate grades.

Has anyone captured grade data changing on page 51 from zwift?

Thanks,

Stu      
Rank

Total Posts: 7

Joined 2014-10-29

PM

Hi !

No Zwift is changing page 51, and smart trainers are commanded that way.
In this link I successfully sniffed page 51 during Zwifting:
https://github.com/vincent290587/Climber/blob/master/rf/ant.c

You have to keep in mind that in ERG mode Zwift controls trainers using a different page though