[BETA] ESP32 BLE initial support

split this topic #21

2 posts were merged into an existing topic: Blynk interfering with Bluetooth Serial on ESP32


just for reference: with an iPhone SE the BLE communication is working properly.
Best regards,



i’m using:
Blynk App Android 2.27.0
Blynk Lib Arduino 0.5.4
ESP32 core (last stable version)
Mobile Samsung S5

From the App i cannot connect to the ESP32 module via BLE:

From the debug module this is the output:

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.5.4 on ESP32 

[10168] BLE connect
[11874] >> [02|00|01|00] d4f4ab9b5f8b4b1
[11875] >[02|00|01|00] 
[11919] >> e9ef93e6ba69f3e1f
[11920] >**AUTH_CODE** 
[11920] Invalid header type: 2
[20919] BLE disconnect
[20919] Disconnected

Sketch is the following:

#define BLYNK_PRINT Serial

#include <BlynkSimpleEsp32_BLE.h>
#include <BLEDevice.h>
#include <BLEServer.h>

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "**AUTH_CODE**";

void setup()
  // Debug console

  Serial.println("Waiting for connections...");




void loop()


Obviously AUTH_CODE is a 32 digits code generated by Blynk

What am i missing?


Yesterday we did uploaded a new build of same version with some fixes for BLE and some crash fixes. Please check if you have the latest version. Also you need to have in the sketch the same auth token that you have in your project’s device that is used for BLE widget, so the device with BLE connection type.


Absolutelly the same setup, except Samsung A5.
Output is different:

/ _ )/ /_ _____ / /__
/ _ / / // / _ / '/
//_, /////_
__/ v0.5.4 on Arduino

[32553] BLE connect
[32553] Login timeout
[32554] <[02|00|01|00] 83fc252d29fa46a
[32554] <4846f72af9154a704
[34426] >> [02|00|01|00] 83fc252d29fa46a
[34426] >[02|00|01|00]
[34471] >> 4846f72af9154a704
[34471] >83fc252d29fa4**846f72af9154a704
[34471] Ready
[34538] <[11|00|02|00]Vver[00]0.5.4[00]h-bea
[34539] <t[00]10[00]buff-in[00]1024[00]de
[34542] <v[00]Arduino[00]con[00]Esp32_
[34544] <BLE[00]build[00]Nov 16 201
[34546] <8 12:06:21[00]
[34547] <[00|00|01|00|C8]
[34576] >> [00|00|02|00|C8]
[34577] >[00|00|02|00|C8]
[43440] BLE disconnect
[43440] Disconnected

On smartphone I see: endless Connecting
On Android tablet I see:

  1. Two copies of my ESP32 devices
  2. Debug ouput shows only last 9 symbols of auth string.

Anybody from Blynk stuff are going to solve the problem??


I have had issues connecting to BLE if I had multiple devices I was testing on.

Delete the BLE widget, then close/shutoff the App on all but one device then reload the widget and try again on that device alone.


I’m doing it permanently. One more detail:
BLE widget does not check correct device choosen, i.e. if no device was selected, BLE widget still trying to connect and hangs.

As could be seen from my first debug output, connection established for 9 seconds and then closing. If I have time to run Blynk project on phone, I see data transfer for theese 9 seconds.


From my testing, I don’t think it has that ability… it is meant to link between one phone/tablet and one BLE device, period, not pick and chose which currently active phone/tablet/App/device to connect to.

So pick the one you want to use “permanently” and test with that one alone, for now.


PS… this topic is about the BETA ESP32-BLE support… are you using an Arduino and a separate BLE module?


I did it several times.
Now the behaviours are absolutely symmetrical on Phone and Tablet:
9 seconds connection then fail. And endless Connecting… on BLE widget.


Most probably something is broken in ESP32 Arduino core.

Eps32 ble not connect by android

No, this is a side effect of choosing M5Stack-Core-ESP32 board. If I use ESP Dev Module this string is correct, but nothing changed.
See above:


OK, well, I loaded up an existing WiFi sketch and switched it over to BLE to give my own ESP32 a run…

Using the latest IDE installed core


And strangely, my sketch actually starts running a timed blinking vLED sequence while the connection attempt (according to the App) is still in progress… of course it never does connect for me either… just stays on this screen… forever???

    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.5.4 on Arduino

