BLE / Bluetooth no longer works

Dear,

I have to say that I am a big fan of Blynk, but after spending long hours, I conclude that Blynk in reality doesn’t work on Bluetooth / BLE. I am using the Android app (2.13.2) in combination with Arduino Uno/nano connected to HM-10 or HC-06 modules, Blynk library 0.4.7. The problems I mention here, already happen using your basic example code of HM10/HC-06.

The problem are

  • the Arduino hangs in Blynk.begin, because it is expecting a response which it never gets.To enter the connected state, the android library needs to reveive a certain answer, but it never gets that answer
  • in fact the protocol misses very basis features such as synchronisation bytes. As Bluetooth/BLE often skips bytes, the software (arduino library) gets out of sync: it detects errors with length, types … But after disconnecting it is hard to connect again, as the Arduino doens’t know where to start listening.
  • after an out-of-sync, the library wants to connect again, but it then waits with sending virtualwrites until it is in connected state. However it typically remains in CONNECTING state, so it skips the writes.
  • I tried both BLYNK_USE_DIRECT_CONNECT as without, but in both cases it is not a working system.

As a result, I consider to switch to RemoteXY for my Bluetooth projects as it really supports direct communication and the protocol seems to handle communication errors better.

Some suggestions

  1. that you change the behaviour in the Android app so that it would give a response to the authentication code (when not in DIRECT_MODE)
    <[02|00|01|00]

  2. to change the Arduino library so that I doenst require a BLYNK_CMD_LOGIN authentication code each time it “disconnects” (gets out of sync)

  3. to add synchronisation bytes to the protocol when on Bluetooth/BLE

  4. to really support direct mode. This means that it should be possible to use the app (ok, not in design mode)

  5. That you handle the OK+CONN answer from HM10 when a connection is made

If you want some code/debug output, simply tell me using which module (HC-06 / HM10) and if I have to use DIRECT_CONNECT or not.

1 Like

Thanks for your detailed response,

It strange that app is not sending login response to the hardware. I’ll prepare logging build for this issue to see what does wrong with the login command from a hardware: you could use any ble/bluetooth project.

On hardware side - we need here @vshymanskyy

1 Like

@BlynkAndroidDev

The OP was bit over my head (need more coffee), but if I am interpreting it correctly, this might explain why my constantly running Solar Monitor takes time (10+sec) to connect to the app, but within a few minutes, the app then stops (as if I hit the stop button, but didn’t) and when manually restarted, takes even more time 20-30sec) to reconnect… only to repeat the cycle.

Or is my description not relevant to what @federicobusero described? If not then sorry for interjecting.

Either way, looking forward to a logging build to run if it will help you.

Guys, link to the logging ble/bluetooth build:

To send log: click on info button in the actionbar of the projects list screen and select ‘send log’ on the about screen.

If you are on Android 5.0 and later - this build should create more stable (high priority) connection to BLE devices.

1 Like

Logging build for latest app’s version:

@federicobusero could you check your issue with logging build and send us the log?