Hello,
Apologies if this has already been answered but I have spent 2 solid days scouring the forum and my issues still are not fixed.
I am trying to build a simple temperature / humidity sensor for environmental monitoring on an Arduino Nano which communicates to Blynk (library version 0.54 / app verson 2.27.1) on Andrioid version 8.0.0 on a Galaxy S8.
The hardware being used is an Arduino Nano + DSD Tech HM10 BLE module.
Just to update on what I have already checked, I was originally using software serial and having the exact same issue and was using the correct 10 / 11 pins for RX / TX.
About an hour ago to check if software serial was the issue I moved to Altsoftserial on pins 8 and 9 RX/TX. Getting the exact same issue.
I have tested the BLE module with App Inventor 2, this works perfectly however app inventor doesn’t have some of the features I need well documented so I thought as I have a relatively tight deadline, Blynk would be easier.
Also if I beam out temp data through BLE and test with any BLE scanner, I can see the temp data being logged and beamed over bluetooth.
All the issues with the system appear to be with the Blynk app. I can rarely (1 in every 20+ tries) get the app using the BLE widget to connect, the blinking LED on the HM10 turns solid to show a connection has been made. This will then disconnect after 30 seconds or so.
In the serial I mainly just get connecting… login timeout.with the Auth token packets being beamed out in 2 times (I assume as it is over the 20 char limit).
When it does connect, I cannot get anything to show up in the app in any of the widgets. I am pushing to virtual pin V5 but I have never managed to get any data show up.
Below is the latest incaration of code, I am using the Blynk example code which generates random fake temp data (I wanted to eliminate any issues with the analog pin read), and dumps it to V5.
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
Follow us: http://www.fb.com/blynkapp
http://twitter.com/blynk_app
Blynk library is licensed under MIT license
This example code is in public domain.
*************************************************************
Warning: Bluetooth support is in beta!
You can construct and display any strings on a Value Display.
App project setup:
Value Display widget attached to V5
*************************************************************/
/* Comment this out to disable prints and save space */
#define BLYNK_PRINT Serial
#define BLYNK_DEBUG
#include <AltSoftSerial.h>
AltSoftSerial SerialBLE;
#include <BlynkSimpleSerialBLE.h>
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "6fe0f069xxxxxxxxx868cec630584d5";
BlynkTimer timer;
// This function sends Arduino's up time every second to Virtual Pin (5).
// In the app, Widget's reading frequency should be set to PUSH. This means
// that you define how often to send data to Blynk App.
void sendTemperature()
{
// Generate random temperature value 10.0 to 30.0 (for example)
float t = float(random(100, 300)) / 10;
// Format: 1 decimal place, add ℃
String str = String(t, 1) + "℃";
// Send it to the server
Blynk.virtualWrite(V5, str);
}
void setup()
{
// Debug console
Serial.begin(9600);
SerialBLE.begin(9600);
Blynk.begin(SerialBLE, auth);
Serial.println("Waiting for connections...");
// Setup a function to be called every second
timer.setInterval(1000L, sendTemperature);
}
void loop()
{
Blynk.run();
timer.run();
}
Debug serial output:
[2349029] <[02|00|01|00] 6fe0f069xxxxxx
[2349071] <ab5868cec630584d5
[2352112] Login timeout
[2354112] Connecting...
[2354112] <[02|00|01|00] 6fe0f069xxxxxxx
[2354154] <ab5868cec630584d5
[2357195] Login timeout
[2359195] Connecting...
[2359195] <[02|00|01|00] 6fe0f0xxxxxxxx
[2359237] <ab5868cec630584d5
[2362278] Login timeout
[2364278] Connecting...
[2364278] <[02|00|01|00] 6fe0f0xxxxxxx
[2364320] <ab5868cec630584d5
[2367361] Login timeout
[2369361] Connecting...
[2369361] <[02|00|01|00] 6fe0f06xxxxxxxx
[2369403] <ab5868cec630584d5
When it actually manages to connect, I can see the data being beamed over in the debug:
[503357] Ready
[503373] Free RAM: 1155
[503400] <[00|00|01|00|C8]
Waiting for connections...
[504469] <[14|00|02|00|0C]vw[00]5[00]10.7[E2|84|83]
[505469] <[14|00|03|00|0C]vw[00]5[00]14.9[E2|84|83]
[506469] <[14|00|04|00|0C]vw[00]5[00]17.3[E2|84|83]
[507469] <[14|00|05|00|0C]vw[00]5[00]15.8[E2|84|83]
[508469] <[14|00|06|00|0C]vw[00]5[00]23.0[E2|84|83]
[509469] <[14|00|07|00|0C]vw[00]5[00]17.2[E2|84|83]
[510469] <[14|00|08|00|0C]vw[00]5[00]24.4[E2|84|83]
[511469] <[14|00|09|00|0C]vw[00]5[00]17.8[E2|84|83]
[512470] <[14|00|0A|00|0C]vw[00]5[00]22.3[E2|84|83]
[513357] <[06|00|0B|00|00]
[513469] <[14|00|0C|00|0C]vw[00]5[00]20.9[E2|84|83]
[514469] <[14|00|0D|00|0C]vw[00]5[00]14.0[E2|84|83]
[515469] <[14|00|0E|00|0C]vw[00]5[00]26.5[E2|84|83]
[516358] <[06|00|0F|00|00]
[516469] <[14|00|10|00|0C]vw[00]5[00]19.2[E2|84|83]
[517469] <[14|00|11|00|0C]vw[00]5[00]14.2[E2|84|83]
[518469] <[14|00|12|00|0C]vw[00]5[00]28.7[E2|84|83]
[519359] <[06|00|13|00|00]
[519469] <[14|00|14|00|0C]vw[00]5[00]20.3[E2|84|83]
[520469] <[14|00|15|00|0C]vw[00]5[00]22.7[E2|84|83]
[521469] <[14|00|16|00|0C]vw[00]5[00]22.9[E2|84|83]
[522357] Heartbeat timeout: 522357, 503356, 519359
Also when it does connect, I notice it manages to send the full Auth token properly (not split into 2 lines)
[503254] <[02|00|01|00] 6fe0f06xxxxxxxxxx
[503294] <ab5868cec630584d5
[503334] >[02|00|01|00]
[503335] >6fe0f06xxxxxxxxxb5868cec630584d5
[503357] Ready
[503373] Free RAM: 1155
[503400] <[00|00|01|00|C8]
Waiting for connections...
I am all out of ideas on how to solve this. I have tested every piece of example code and cannot get anything to connect consistently and when it connects I have never received a single value in the Blynk app.
Any help would be appreciated, I have tried to be as comprehensive as possible and apologies if my post is messy, had a couple of sleepless nights on this one!
Thanks!