Trouble Connecting Blynk With ESP32 via BLE in ios - Invalid header type: 2

Hi all,

I’m having some trouble connecting esp32 with BLE to blynk app in ios. Connection over wifi is working seamlessly.
Details are as follows -
Hardware - both DOIT ESP32 DEVKIT V1 and Heltec Wifi LORA 32
iphone 5s with ios 12.1.4
Blynk app v2.25.0 (3)
Blynk Library v0.6.0 on blynk cloud

When I try to connect from the ble widget in blynk I get the following in the serial monitor -

Waiting for connections...
[34] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.0 on ESP32

[17399] BLE connect
[18181] >> [02|00|01|00] b0d5754818684d7
[18181] >[02|00|01|00] 
[18240] >> 5b002892be9adaebc
[18241] >b0d5754818684d75b002892be9adaebc
[18241] Invalid header type: 2
[32248] BLE disconnect
[32248] Disconnected

I have tried deleting the widget, restarting blynk, turning bluetooth on and off though I always seem to get the same “Invalid header type:2” warning. Can anyone shed any light on what might be the cause? Thanks in advance.

Cheers,
Nils

Sketch -

/*************************************************************
  Download latest Blynk library here:
    https://github.com/blynkkk/blynk-library/releases/latest

  Blynk is a platform with iOS and Android apps to control
  Arduino, Raspberry Pi and the likes over the Internet.
  You can easily build graphic interfaces for all your
  projects by simply dragging and dropping widgets.

    Downloads, docs, tutorials: http://www.blynk.cc
    Sketch generator:           http://examples.blynk.cc
    Blynk community:            http://community.blynk.cc
    Social networks:            http://www.fb.com/blynkapp
                                http://twitter.com/blynk_app

  Blynk library is licensed under MIT license
  This example code is in public domain.

 *************************************************************
  This example shows how to use ESP32 BLE
  to connect your project to Blynk.

  Warning: Bluetooth support is in beta!
 *************************************************************/

/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial

#define BLYNK_USE_DIRECT_CONNECT
#define BLYNK_DEBUG

#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[] = "myBlynkAuthCode";

void setup()
{
  // Debug console
  Serial.begin(9600);

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

  Blynk.setDeviceName("Blynk");

  Blynk.begin(auth);
}

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

Before new updates of iOs app, you can use 0.5.4 Blynk library version - it should work.

1 Like

Switching back to Blynk library 0.5.4 worked perfectly.
Thanks you sir!

1 Like

Will be fixed with the next library version (you can already try the latest master branch from github)!

Please switch to library v0.6.1, that also contains a fix for Bluetooth connectivity: https://github.com/blynkkk/blynk-library/releases/tag/v0.6.1

Right on! No trouble connecting. Thank you for the update! -

Waiting for connections...
[35] 
    ___  __          __
   / _ )/ /_ _____  / /__
  / _  / / // / _ \/  '_/
 /____/_/\_, /_//_/_/\_\
        /___/ v0.6.1 on ESP32

[16573] BLE connect
[17446] Ready
1 Like