[220537] BLE connect
[221561] >> [02|00|01|00] d1f522be4873416
[221561] >[02|00|01|00] 
[221563] >> 79fe4b24119d89d81
[221564] >d1f522be487341679fe4b24119d89d81
[221578] Ready
[221644] <[11|00|01|00]Vver[00]0.5.4[00]h-bea
[221645] <t[00]10[00]buff-in[00]1024[00]de
[221690] <v[00]Arduino[00]con[00]Esp32_
[221732] <BLE[00]build[00]Nov 16 201
[221772] <8 04:13:56[00]
[221852] >> [00|00|01|00|C8]
[221852] >[00|00|01|00|C8]
[221866] <[10|00|02|00|06]vr[00]0[00]1
[221901] <[00|00|01|00|C8]
[222018] <[14|00|03|00|08]vw[00]3[00]255
[222518] <[14|00|04|00|06]vw[00]3[00]0
[223018] <[14|00|05|00|08]vw[00]3[00]255
[223518] <[14|00|06|00|06]vw[00]3[00]0
[224018] <[14|00|07|00|08]vw[00]3[00]255
[224518] <[14|00|08|00|06]vw[00]3[00]0
[225018] <[14|00|09|00|08]vw[00]3[00]255
[225518] <[14|00|0A|00|06]vw[00]3[00]0
[226018] <[14|00|0B|00|08]vw[00]3[00]255
[226518] <[14|00|0C|00|06]vw[00]3[00]0
[227018] <[14|00|0D|00|08]vw[00]3[00]255
[227518] <[14|00|0E|00|06]vw[00]3[00]0
[228018] <[14|00|0F|00|08]vw[00]3[00]255
[228518] <[14|00|10|00|06]vw[00]3[00]0
[229018] <[14|00|11|00|08]vw[00]3[00]255
[229518] <[14|00|12|00|06]vw[00]3[00]0
[230018] <[14|00|13|00|08]vw[00]3[00]255
[230518] <[14|00|14|00|06]vw[00]3[00]0
[230577] BLE disconnect
[230577] Disconnected

I will have to take your word for it :stuck_out_tongue: thankfully I use WiFi 99.9% of the time… that seems to work just fine :smiley:


Well, I have 3 ESP32 devices:
M5Stack Core, M5Stack Fire, ESP-WROVER-KIT and Samsung A5 + Chuwi V89.

With all possible combinations I got results as in my first post. So, I gues it was rather comprehensive experiment.

I did not try Arduino iDE yet. All tests were done with VisualMicro and platformio.


I did… and no worky either. But it did at one time, for me, back at the beginning timeframe of this topic… so later Core changes broke something.

And since esspressif is doing their own thing… until they settle down and the Blynk devs have the time, I guess this ESP32 BLE Beta is stuck in limbo.


But people made it work:

Maybe Iphone better…


But what core version used… what other differences?? You need to ask them, there, not us, here, for that.

<Crash>… sorry, I had to pick myself off the floor from laughing so hard… Shinier… perhaps in some cases. More costly… yup. But better… matter of choice (guess mine :stuck_out_tongue_winking_eye: )

That said, I did try my only iPhone (an old 4s just for this purpose) and lo and behold… my vLED actually blinked in the App… for about the same amount of time as my Android said it was working… then the iPhone disconnected just like on the Android.

But the 2nd time it stayed connected a little longer so I could run some other Blynk functions… then about 20 seconds later…

Guru Meditation Error: Core  1 panic'ed (IntegerDivideByZero). Exception was unhandled.
Core 1 register dump:
PC      : 0x400d70f3  PS      : 0x00060530  A0      : 0x800d19a2  A1      : 0x3ffd66b0  
A2      : 0x3ffc3e94  A3      : 0x00000000  A4      : 0x000000ff  A5      : 0x0000ff00  
A6      : 0x00ff0000  A7      : 0xff000000  A8      : 0x000493e0  A9      : 0x000000c8  
A10     : 0x00000000  A11     : 0x00000000  A12     : 0x0000000a  A13     : 0x0000ff00  
A14     : 0x00000001  A15     : 0xff000000  SAR     : 0x0000000a  EXCCAUSE: 0x00000006  
EXCVADDR: 0x00000000  LBEG    : 0x400014fd  LEND    : 0x4000150d  LCOUNT  : 0xffffffff  

Backtrace: 0x400d70f3:0x3ffd66b0 0x400d199f:0x3ffd66d0 0x400d1c3a:0x3ffd66f0 0x400d1f6d:0x3ffd6750 0x400d221e:0x3ffd67c0 0x400d25a1:0x3ffd67f0 0x4018a01c:0x3ffd6810


so… Score 1/2 for Apple


Third time’s a charm on the iPhone… running a stepper motor, flashing a timed vLED and running Blynk Debug… got about 1-2 minutes use before disconnection. But at least no ESP32 crash.

So something is flaky, and I still agree that the suspect is the ESP core. But then I am not a developer so I will leave it as is for the moment.


Blynk version 2.27.1
Arduino IDE 1.8.8
Blynk library release v0.5.4
still getting this … What’s the problem?


@nalindas9 We are releasing 2.27.2 into beta channel, it should fix this issue.