Android - Arduino Nano - HM-10 BLE authentication token problem

I try to use the HM-10 module on an Arduino Nano controlled by the Blynk app on Android.

The Andoid app tells “Can’t connect. Please check authentication token”

On the Serial of the Arduino Nano I see

[499] Blynk v0.3.7 on Arduino Nano
[499] Connecting…
[9254] Invalid token

What could be the problem?

The token I used for this BLE-project is
“34ef0ca553014fae9a618a34e4a9593b”;

Federico

Thanks, let us re-check…

I found the auth code from my project didn’t work. I had to connect Bluetooth with debug on so I could see the auth code being sent and use that. Bug in the app maybe?

Yes, you’re right. It will be fixed in the next release.

1 Like

I finally get the HM-10 working. The trick was to use the SoftwareSerial-example as base code instead of the HM-10 example code.

So my code now looks like this, and this works!:

/**************************************************************
* 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
 *   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 Serial BLE modules (HM-10, HC-08)
 * to connect your project to Blynk.
 *
 * NOTE: BLE support is in beta!
 *
 **************************************************************/

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

#include <SoftwareSerial.h>
#include <BlynkApiArduino.h>
#include <Adapters/BlynkSerial.h>

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

typedef BlynkTransportSerial<SoftwareSerial> SwSerialConnection;

SoftwareSerial SwSerial(10, 11); // RX, TX
SwSerialConnection connection(SwSerial);
BlynkSerial<SwSerialConnection> Blynk(connection);

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

  Blynk.begin(auth,9600);
}

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

1 Like

Fixed. Please update to latest Blynk app.

After updating the app to the latest version, the problem is indeed solved. I added my example code here. Remark that I use SoftwareSerial and set the pins, I think this is easier for example code as I assume most will start like this.

/**************************************************************
 * 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
 *   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 Serial BLE modules (HM-10, HC-08)
 * to connect your project to Blynk.
 *
 * NOTE: BLE support is in beta!
 *
 **************************************************************/

//#define BLYNK_DEBUG
#define BLYNK_PRINT Serial

#define BLYNK_USE_DIRECT_CONNECT

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

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


SoftwareSerial SerialBLE(10, 11); // RX, TX

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

  SerialBLE.begin(9600);        // Set Serial baud rate
  Blynk.begin(auth, SerialBLE);
}

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

A post was split to a new topic: I can’t connect to the HM-10