BLYNK
BLYNK.IO       📲 GETTING STARTED       📗 DOCS       👉 SKETCH BUILDER

Can not send data from bluetooth project to phone

hello!

i try to send values from arduino uno to my android phone (motorola xt925, android 4.4.2), via bluetooth. so far, i have tried several bluetooth modules (hc05, hc08, hm10). the result is the same, with all these modules:

i uploaded a basic sketch to the uno:

#define BLYNK_DEBUG
#define BLYNK_PRINT Serial

#define BLYNK_USE_DIRECT_CONNECT

#include <BlynkSimpleSerialBLE.h>
#include <SoftwareSerial.h>
#include <SimpleTimer.h>

char auth[] = "xxxxxxxxxxxx";

SoftwareSerial SerialBLE(2, 3); // RX, TX
SimpleTimer timer;

void setup()
{
  // This is for debug prints
  Serial.begin(9600);

  SerialBLE.begin(9600);        // Set Serial baud rate
  Blynk.begin(auth, SerialBLE);
  timer.setInterval(1000L, uptime);
}

void loop()
{
  Blynk.run();
  timer.run();
}

void uptime()
{
  Blynk.virtualWrite(V0, millis() / 1000);
  Blynk.virtualWrite(V1, "connected");
}

created a new sketch in blynk app. the strange thing is, that importing the ble widget could not find my hc8 or hm10 modules. only the bluetooth widget found them. i can connect to the modules this way. (the red led on the module remains constantly on after connecting)

when i start the project, nothing happens on the phone, apparently everything is normal.
but the values from the arduino never arrive to the phone.

if i start the debug, i got the following output:

[0] Blynk v0.4.0 on Arduino Uno
[0] Connecting...
[1000] Cmd skipped:20
[1000] Cmd skipped:20
[2000] Cmd skipped:20
[2000] Cmd skipped:20
[3000] Cmd skipped:20
[3000] Cmd skipped:20
[4000] Cmd skipped:20
[4000] Cmd skipped:20
[5000] Cmd skipped:20
[5000] Cmd skipped:20
[6000] Cmd skipped:20
[6000] Cmd skipped:20
[7000] Cmd skipped:20
[7000] Cmd skipped:20
[8000] Cmd skipped:20
[8000] Cmd skipped:20
[9000] Cmd skipped:20
[9000] Cmd skipped:20

i have checked the cables, restarted the phone, the arduino, reloaded the sketch with different settings, tried 3 different ble modules, nothing changed.

i’m not really sure what does this debug output means.
please help.

thank you!

Try disabling this line: #define BLYNK_USE_DIRECT_CONNECT
Also, hc05 is not BLE, it’s BT2.0

thank for the reply!

i have disabled the line #define BLYNK_USE_DIRECT_CONNECT, now i’ve got this on the serial monitor:

[0] Blynk v0.4.0 on Arduino Uno
[1000] Cmd skipped:20
[1000] Cmd skipped:20
[2000] Cmd skipped:20
[2000] Cmd skipped:20
[3000] Cmd skipped:20
[3000] Cmd skipped:20
[4000] Cmd skipped:20
[4000] Cmd skipped:20
[5000] Cmd skipped:20
[5000] Cmd skipped:20
[5001] Connecting...
[5004] <[02|00|01|00] ed479a2617574c8
[5104] <4ada0ac76a284ed59
[6000] Cmd skipped:20
[6000] Cmd skipped:20
[7000] Cmd skipped:20
[7000] Cmd skipped:20
[7164] Login timeout
[8000] Cmd skipped:20
[8000] Cmd skipped:20
[9000] Cmd skipped:20
[9000] Cmd skipped:20
[10000] Cmd skipped:20
[10000] Cmd skipped:20
[10164] Connecting...
[10164] <[02|00|01|00] ed479a2617574c8
[10225] <4ada0ac76a284ed59
[11000] Cmd skipped:20
[11000] Cmd skipped:20
[12000] Cmd skipped:20
[12000] Cmd skipped:20
[12285] Login timeout
[13000] Cmd skipped:20
[13000] Cmd skipped:20

yes, i know the hc05 is 2.0 only. but i’m currently trying a hc8 and a hm10, none of these is working.
it is exactly the same debug output with both.

what i would like to mention, it is strange to me: that in the blynk app, if i try to connect the modules via the ble widget, it can not find. doesn’t matter what kind of module, hc8 or hm10.

but if i use the bluetooth widget, it find all modules: hc05, hc8, hm10
anyone has experienced the same?

here are the modules i try to use:

https://www.aliexpress.com/item/SH-HC-08-CC2541-Bluetooth-4-0-BLE-Module-to-UART-Transceiver-Module-with-Transparent-Serial/32392960671.html

https://www.aliexpress.com/item/5PCS-Brand-new-Bluetooth-4-0-V2-version-bluetooth-serial-port-module-belt-logic-level-conversion/32679479617.html

the b-ble app can find succesfully the modules, and i also experimented based on this article: https://evothings.com/control-an-led-using-hm-10-ble-module-an-arduino-and-a-mobile-app/

and it worked, so i assume the modules are ok.

so, Cmd skipped:20 just means that board is trying to send uptime while not connected.
what happens after you try to connect BLE widget to the board?

if i use the ble widget in the app, i click on the blue button “connect ble device”, it is searching for a while, but could not find my ble module.

If it doesn’t display anything - the the issue might be with your phone - do you have any other device to test with?

other device to test: not yet.

but the bluetooth widget why finds and connects the modules than?
and also, the b-ble app can find them, and also the evothings app.

Yes, bet we don’t have motorola xt925 to test :wink:

yeah, i know, it is a very old and rare device. asap i will test the setup on other phones, and will comunicate the results.

maybe the phone is defective, but i use my bluetooth 2.0 jabra headset daily…
but it is logic that the bluetooth widget in blynk app finds and connects the ble modules? or it is not relevant?

Sure, you have to connect it first

no, i mean there are 2 bluetooth widgets in the bylnk app:
ble and bluetooth

the ble widget does not find my ble modules.
but the bluetooth widget (wich is theoretically for bluetooth v2, not for ble) finds and connects the ble (v4) boards.

however, i have tested the same setup with another phone, Motorola XT1572, Android Version 6.0.1, and it worked ok with ble. so, it must be something with my phone…
fortunately, the old hc-5 bluetooth 2.0 module is working now, so i will use that.

thanks again!

there’s a way to debug what’s happening on my phone when i try to connect with blynk ble widget?

i have done some experimenting today, and with exactly the same setup i can connect with other apps, like: b-ble scanner and evothings.

so, it means there is still possible to connect somehow. i have bought lots of ble modules, it would be a pity to not be able to use them…

If you are using HM10 and have problems with Blynk using BLE, check [SOLVED] Blynk and BLE using HM10 module (OK+CONN problem)

1 Like

will check it out, thanks!