BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

HM-17 support?

Hello. I have two devices HM-17 with arduino UNO, all works ok with other apps. But with Blynk I cant connnect. Blynk can find my devices, but cant connect. Authkey is ok. In serial monitor:

"[306166] Connecting…
[312166] Connecting…
[318166] Connecting…
[324166] Connecting…
[330166] Connecting…
[336166] Connecting…
[342166] Connecting…
[348166] Connecting…
[354166] Connecting…
[360166] Connecting…
[366166] Connecting…
[372166] Connecting…
[378166] Connecting…

Some ideas?

HM-17 is a bluetooth device, right?

How do you do the connection with Blynk server?
Are you triying to connect to a local server or with the online server?

My idea is that you must share more information and maybe your code too…

Right. BLE :slight_smile:

As I see for BLE devices works only in local server, but how to set local connection?

/**************************************************************

  • 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
  • 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[] = “93ede211ae324644bdeea6e81702e7e6”;

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();
}

Ok, you tried the example sketch?

Yes, Im using BlynkBlink

BLE devices do not work with any server (local or blynk cloud), as they should be connected to the blynk app on smartphone (which will resend values to the server).

You need:

  1. Add device with BLE connection type in your project
  2. Add a BLE widget
  3. Open its settings and try to connect to your board and make sure the device’s token and token (auth[]) in sketch are same

Thanks for answer, but I have tried this steps about 5 times with first and second HM-17. Blynk find both devices, but cant connect. authkey are ok.

Maybe I need change baud speed from 9600 to other?

Also I have question about PINs. Why I should connect to 10,11 on arudino when UART works on RX/TX (0,1 PINS)?

@gavron04 you could use any pins, but if your want to have a serial connection to your Arduino and simultaneous work via BLE - you need to use some other pins.

@vshymanskyy please advise on this issue

The cause could be

  • bad wiring
  • wrong baud rate
  • wrong notification setting
  • bad authentication code

To analyse the problem, run the following test program, and tell us the output of the FIRST time you run it.
The program

  • detects the baudrate
  • checks if the module responds
  • show all kinds of data of the module
  • set notification OFF (which is necessary for Blynk)

I have the best experience with baud rate 19200 or 38400.

If everything is ok, reset the module (power off, on), and run the Blynk program again but

  • uncomment #define BLYNK_DEBUG
  • check the baud rate of the module
    and tell us the output

Thanks for reply and for code. About wiring - is good I have tested.

But I have problem with code compilation.

"hm17:135: error: statement cannot resolve address of overloaded function

Serial.print©;

           ^

exit status 1
stray ‘\342’ in program"

Fixed by changing all >”< to >"<

Now:
“stray ‘\302’ in program”

“©”

@gavron04: In the above code replace “©” by “©” and try again.

@gavron04:
Sorry, one more try. Problem happens if code is posted not formated correctly.
… in the above code replace “©” by

(c) 

I.e.:

[...]

void loop() {
if (ble.available()) {
char c = (char)ble.read();
if (isPrintable(c))
{
Serial.print(c);
}
else
{
Serial.print("[");
printhex(c);
Serial.print("]");
}

[...]

Sorry about the formatting, I deleted the code in my post and reference to github now. It should compile then.

Ok. Code works good. i have changed in code tx/rx to 0,1 pins.

But I have the same situation as here > ESP8266 connection on Arduino RX / TX Ports ( Ports 0 / 1 )

“PROBLEM:
In the event I have to update my sketch on Arduino, this won’t work with the above connection as RX / TX (Ports 0/1) are connected. To upload a sketch I HAVE TO remove cables from ports 0/1…
On my project disconnecting these cables is extremely complicated… so in general not an option”

I will check 10 and 11 pins on arduino…

On 10/11 works good…

Testing baud 9600
Arduino send = AT
BLE reply = OK
Found BLE baud rate 9600
Arduino send = AT+NAME?
BLE reply = OK+Get:gavron04
Arduino send = AT+BAUD?
BLE reply = OK+Get:0
Arduino send = AT+MODE?
BLE reply = OK+Get:2
Arduino send = AT+PASS?
BLE timeout!
Arduino send = AT+VERS?
BLE reply = OK+Get:HMSoft V121
Arduino send = AT+RADD?
BLE reply = OK+RADD:49E9833XXXX
Arduino send = AT+ADDR?
BLE reply = OK+LADD:000E1702XXXX
Arduino send = AT+TYPE?
BLE reply = OK+Get:0
Arduino send = AT+POWE?
BLE reply = OK+Get:7
Arduino send = AT+NOTI?
BLE reply = OK+Get:0
Arduino send = AT+NOTI0
BLE reply = OK+Set:0

Waiting for remote connection…

How to make code with working TX,RX pin on arduino?

I would like to control by phone my board like:
phone > press vol up on blynk > send vol up via blynk to hm-17 > from hm-17 by tx/rx pins to AVR > from AVR to digital pins?

The output looks perfect, it should be possible to run Blynk on it. Can you upload the original Blynk program you wrote now, and add

#define BLYNK_DEBUG

because it is unclear to me why your Blynk program doesn’t want to connect.

It is possible to use pin 0&1 (RX/TX, Serial) to connect the BLE module, and this will improve the stability, but it is very difficult to develop without debugging information on Serial. Of course you have to use Serial instead of a SoftSerial then. Have a look at the Blynk example Serial_HM10_HC08.

On 10/11 pins works good.

[6165] Connecting…
[10488] >[02|00|01|XX]
[10530] >XXXXXXXXXXXXXXXXXXXXXX
[10531] Ready
[10531] Free RAM: 1557

So now I need look at Serial_HM10