Git Product home page Git Product logo

csc_ble_bridge's Introduction

What

This is an Ant+ to BLE (Bluetooth Low Energy) Bridging app for ANT+ Cycling Speed and Cadence (CSC) sensors, ANT+ heart rate sensors, and ANT+ Stride based speed and distance sensors. The app will act as a Cycling speed/cadence and/or HR BLE sensor and/or BLE Running speed/cadence so other BLE device (phone, PC, Mac, tablet) can reads data from ANT+ sensors.

V1.3 screenshot pre V1.3 screenshot (old original version)
Screenshot v1.3 Screenshot

Install

Or you can download the apk in release and use adb to install:

adb install -r /path/to/app-release.apk

Details

This is an Android app which reads ANT+ cycling speed/cadence (CSC), heart rate sensors, and/or stride based speed and distance (SDM) sensors in the background (actually in an Android foreground service), and advertises itself as a Bluetooth Low Energy (BLE) device which implements Cycling Speed and Cadence Profile (CSCP), Heart Rate Profile (HRP), and/or Running Speed and Cadence (rsc) so that other devices can see this Android device as a Cycling Speed & Cadence Bluetooth, Heart Rate BLE sensor and/or Running foot pod sensor.

This is useful when you only have ANT+ CSC/HR sensors but you want to connect to them as BLE sensors (provided that you don't have an USB ANT+ stick around but happen to have an ANT+ enabled Android device like a Samsung phone).

Long hold on the sensors name on top of the screen to rescan for Ant+ devices after the "Start BLE bridging" button has been pressed. All sensors will automatically scan for Ant+ sources when the "Start BLE bridging" button is pressed.

Why

I want to try out Zwift desktop version but I can't get a USB ANT+ Stick anywhere now in my country (due to the C-19 pandemic). So I decided to write one.

I can now sees my speed and cadence coming from ANT+ sensors on Zwift Mac without the need of extra hardware.

Special thanks to pinkemma who implements Heart Rate sensor profile so that this app also reads heart rate from ANT+ sensor and bridges it to bluetooth. (see PR #5 since 10/2020)

Tested devices

ANT+ and BLE enabled Android devices

  • Samsung Galaxy S8 (Android 9)
  • Samsung Galaxy J5 2016 - Thanks louisJ20
  • Samsung Galaxy S9 (Android 10) - Thanks pinkemma
  • One Plus 7 Pro (Android 10) - Thanks michaelrhughes
  • Nokia 7 Plus (Android 10) - Thanks leaskovski
  • Nexus 5 (CyanogenMod 13 and Ant+ Enabler) - Thanks leaskovski
  • OnePlus 5T (Android 10) - Thanks philharle
  • Galaxy Note 9 - Thanks larryb84
  • Samsung Galaxy S10 (Android 11) - Thanks Chris

ANT+ Speed/Cadence sensors

ANT+ Heart Rate sensors

  • Garmin HRM-Run
  • Garmin HRM3-SS - Thanks philharle
  • Garmin Fenix 5s with broadcasting mode on (ANT+ signal) - Thanks pinkemma
  • Garmin 935 with broadcasting mode on (ANT+ signal)
  • Garmin Fenix 6 with broadcasting mode on (ANT+ signal)
  • Garmin HRM2 - Thanks larryb84
  • Garmin Fenix 5 with broadcasting mode on (ANT+ signal) - Thanks Chris
  • Garmin HRM Tri - Thanks Chris

ANT+ Stride-based Speed and Distance Monitor (SDM) sensors

  • Garmin Foot Pod

Apps that use BLE sensors

  • Zwift (Mac/iPad/Windows version)
  • The Sufferfest (Mac version)
  • Zwift (iPad Pro)
  • theoretically all other apps that use Bike Speed/Cadence or Heart Rate or Run Speed/Cadence BLE sensors

Known issues

  • On my Samsung S8 sometimes the bluetooth PHY is messed up (for unknown reason). I have to reboot the phone to get it working. (When it doesn't work, the advertising reports success but actually you can't see any).

Reference

Code samples:

Spec and Document

csc_ble_bridge's People

Contributors

ecammit avatar michaelrhughes avatar pinkemma avatar starryalley avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

csc_ble_bridge's Issues

Muiltiple Activity Instances

Great project, really helped me out when relaying my ant+ only garmin watch to link with Zwift!

I've noticed 2 issues as of late.

  1. When minimizing the app to run as a service in the notification shade, resuming the activity often launches a new activity. This requires pressing back multiple times to get to the "active" activity that's actually enabled and transmitting information.
  2. Sometimes the app crashes on startup and becomes unresponsive. The only way to fix this I've seen is to uninstall and reinstall it. I haven't tried clearing app data yet, but it shouldn't be necessary.

This is done on a Samsung Galaxy S9 running Android 10.

Galaxy s4 i9505 - no BLE advertised

Hi,
Firstly great app. It will save me alot of headaches when i finally get it working.

So I got ANt+ working on my old s4 stock android 5 rom. The csc app see's me speed/cadence/HR devices and reports correct.

But, there it does not advertise a BTLE device that I can use on zwitft or anything else.

I tried changing device name to only "S4". Bluetooth is working and I've testing sharing within the bluetooth settings and my other devices can see it.

logcat doesn't give me much, and I can't see the "advertising log" as discussed in the Nexus 5 thread.
Anyone any thoughts on how to debug

Logcat:
`V/ActivityThread( 8656): updateVisibility : ActivityRecord{134a8496 token=android.os.BinderProxy@28d13336 {idv.markkuo.cscblebridge/idv.markkuo.cscblebridge.MainActivity}} show : true
V/ActivityThread( 8656): updateVisibility : ActivityRecord{134a8496 token=android.os.BinderProxy@28d13336 {idv.markkuo.cscblebridge/idv.markkuo.cscblebridge.MainActivity}} show : false
I/Timeline( 1398): Timeline: Activity_launch_request id:idv.markkuo.cscblebridge time:422439
I/ActivityManager( 820): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=idv.markkuo.cscblebridge/.MainActivity bnds=[8,780][263,1110]} from uid 10008 on display 0
I/Timeline( 820): Timeline: Activity_windows_visible id: ActivityRecord{268aeefa u0 idv.markkuo.cscblebridge/.MainActivity t78} time:422849
V/ActivityThread( 8656): updateVisibility : ActivityRecord{134a8496 token=android.os.BinderProxy@28d13336 {idv.markkuo.cscblebridge/idv.markkuo.cscblebridge.MainActivity}} show : false
I/Timeline( 1398): Timeline: Activity_launch_request id:idv.markkuo.cscblebridge time:503879
I/ActivityManager( 820): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=idv.markkuo.cscblebridge/.MainActivity bnds=[8,780][263,1110]} from uid 10008 on display 0
I/Timeline( 820): Timeline: Activity_windows_visible id: ActivityRecord{268aeefa u0 idv.markkuo.cscblebridge/.MainActivity t78} time:504296
V/ActivityThread( 8656): updateVisibility : ActivityRecord{134a8496 token=android.os.BinderProxy@28d13336 {idv.markkuo.cscblebridge/idv.markkuo.cscblebridge.MainActivity}} show : true

V/ActivityThread( 8656): updateVisibility : ActivityRecord{134a8496 token=android.os.BinderProxy@28d13336 {idv.markkuo.cscblebridge/idv.markkuo.cscblebridge.MainActivity}} show : true
V/ActivityThread( 8656): updateVisibility : ActivityRecord{134a8496 token=android.os.BinderProxy@28d13336 {idv.markkuo.cscblebridge/idv.markkuo.cscblebridge.MainActivity}} show : false
I/Timeline( 1398): Timeline: Activity_launch_request id:idv.markkuo.cscblebridge time:1336160
I/ActivityManager( 820): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=idv.markkuo.cscblebridge/.MainActivity bnds=[8,780][263,1110]} from uid 10008 on display 0
I/Timeline( 820): Timeline: Activity_windows_visible id: ActivityRecord{268aeefa u0 idv.markkuo.cscblebridge/.MainActivity t78} time:1336575
V/ActivityThread( 8656): updateVisibility : ActivityRecord{134a8496 token=android.os.BinderProxy@28d13336 {idv.markkuo.cscblebridge/idv.markkuo.cscblebridge.MainActivity}} show : true
V/ActivityThread( 8656): updateVisibility : ActivityRecord{134a8496 token=android.os.BinderProxy@28d13336 {idv.markkuo.cscblebridge/idv.markkuo.cscblebridge.MainActivity}} show : false
I/VlingoApplication(14458): VlingoApplication appVersion ='11.2.2.0.37993', ro.csc.sales_code=BTU
D/ResourcesManager( 1562): creating new AssetManager and set to /data/app/idv.markkuo.cscblebridge-1/base.apk
D/UsbSettingsManager( 820): hasDefaults: idv.markkuo.cscblebridge FALSE
V/ApplicationPolicy( 820): isApplicationStateBlocked userId 0 pkgname idv.markkuo.cscblebridge
I/ActivityManager( 820): Force stopping idv.markkuo.cscblebridge appid=10205 user=0: from pid 1562
I/ActivityManager( 820): Killing 8656:idv.markkuo.cscblebridge/u0a205 (adj 2): stop idv.markkuo.cscblebridge
W/ActivityManager( 820): Scheduling restart of crashed service idv.markkuo.cscblebridge/.CSCService in 1000ms
I/ActivityManager( 820): Force finishing activity ActivityRecord{268aeefa u0 idv.markkuo.cscblebridge/.MainActivity t78}
D/UsbSettingsManager( 820): hasDefaults: idv.markkuo.cscblebridge FALSE
I/Timeline( 1398): Timeline: Activity_launch_request id:idv.markkuo.cscblebridge time:1479736
V/ApplicationPolicy( 820): isApplicationStateBlocked userId 0 pkgname idv.markkuo.cscblebridge
I/ActivityManager( 820): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=idv.markkuo.cscblebridge/.MainActivity bnds=[8,780][263,1110]} from uid 10008 on display 0
I/ActivityManager( 820): Start proc idv.markkuo.cscblebridge for activity idv.markkuo.cscblebridge/.MainActivity: pid=15351 uid=10205 gids={50205, 9997, 3003, 3002, 3001} abi=armeabi-v7a
D/ResourcesManager(15351): creating new AssetManager and set to /data/app/idv.markkuo.cscblebridge-1/base.apk
D/ResourcesManager(15351): creating new AssetManager and set to /data/app/idv.markkuo.cscblebridge-1/base.apk
I/ActivityManager( 820): Displayed idv.markkuo.cscblebridge/.MainActivity: +659ms
I/Timeline( 820): Timeline: Activity_windows_visible id: ActivityRecord{1ecd617b u0 idv.markkuo.cscblebridge/.MainActivity t82} time:1480416
V/ActivityThread(15351): updateVisibility : ActivityRecord{14b1f217 token=android.os.BinderProxy@28d13336 {idv.markkuo.cscblebridge/idv.markkuo.cscblebridge.MainActivity}} show : false
I/Timeline( 1398): Timeline: Activity_launch_request id:idv.markkuo.cscblebridge time:1645620
I/ActivityManager( 820): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=idv.markkuo.cscblebridge/.MainActivity bnds=[8,780][263,1110]} from uid 10008 on display 0
I/Timeline( 820): Timeline: Activity_windows_visible id: ActivityRecord{1ecd617b u0 idv.markkuo.cscblebridge/.MainActivity t82} time:1646017
V/ActivityThread(15351): updateVisibility : ActivityRecord{14b1f217 token=android.os.BinderProxy@28d13336 {idv.markkuo.cscblebridge/idv.markkuo.cscblebridge.MainActivity}} show : false
I/Timeline( 1398): Timeline: Activity_launch_request id:idv.markkuo.cscblebridge time:1962490
I/ActivityManager( 820): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=idv.markkuo.cscblebridge/.MainActivity bnds=[8,780][263,1110]} from uid 10008 on display 0
I/Timeline( 820): Timeline: Activity_windows_visible id: ActivityRecord{1ecd617b u0 idv.markkuo.cscblebridge/.MainActivity t82} time:1962896
V/ActivityThread(15351): updateVisibility : ActivityRecord{14b1f217 token=android.os.BinderProxy@28d13336 {idv.markkuo.cscblebridge/idv.markkuo.cscblebridge.MainActivity}} show : false
`

Do you have apk or release available?

Thank you for your work. Do you have apk available or need to compile by myself?

I am linux user but have a Window partition just for zwift. Some days ago I tried Zwift on Lutris and works flawless but my only concern I can't bridge my Garmin HRM-TRI (Ant+) to zwfit (others sensors has bluetooth so works fine throug zwift companion). I would like to test my setup and give some feedback/PR.

Dependency not installed.

Help needed.
I am unable get get any sensors?
I am using a Samsung Note 20 Ultra.
It keeps saying Dead (Dependency not installed)
What have I done wrong.

Android Studio

On my android phone, the app stop brutally. How to do ?

Feature idea

Hope this is the right place - I notice there isn't really an app that does ANT+ to BLE bridging for FE-C and power? Is that something that can implemented in future updates? Great work by the way, I've been thinking about how I would do somthing with the Nordic nRF52832 with Arduino or similar.

Wheel size

So now everything is workin, i'd like to change the wheel size to 700x28C

is it as simple as changing

**
// 700x23c circumference in meter
private static final BigDecimal circumference = new BigDecimal("2.095");**

to

**
// 700x23c circumference in meter
private static final BigDecimal circumference = new BigDecimal("2.136");**

AM i missing anything else, i suspect i am as I think BLE advertising also incorporates 700x23c profile, but not 100% on it. Any help greatly appreciated

Crash on OnePlus 7 Pro running Android 10

I recently ran this on my OnePlus 7 Pro running Android 10 and it crashed with:

    Process: idv.markkuo.cscblebridge, PID: 19212
    android.app.RemoteServiceException: Bad notification for startForeground: java.lang.RuntimeException: invalid channel for service notification: Notification(channel=csc_ble_channel pri=0 contentView=null vibrate=null sound=null tick defaults=0x0 flags=0x50 color=0x00000000 vis=PRIVATE)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2052)
        at android.os.Handler.dispatchMessage(Handler.java:107)
        at android.os.Looper.loop(Looper.java:214)
        at android.app.ActivityThread.main(ActivityThread.java:7710)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950)

Steps to Reproduce:

  1. Run the application on a OnePlus 7 Pro running Android 10
  2. Select START BLE BRIDGING
  3. The above crash will occur

I've created a PR to resolve the issue:
#9

BLE Device Name

Firstly, top work on this. Great project!
For info, in addition to the already listed devices I can confirm it works with the OnePlus 5T (Android 10) and the Garmin HRM3-SS monitor.

On using the app for a session today I experienced a drop out of the sensors after about 40 mins. This could have been overly aggressive app/battery optimisation on my phone with this app or the Ant+ radio service? - I guess further testing will establish this.
However on scrolling back to the CSC_BLE app (I had Zwift companion in the foreground at the time) I clicked to Start BLE Bridging again and the app started reported sensor data after a few seconds. However Zwift didn't pick up the sensors automatically - I had to pair again within Zwift and it detected a totally new device. It seems the phone is advertising itself using MyPhoneName-{random number}. Is it possible to static the device name that's broadcast, so in the event of the above you wouldn't need to setup the pairing as if it's a new device?

iPad mini 6 can't connect to this app (on Samsung S8)

iPad mini 6 can't connect (tried with zwift, rouvy) to this app running on a Samsung S8, while a 2016 ipad pro can. Both iPads are running iOS 15.1. As usual my macbook pro also connects fine.

The iPad mini 6 can connect to BLE power source (Wahoo Kickr Snap) without problem though. At this moment I have no idea what's the issue. I would assume this has something to do more with the ipad mini 6 than this app.

BLE on HMD Global Nokia 7 Plus

Hi team,

So I was just having a play with this using my Nokia 7 Plus (which has ANT+ built in, even though its not listed on the this is Ant website directory), and this works. It picks up my old garmin strap, and my elite zumo. Top job!

Now, the question I have is that can the BLE devices it creates, be used within an app running on the same device as the bridge is running on? Or do you have to run the bridge on a separate device to where you want to consume the the simulated devices?

My use case is running the RGT app on my phone, whilst using the bridge app to generate the signal from my heart strap to the RGT app. The RGT app already see's my trainer as it has BLE and ANT, just need to get my old school strap linked in. I have also tried the Ghostracer app to see if it can see the BLE sensor either, but no dice.

Good work!!!

HR Sensor not detected

Hello.
The CSC BLE Bridge does not recognize my heart rate Sensor, allthough all required dependencies (ANT Radio Service and ANT+ Plugins Service) are installed.
Other bike apps (e.g. Jepster) immediately show the transferred heart rate. So ANT+ is basically working.
Any ideas how to solve this problem?
I'm trying to run the app on a Samsung S10 with Android 11.
Any help is appreciated.
With kind regards

