Login Timeout with Examplecode – Arduino Uno, Bluetooth HM-10

I try to connect my arduino uno with a HM-10 bluetooth shield. I using the example code but there is always shown a login timeout. Please can you help me?

Code
#define BLYNK_DEBUG
#define BLYNK_PRINT Serial

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

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

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

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

  SerialBLE.begin(9600);
  Blynk.begin(SerialBLE, auth);

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

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

Serial Log:
[0]
___ __ __
/ _ )/ /_ _____ / /__
/ _ / / // / _ / '/
/
//_, /////_
/
__/ v0.4.3 on Arduino Uno

[82] Free RAM: 1616
[5001] Connecting...
[5001] <[02|00|01|00] fa73e531ja4e414
[5062] <9a48j55f9cdf695a62
[10122] Connecting...
[10122] <[02|00|01|00] fa73e531ja4e414
[10183] <9a48j55f9cdf695a62
[15243] Connecting...
[15243] <[02|00|01|00] fa73e531ja4e414
[15304] <9a48j55f9cdf695a62
[17364] Login timeout
[20364] Connecting...
[20364] <[02|00|01|00] fa73e531ja4e414
[20425] <9a48j55f9cdf695a62
[22486] Login timeout

hi!

  1. what phone / os are you using?

  2. can you find the module in the app with ble widget? it can connect?

  3. does your phone has internet connection?

  4. is the ble module is hooked up correctly to the arduino? module tx goes to arduino rx, and module rx goes to arduino tx pin, respectively the gnd has to be common.

  5. also - i’m not sure if it matters in this case - but always good practice to keep the order of #includes. you have:

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

but in the official blynk example it is in reversed order:

#include <SoftwareSerial.h>
SoftwareSerial DebugSerial(2, 3); // RX, TX

#define BLYNK_PRINT DebugSerial
#include <BlynkSimpleSerialBLE.h>

sometimes the order does matter.

  1. next time do not publish your auth token

Thanks for reply :slight_smile: . Here some futher information:

  1. I using an iPhone 5 with iOS 10.2
  2. In the widget I see “HMSoft” but after a few seconds the message “Can’t connect. Plese retry or choose another device” is shown
  3. Yes the phone is connected via Wifi
  4. As in the script shown RX is connected to Pin 10, TX to Pin 11, GRD and 5 V are correct, State and BRK are not used.
  5. I have dry to change the includes, but it doesn’t change anything…
  6. For exampele code I have take an old code from a delete project and modify it. So it should be safe :slight_smile:

the hm10 has a status led. it shows a steady connected status after pairing?

first of all, you have to have a steady pairing with the module, even without running any sketch on the arduino. you can verify this looking at the status led on the module, and also in the app ble widget. until you do not have this stable, it does not matter what sketch is running on the arduino, or even if the serial cables are connected or not.

are you sure the baud rate is 9600?

if you have a multimeter, please check the jumper cables for continuity, then hook up this way:
hm10 tx -> arduino pin0 (rx)
hm10 rx -> arduino pin1 (tx)

create a value display in your project @ virtual pin v0, set to push, and try to run this sketch:

#define BLYNK_USE_DIRECT_CONNECT

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

char auth[] = "fa73e531ja4e4149a48j55f9cdf695a62";

SimpleTimer timer;

void setup()
{
  Serial.begin(9600);
  Blynk.begin(Serial, auth);

  timer.setInterval(1000L, uptime);
}

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

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

It seames the bluetooth widget doesn’t work for iPhone yet. The pairing doesn’t work. Also in the widget information stands that it only work with Android. I tried to connect with another app (LightBlue) and it works directly. I like to work with blynk, so I hope that support come soon.

sorry, i didn’t knew this. i never used iphone.

@vshymanskyy, could you please include that ble is currently not compatible with iphone, also in the built in ble example in arduino ide?

i think most people read the comments in the example code, not in the app, when experimenting with new code.
from the current description, i would not think that ble it is not supported on iphone:

/**************************************************************
 * Blynk is a platform with iOS and Android apps to control
 * Arduino, Raspberry Pi and the likes over the Internet.

 * This example shows how to use Serial BLE modules (HM-10, HC-08)
 * to connect your project to Blynk.

thank you!