Skip to content

tao-j/Keiser2ANT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bike Data Hub

This project is very similar to ptx2/gymnasticon. Instead of JavaScript, it is written in Python. It adds BikeID selection for Keiser and adds speed page for ANT transmission. In addition, the developer strives to deliver a well-thought design for logically sensible modules and developer friendly concepts as a thought exercise.

Originally this project is hosted under two separately projects Keiser2GATT and Keiser2ANT that are in succession of Keiser2Garmin.

System Design

There are two modules works asynchronously:

  • bike: Receives sensor data or generates simulated data.
    • Emits a signal when new readings are available
    • Data truncating and conversion should not be done here
  • tx: Sends the data in BLE or ANT protocol defined format.
    • Value truncation is performed here
    • Either sends the data in 4Hz or whenever a condition is triggered.
    • TODO: if there is no data received in 2 seconds, they should stop transmitting.

The converter tx.conv transforms from various bike raw data into values tx uses. It should work in floating numbers and leave the truncation and rouding to the last stage. Here, the conversion may include algorithms that infer the required values defined by specs but not available directly in readings. Examples are:

  • CounterGenerator: see its docstring
  • Estimate speed from power
  • Estimate wheel revolution from speed

Bikes

TODO: each bike class could be derived from base classes indicating the type of raw data they provide, such as Power, Cadence, Speed, Rev Event, etc.

Simulation

Keiser

Keiser M series BLE broadcast has a public (spec). Those bikes transmit readings in GAP messages. The BikeID of interest can be set.

Other bikes can be added as later.

Data Transmission

ANT+

Implemented Profiles:

  • Bicycle Power
    • Sends Power and Cadence
  • Bicycle Speed and Cadence
    • Speed only device is implemented, whilee Speed and Cadence or Cadence only device are availble.
  • TODO: Fitness Machine

ANT+ specs can be obtained by simply register here.

Hardware requirement

  • An ANT+ transceiver
    • ANT-USB
    • ANT-USBm (based on NRF 24L01P)
    • Or other ones supports Ant+ Tx (needs simple code change to add raw serial)

It is believed that CYCPLUS branded ones do not work.

Be sure to close and clean up the channels opened before exiting, otherwise next time opening the device it will throw an exception: usb.core.USBError: [Errno 75] Overflow.

Bluetooth (BLE GATT)

Implemented Profiles:

  • CP: Cycling Power
    • Only Power is sent
  • CSC: Cycling Speed and Cadence
  • FTMS: Fitness Machine
    • TODO

The Bluetooth SIG pdf specs are not that helpful. But xml files circulating over the internet are useful.

Compatibility Test

  • watchOS 10: CSC/CP works. But sometimes it is unable to setup the wheel dimension, sensor name is not showing correctly.
  • Garmin: Can only connect to one service either CSC or CP. When CSC is connected, and the wheel feature bit is set, then the wheel diameter can be set. If crank revolution data bit is set then it is unable to set wheel diameter regardless of the presence of wheel data. The trick is to add an empty SC control point. CP works if only sending power data.
  • Zwift: CSC/CP can be picked up, but displays no data on iOS, but works on Android.
  • nRF Toolbox: CSC is supported. However, it seems that this program ignores the timestamp and if there is a duplicate message with the same reading, it will estimate the speed/cadence as 0. Also, it requires a Battery Service implemented to connect.

Related info

  • Linux uses dbus to manage bluez. bluez-peripheral is a wrapper abstracts peripheral role devices. Quick concept overview of dbus by bootlin
  • Bluetooth specs are useless and the Bluetooth SIG hides the actual bits definition xml files. Fortunately there is some accessible backup on Github.
  • The cross-platform solution bless has trouble advertising several GATT profiles on Linux. If two profiles are defined, only one profile can be read by nRF connect. In light of this, bluez-peripheral is used.
  • 1 2 3. 4 5

Alternate Solutions on MCU

To do it another way, BLE only, actually in Circuit Python can be used, which does not support generic Linux host at the moment. ESP32-S3 or old ESP32 or others can be used.

In order to transmit the ANT+ signals other than a fully fledged system, nRF52840 might be a good choice, but its soft device licensing can be troublesome.

About

receiving Keiser M series bike BLE broadcast signal and retransmit them in ANT+ compatible profiles.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages