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
-
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] -
to change the Arduino library so that I doenst require a BLYNK_CMD_LOGIN authentication code each time it “disconnects” (gets out of sync)
-
to add synchronisation bytes to the protocol when on Bluetooth/BLE
-
to really support direct mode. This means that it should be possible to use the app (ok, not in design mode)
-
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.