echbt icon indicating copy to clipboard operation
echbt copied to clipboard

Is anyone having issues connecting to BLE on the bike?

Open lamxing opened this issue 4 years ago • 11 comments

Recently bought the ESP32 board and the BLE scan was not able to find the bike. It found a bunch of other BT devices, just not the bike for some reason. Using a BT scanner app on the phone, I was able to find the bike.

It used to work with an older ESP32 board that I've bought, but the newer ones do not seem to be able to connect. Can someone share some insights?

lamxing avatar Nov 22 '21 16:11 lamxing

I have found that I need to be pretty close to the bike and it must not be paired with any other device and the light must be blinking blue. If that's all true, I am curious what you see when you scan using BT scanned apps on the phone. Does it see one of these UUIDs

static BLEUUID     deviceUUID("0bf669f0-45f2-11e7-9598-0800200c9a66");
static BLEUUID    connectUUID("0bf669f1-45f2-11e7-9598-0800200c9a66");
static BLEUUID      writeUUID("0bf669f2-45f2-11e7-9598-0800200c9a66");
static BLEUUID     sensorUUID("0bf669f4-45f2-11e7-9598-0800200c9a66");

snowzach avatar Nov 22 '21 19:11 snowzach

Yeah on the phone it does show this serviceUUID, just can't ever see it on the ESP32. I wonder if the device itself is faulty (but tried 5 of them from 2 different vendors), or something changed in the underline lib that caused this...

lamxing avatar Nov 23 '21 07:11 lamxing

Same boat. Phone can find the echelon but the recommended board does not see it on BLE

kingdogfish avatar Mar 26 '22 14:03 kingdogfish

So someone was having issues with this, and I shipped them one of my boards after loading the software on it and it worked fine for them. I'm not sure if it's cheap copycat hardware or they changed something with the bluetooth libraries in Arduino. These are the ones I bought FWIW https://www.amazon.com/gp/product/B07DKD79Y9

snowzach avatar Mar 26 '22 14:03 snowzach

Interesting. I bought the makerfocus one. The one listed in the readme https://www.amazon.com/gp/product/B076KJZ5QM not the hiletgo version

I'll purchase one of those and give it a go. I'm watching the serial output and am seeing random devices.. I don't know enough to troubleshoot further.

kingdogfish avatar Mar 26 '22 14:03 kingdogfish

What version/integration are you using? I am going to start trying multiples. ESP32 BLE Arduino version 1.0.1 is what I am on

I removed that.

I've done some random stuff to no luck, but I am getting a device advertising now, but no serviceUUID

11:10:24.119 -> BLE Advertised Device found: Name: ECH-SPORT-105779, Address: 58:3a:93:18:1e:6b, manufacturer data: 4c001005301cea9e4e, txPower: 6

also curiously the Address is changing

edit edit edit. Power cycled bike.

11:13:34.779 -> BLE Advertised Device found: Name: ECH-SPORT-105779, Address: 58:3a:93:18:1e:6b, manufacturer data: 4c001005711cea9e4e, serviceUUID: 00001010-0000-1000-8000-00805f9b34fb

kingdogfish avatar Mar 26 '22 14:03 kingdogfish

I'm just using plain old arduino with the standard tools. Version 1.8.13 with the Heltec libraries https://resource.heltec.cn/download/package_heltec_esp32_index.json I compiled it and I uploaded a binary to the releases page of this repo.

snowzach avatar Mar 27 '22 01:03 snowzach

I'm 1.8.19 with the Heltec as well. I flashed your BIN and same exact things. So it might be hardware revision or something of the ESP chip? Or I have a newer bike and it's doing something funky.

I plug in the bike, have it really close/on the bike, and my phone can attach to it. I can use a BLE app to make it connect. ESP - no go.

Makerfocus: Chip Info:

  • Chip Family: ESP32
  • Chip Model: ESP32-D0WDQ6-V3 (revision 3)
  • Number of Cores: 2
  • Max CPU Frequency: 240MHz
  • Has Bluetooth: YES
  • Has Embedded Flash: NO
  • Has Factory-Calibrated ADC: YES

Hiletgo: Chip Info:

  • Chip Family: ESP32
  • Chip Model: ESP32-D0WDQ6 (revision 1)
  • Number of Cores: 2
  • Max CPU Frequency: 240MHz
  • Has Bluetooth: YES
  • Has Embedded Flash: NO
  • Has Factory-Calibrated ADC: YES

Or, I wonder if it's related to V1 vs V2 or V2.1 of the heltec design. I'm clearly on one of the V2 variants. The Hiletgo is also a v2 variant.

kingdogfish avatar Mar 27 '22 02:03 kingdogfish

Hmmm... the service ID doesn't look like any of the other identifiers from my bike. If you can use a bluetooth debugger on your phone and read the attributes, it might be just as simple as replacing the service IDs.

image

snowzach avatar Mar 27 '22 02:03 snowzach

I am not sure if there is an app on iphone like android where you can connect to ble devices. If you can try that and see if it emits "characteristics" with the same uuids then it must be something with the firmware and newer devices.

snowzach avatar Mar 27 '22 18:03 snowzach

update: can spoof the device using an app on my phone and the ESP connects to my device no problem at all. So I think it's an incompatibility with the bike's bluetooth and the ESP or the ESP's library. Probably the hardware itself.

So, I am able to run the generic ESP32 BLE example client test on a esp32-devkitv1 and this line pops up!

16:58:24.514 -> BLE Advertised Device found: Name: ECH-SPORT-105779, Address: e4:9b:58:9d:21:08, serviceUUID: 0bf669f0-45f2-11e7-9598-0800200c9a66

So I think we have a heltec incompatibility. Tried a random ESP32 and it DID work with your script after cutting out the display code. So! I don't know how to fork or push or request or how to do any of that on github, but I am going to find a screen/display and get it working with your glorious code

I did a dirty hack for now image

// all the heltec code and added this to the update display loop Serial.println("Cadence: " + String(cadence) + " Power: " + String(power) + " Resistance: " + String(resistance));

kingdogfish avatar Mar 28 '22 20:03 kingdogfish

Good hack!

snowzach avatar Feb 28 '23 14:02 snowzach

I was struggling with this same issue.. I believe the issue seems to be in the board manager libraries and potentially with how the ble library is reporting UUIDs. My fix was two part

  • Using ESP32 2.0.11 it works, but atleast 2.0.17 and newer don't even see the bike.
  • Change line 22 of devices.h to remove the !s.. so it looks like if(device->haveServiceUUID() || device->isAdvertisingService(deviceUUID)) {

I need to do more testing, but so far it works

boojew avatar Jul 05 '24 16:07 boojew

For anyone looking at this, I did make some code mods that need some further testing- but the current maker focus board Bluetooth antenna is underpowered for this. I upgraded to a Heltec Lora with external antenna and it now works very reliably.

boojew avatar Jul 11 '24 00:07 boojew

Feel free to open a PR, happy to accept changes if it makes it more reliable...

snowzach avatar Jul 11 '24 11:07 snowzach