Compatible with an other Garmin sensor

Hello,

I tested your app with an other version of Garmin sensor. It's the sensor cadence/speed together.
With this your app is functional.
Capture d’écran 2020-04-29 à 21 16 50

I have an other sensor to test. I'll keep you informed.

Support older Android

Bluetooth LE: Android 4.3 (API level 18)

See if it's possible to support older android version.

See #1

Enhancment idea: Add Widgets

I have been looking for an android widget that displays cadence that I can float over another app (using the Overlays app). If I had the skill/talent and time I'd try to figure this out myself and create my own fork. But unfortunately I have zero coding experience.

Cannot find the BLE device

Despite the application seeming to work without issues, I cannot find the BLE device from any other BLE client.
I tried using a pocophone f1 with lineageos 21 and a fairphone 5 with stock rom (android 13) as a server, and I tried to find the ble signal using both of these devices, my desktop PC and a pixel 7 smartphone running android 14, but there is no sign of the BLE signal.
I was wondering, was this application ever tested on android 13 and up?
Since I don't have much (read: any) experience with android development, any tips how I could go about troubleshooting the issue?

Screenshot_20240421-183200_CSC BLE Bridge

Defined as a cadence sensor

Hello
On my watch, a pulse sensor connected via ant+ to smartphone with CSC_BLE_Bridge is defined as a cadence sensor, not a pulse. Why is that? How to make the pulse visible on the watch?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.