-
esp8266 esp-12
-
Web and Android
Hello, I am a Greek student from Western Macedonia University of Applied sciences. I want to use Cayenne my device for my thesis. I have a problem though with my program.
In serial monitor appears this message (in the photo) “Login timeout. Connecting to Arduino.mydevice.com8442”. And I can get a stable control cause of it’s constant disconnection and I struggle in controlling it. When I remove some widgets however, messages still exists but they appear in a bigger time space so I can partly control the program. I will upload some screenshots from the computer so it will be easier for you to understand the situation. I will be pleased if you can offer me any help or advice how to manage and solve this problem so I can complete the program to be fully operational.
Thanks in advance!!!
I enclose you my Code
/CODE*****/
//#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneESP8266WiFi.h
#include <Wire.h
#include <BH1750.h
BH1750 lightMeter;
int light1 = 16;
int light2=0;
int statlight1,statlight2;
int lux;
int times;
int Stemp,temp;
// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "********";
// Your network name and password.
char ssid[] = "Xaratsi";
char password[] = "ali12345632";
//char ssid[] = "FOTO";
//char password[] = "AD9294578";
void setup()
{
Serial.begin(9600);
pinMode(16, OUTPUT);
Cayenne.begin(token, ssid, password);
lightMeter.begin();
}
void loop()
{
Cayenne.run();
}
//xronos pou trexei to programa
CAYENNE_OUT(V0) {
times = millis() / 1000;
Cayenne.virtualWrite(V0, times);
}
//************fwtismos*************
CAYENNE_OUT(V8) {
lux = lightMeter.readLightLevel();
Cayenne.virtualWrite(V8,lux);
}
//fwtismos 1
CAYENNE_IN(V1) {
statlight1 = getValue.asInt();
digitalWrite(light1, statlight1);
}
CAYENNE_OUT(V2) {
Cayenne.virtualWrite(V2, statlight1);
}
//fwtismos 2
CAYENNE_IN(V3) {
statlight2 = getValue.asInt();
digitalWrite(light2, statlight2);
}
CAYENNE_OUT(V4) {
Cayenne.virtualWrite(V4, statlight2);
}
//***************thermansh*****************
CAYENNE_IN(V5) {
Stemp = 10 + getValue.asInt() / 51;
}
CAYENNE_OUT(V6) {
Cayenne.virtualWrite(V6, Stemp);emphasized text
}
CAYENNE_OUT(V10) {
temp = random(15,30);
Cayenne.virtualWrite(V10,temp);
}
Hi @1994ermes1994 and welcome to the Cayenne Community.
Could you try searching in the Cayenne library for a file called BlynkConfig.h
. Inside there should be a segment like this where you can update the network timeout period:
// Network timeout in milliseconds.
#ifndef BLYNK_TIMEOUT_MS
#define BLYNK_TIMEOUT_MS 2000UL
#endif
I’m pretty sure increasing this period will improve the ‘login timeout’ errors, but you’ll have to let us know if it improves the control of your project.
thank you for your respond i did the changes that you told me to do with 4000UL and as in the folowwing picture
in serisal monitor apperas the following message, and i still have issues with the connection.
i wish we could fugure this out.
thank you a lot.
That log does look like this made an impact on the Login Timeout error messages at least. Could you try uncommenting the //#define CAYENNE_DEBUG
line to see additional output in your serial montior log?
hi i run the program with debug and i take the below messages from serial monitor,i choose only 5 screenshots that represnend the messages that i take. I take a long like of those in the serial monitor.
image1
image2
image3
image4
image5
Can you try commenting out the read light level call in the V8 out function?
If this doesn’t return for a long time, you could get a timeout.
If this solves the timeout problem, then we can look into the lux library or wiring to see why.
Cheers,
Craig
Hello my friend! i apply the changes with 2 ways
-
First way
//fwtismos*
/* CAYENNE_OUT(V8) {
lux = lightMeter.readLightLevel();
Cayenne.virtualWrite(V8,1234);
}*/
Results:
-
second way
//fwtismos*
CAYENNE_OUT(V8) {
// lux = lightMeter.readLightLevel();
Cayenne.virtualWrite(V8,1234);
}
result
The problem continues…
And every time i change the state of widgets the Serial Monitor prints out
“[62116] Connecting to arduino.mydevices.com:8442
[62745] Ready (ping: 102ms).”
I am suspicious of power.
I’ve had issues with ESP12s resetting. My solution was to place a 50uF or better capacitor close to the ESP power supply.
How are you powering your ESP? What module? Can you post a picture?
Cheers,
Craig
1 Like
I think the problem is in the loop:
CAYENNE_OUT(V0) {
times = millis() / 1000;
Cayenne.virtualWrite(V0, times);
}
and the programm runs better when i have this loop as a comment. Nonetheless i changed the code by adding in each loop (v0, v1, v2, etc ) Serial.print (LOOP NAME), By adding this i found that the login timeout appears sometimes in the following loops v2 v4 v6 v7 as it is shown in the pictures below.
/code**/
//#define CAYENNE_DEBUG // Uncomment to show debug messages
#define CAYENNE_PRINT Serial // Comment this out to disable prints and save space
#include <CayenneESP8266WiFi.h>
#include <Wire.h>
#include <BH1750.h>
BH1750 lightMeter;
int light1 = 16;
int light2=0;
int statlight1,statlight2;
int lux;
int times;
int Stemp,temp;
// Cayenne authentication token. This should be obtained from the Cayenne Dashboard.
char token[] = "43cllmcjy8";
// Your network name and password.
char ssid[] = "Xaratsi";
char password[] = "aliona6992177732";
//char ssid[] = "FOTO";
//char password[] = "AD92943427";
void setup()
{
Serial.begin(9600);
pinMode(16, OUTPUT);
Cayenne.begin(token, ssid, password);
lightMeter.begin();
}
void loop()
{
Cayenne.run();
times = millis() / 1000;
temp = random(15,30);
// Serial.println("void loop");
// delay(100);
}
//xronos pou trexei to programa
//CAYENNE_OUT(V10) {
// Serial.println("v10");
// Cayenne.virtualWrite(V10,times);
// }
//************fwtismos*************
//fwtismos 1
CAYENNE_IN(V1) {Serial.println("v1") ;
statlight1 = getValue.asInt();
digitalWrite(light1, !statlight1);
}
CAYENNE_OUT(V2) {Serial.println("v2");
Cayenne.virtualWrite(V2,statlight1);
}
//fwtismos 2
CAYENNE_IN(V3) {Serial.println("v3") ;
statlight2 = getValue.asInt();
digitalWrite(light2,statlight2);
}
CAYENNE_OUT(V4) {Serial.println("v4") ;
Cayenne.virtualWrite(V4, statlight2);
}
//***************thermansh*****************
CAYENNE_IN(V5) {Serial.println("v5");
Stemp = getValue.asInt()/1023;
}
CAYENNE_OUT(V6) {
Serial.println("v6");
Cayenne.virtualWrite(V6, Stemp);
}
CAYENNE_OUT(V7) {
Serial.println("v7");
Cayenne.virtualWrite(V7,temp);
}
CAYENNE_OUT(V8) {Serial.println("v8") ;
lux = lightMeter.readLightLevel();
Cayenne.virtualWrite(V8,lux);
}
Try taking the delay()
statement out of your loop, these are known to cause timeout/disconnect issues with the Arduino code that we use.
Code looks fine.
What ESP are you using?
Some of them need a fat capacitor across the input supply to work right. Without it, you get this behavior intermittently.
Cheers,
Craig
1 Like
> Some of them need a fat capacitor across the input supply to work right. Without it, you get this behavior intermittently.
Most my random issues and disconnects I have traced back to power drops for whats it worth. I love the ESP but man it is touchy power wise. The projects I use a LM1117 3.3V LDO regulator on to power the ESP vs just the arduino 3.3V are solid connectivity wise. The Arduino 3.3V feed is ok but I still get random disconnects now and then even with a capacitor. Just thought I would throw my two cents in from what I’ve learned playing with those chips.
in the program that i sent you i had the delay() in comment , so the program runs without the delay().
i use the esp 8266 esp12e cp2102, i power the esp from a laptops usb port, do i still need a capacitor? and by fat you mean a 1000uF?
vapor83,
you tried withn regular power feed from the computer for example and it had more disconnections than with a capacitor and arduino feed?
In my experience you need at least 50uF.
Craig
In which one of the following connections (A or B) i will have better results?
I would say you still need a capacitor if your feeding power from your computer. Per USB standards, computers can do a max of 500ma output. This should be more than enough to power the chip but I’ve noticed any fluctuations, even very small, can cause issues.
As far as where to place the capacitor, in my opinion I would do B.I say B because I’m not familiar with how that board manages its power source. I notice there are several 3.3V and ground sources for pins. I would assume they are all just tied to one another without anything bridging between but can’t be sure. Putting the cap at B thought we know its very close to the ESP chip itself and is directly feeding it.
I wouldn’t think you should have as many problems because its a chip/board combo but its a good place to start.
As you can see I chose option B too.
However, A would probably work fine. Just note that with my testing, I needed at least 50uF before the reset problems went away. See on the left where I had to drop another cap, a 100uF across the 3.3uF I tried first. The one on the left is running a 50uF.
Cheers,
Craig
1 Like