Blynk+Arduino 101: Select BLE device on phone

Hello all,

I am setting up Arduino 101 with Blynk (via BLE), using a Samsung Galaxy S7. I tried to find and connect my BLE device through the Blynk app, however !the options were unreadable. On my Arduino IDE, I set my device name to be “Blynk”. Please refer to the code and screenshot below. What is the root cause of this problem?


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

  delay(1000);

  blePeripheral.setLocalName("Blynk");
  blePeripheral.setDeviceName("Blynk");
  blePeripheral.setAppearance(384);
...
}

Did you miss out: blePeripheral.begin();?

No I haven’t. It’s there in the code:


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

  delay(1000);

  blePeripheral.setLocalName("Blynk");
  blePeripheral.setDeviceName("Blynk");
  blePeripheral.setAppearance(384);
  Blynk.begin(blePeripheral, auth);

  blePeripheral.begin();

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

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

Yep, we saw such issues on our devices in some cases too - getName method for BluetoothDevice on Android returns null, so we decided to show a mac address in such case.

Usually, after a successful connect to that device Android OS somehow gets the needed name, but not always - it differs due to Android’s version or hardware, sometimes it’s just the first scan for the devices returns no name, but on the second one - it’s ok.

I’ve searched for some resolutions of this issue and found one possible way to fix it (but still I do not think it will work in 100% of cases). I could implement it and send a logging build to verify would it help or not.

I’ve added several possible updates for getting device/local name.
You could check them in the apk by the next link, to install it you probably will need to uninstall your current one.