I have flashed the Electron with the Blynk example and when I go to the Blynk app it says “Particle Electron Not Connected”. I am using Firmware 0.5.3, any ideas what might be going on?
no idea at all!
can you provide any more details, or is it secret?
Sure! I am using the iOS Blynk App. And I am testing it on an Electron. Is there any other info I can provide that would make things easier to debug?
um, maybe the code you flashed?
a screenshot of the app screen?
Sometimes it just gives that message because it takes too long to connect. The connection could be established in the mean time without you seeing it. There for it’s essential to enable the BLYNK_PRINT Serial debug line and monitor the serial output of your device and see what that does.
That was great insight. The serial debug line is saying invalid auth token.
[110533] Connecting to blynk-cloud.com:8442 [111773] Invalid auth token [113293] Login timeout
I generated a new token but the same problem occurs…any ideas?
by uncommenting the debug line, I get this:
[20007] Connecting to blynk-cloud.com:8442 [21927] <[02|00|01|00] my-token-is-printed-here [22697] >[00|00|01|00|09] [22697] Invalid auth token [24157] Login timeout
well, the message is quit clear. Are you sure the token is the same in the App and the Hardware? I assume you did create an account? Does the App connect correctly to the server?
Yeah, I tried the same code on a Photon and it worked no problem. I think there is an issue with that Electron specifically. I put in a ticket with Particle to get to the bottom of it. Thanks!
I have the same issue. I get the same response trying to connect.
Connecting to blynk-cloud.com:8442
[16593] <[02|00|01|00] _my token
[17043] >[00|00|01|00|09]
[17043] Invalid auth token
[18813] Login timeout
Did you ever find a fix?
Please post your code. I think invalid token due to DNS issue.
Use ip address instead of blynk-cloud.com
When I try IP address it does not compile.
“elect_br_test.cpp:65:47: error: no matching function for call to ‘BlynkParticle::begin(char [33], IPAddress)’ Serial.println(“setup begining”);”
I am using firmware version 0.5.3
Here is my code, I figured it out how to post it.
#define BLYNK_PRINT Serial // Defines the object that is used for printing
#define BLYNK_DEBUG // Optional, this enables more detailed prints
// This #include statement was automatically added by the Particle IDE.
#include "blynk/blynk.h"
STARTUP(System.enableFeature(FEATURE_RETAINED_MEMORY));
unsigned long firstAvailable = 0;
int counter;
retained int retainedCounter = 0;
SparkCorePolledTimer updateTimer(5000); //Create a timer object and set it's timeout in milliseconds //TIMER
void OnTimer(void); //Prototype for timer callback method //TIMER
char auth[] = "my auth"; // Put your token here //BLYNK
double hiveweight = 0.0; //scale
double tempC = 0.0; //TEMPERATURE
double tempF = 0.0; //TEMPERATURE
double cellVoltage = 0.0; //powershield
double stateOfCharge = 0.0; //powershield
#define ONE_WIRE_BUS D5 //TEMPERATURE
OneWire oneWire(ONE_WIRE_BUS); //TEMPERATURE
DallasTemperature sensors(&oneWire); //TEMPERATURE
void setup() {
Serial.begin(9600);
Serial.println("setup begining");
updateTimer.SetCallback(OnTimer); //TIMER
// Blynk.begin(auth); // Here your Arduino connects to the Blynk Cloud. //blynk
// Blynk.begin("auth", IPAddress(45,55,130,102));
Blynk.begin(auth, IPAddress(45,55,130,102));
sensors.begin(); //TEMPERATURE
Serial.println("loop begining");
}
void loop() {
Serial.begin(9600);
bool cellularReady = Cellular.ready();
bool cloudReady = Particle.connected();
Serial.printlnf("cellular=%s cloud=%s counter=%d retainedCounter=%d", (cellularReady ? "on" : "off"), (cloudReady ? "on" : "off"),
counter++, retainedCounter++);
if (cellularReady) {
updateTimer.Update(); //TIMER, code executed at "void OnTimer(void) then continues here??
Blynk.run(); // All the Blynk Magic happens here... //blynk
if (firstAvailable == 0) {
firstAvailable = millis();
}
}
else {
firstAvailable = 0;
}
delay(1000);
}
void OnTimer(void) { //Handler for the timer, will be called automatically
Serial.begin(9600);
sensors.requestTemperatures(); //TEMPERATURE
tempC = sensors.getTempCByIndex(0); //TEMPERATURE
if (tempC < -126){ //ERROR FILTER, IF <-126 celsius TRY AGAIN, -196.6 F is error code for dallas temp sensor
Serial.println("FIRST TEMPERATURE ERROR");
delay(1000); //a new temp reading can take as long as 750ms
sensors.requestTemperatures(); //TEMPERATURE
tempC = sensors.getTempCByIndex(0); //TEMPERATURE
}
if (tempC < -126){ //ERROR FILTER, IF <-126 celsius TRY AGAIN, -196.6 F is error code for dallas temp sensor
Serial.println("SECOND TEMPERATURE ERROR");
delay(1000); //a new temp reading can take as long as 750ms
sensors.requestTemperatures(); //TEMPERATURE
tempC = sensors.getTempCByIndex(0); //TEMPERATURE
}
tempF = tempC * 9.0 / 5.0 + 32.0; //convert celsius to Fahrenheit //TEMPERATURE
tempF = round(tempF*10)/10; //round to first decimal place //TEMPERATURE
Serial.println("TEMPERATURE F");
Serial.println(tempF);
Blynk.virtualWrite(V29, tempF); //BLYNK, electron BR
}
I tried (“blynk-cloud.com”,8442) not sure what the debug output means? Not getting data on the Blynk app.
void setup() {
Serial.begin(9600);
Serial.println("setup begining");
updateTimer.SetCallback(OnTimer); //TIMER
// Blynk.begin(auth); // Here your Arduino connects to the Blynk Cloud. //blynk
// Blynk.begin("auth", IPAddress(45,55,130,102));
// Blynk.begin(auth, IPAddress(45,55,130,102));
Blynk.begin (auth, "blynk-cloud.com ", 8442);
setup begining
[5787] Blynk v0.4.0 on Particle Electron
[6787] Connecting to blynk-cloud.com :8442
[6807] Cmd skipped:2
[6807] Connecting to blynk-cloud.com :8442
[6817] Cmd skipped:2
[6817] Connecting to blynk-cloud.com :8442
[6827] Cmd skipped:2
[6827] Connecting to blynk-cloud.com :8442
[6837] Cmd skipped:2
Looks like I figured it out. This is my flailing around with various blynk.begins. Finally the last one worked. Its always the last one that works. That is not my actual token. I just prefer the examples to be painfully explicit. Non programmers like me will try “Token” before realizing they mean the AUTH TOKEN from your app.
// Blynk.begin(auth); // Here your Arduino connects to the Blynk Cloud. //blynk
// Blynk.begin("auth", IPAddress(45,55,130,102));
// Blynk.begin(auth, IPAddress(45,55,130,102, 8442));
// Blynk.begin (auth, "blynk-cloud.com ", 8442);
Blynk.begin("22e81c4ja71f5kdis2918dc93t9d9211", IPAddress(45,55,130,102), 8442);
Is this fix ok to use indefinitely? Is it a workaround that will cause problems down the road? If I was submitting a product to market?