No connexion in arduino project

My project runs properly and the connection is ok from the beginning but, sometimes it disconnects and connect again by itself (after 2-4 seconds). Is it normal?. Can i avoid it ?.

Thank you.


what is the serial monitor output during the disconnect?

This is the serial monitor´s message during a disconnect/ re-connect cicle.

[105937] Disconnected
[105937] Connecting to
[106212] Connected

add #define CAYENNE_DEBUG in the code and share the serial monitor output.

I am getting a similar result in the serial monitor

[52659] Disconnected
[52659] Connecting to
[52956] Connected

can you share your entire code.

This is the result after 5 minutes running. I have checked and the diconnections occurs when i run the mobile phone app and press buttons.

[1560] IP:
[1561] Connecting to
[2439] Connected
[56914] Disconnected
[56915] Connecting to
[57198] Connected
[89306] Disconnected
[89307] Connecting to
[89570] Connected
[133065] Disconnected
[133066] Connecting to
[133330] Connected

seems an issue with your device.

I have bought a new arduino´s internet shield (i was working with a W5100 model and now, I´m working with a W5500 one) but the problem doesn´t disappear. It is connecting and disconnecting continuously from cayenne´s server.

I´m desesperate because i don´t have any idea about the problem and i don´t make my project because it´s a home made alarm system, that´s why it has to be running without interrupts.

do you have any idea?.

Thank you in advance.


you can try using esp device. I had kept it running for 24hrs straight and did not disconnect.

will, keep an arduino device in simillar and see if it disconnect on long run.

can you share the arduino code you have uploaded?

I have an ESP8266 device but i am not able to connect my arduino to internet (using this device). ¿Could you send me an example of arduino code and a connection diagram (wire diagram) in order to check my ESP device?. I look for a valid example in internet but, i don’t find anything.

Thank you.

which esp device are you referring to. can you share a link of it?

This is my device:

do you have an arduino mega? the esp as shield is stable only for arduino mega as it has secondary serial pins Cayenne-MQTT-Arduino/ESP8266Shield.ino at master · myDevicesIoT/Cayenne-MQTT-Arduino · GitHub

I have both models UNO and MEGA but i was working with the ESP connected to the UNO one. I´m going to change to MEGA one.

Could send me the wire diagram for this example?.

Than you

ESP ----- MEGA
VCC ---- 3.3v
GND ----- GND
TX ----- RX1
RX ----voltage divider— TX1

you will need a voltage divider.

What is the library what i have to use?. I´m getting an error message because the code use #include <CayenneMQTTESP8266Shield.h> i have download the library cayenne mqtt arduino master but i get the error while compiling the code.

Thank you

Install the library via the Arduino IDE (Sketch->Include Library->Add .ZIP Library) from the Cayenne extras/libraries folder
(e.g. My Documents\Arduino\libraries\CayenneMQTT\extras\libraries) to compile this example.

i get “ESP is not responding”, i think that ESP needs a previous SET UP process.