knolleary / pubsubclient

A client library for the Arduino Ethernet Shield that provides support for MQTT.
http://pubsubclient.knolleary.net/
MIT License
3.84k stars 1.47k forks source link

Client MQTT_Arduino has exceeded timeout, disconnecting. - Mosquitto server #937

Open KissGe83 opened 2 years ago

KissGe83 commented 2 years ago

Dear All,

First of all, apologies, because I think this is not the issue of the PubSubClient, but I cannot find a better place to ask my question. I have an Arduino Due with W5500 Ethernet shield.

I would like to control a little servo motor to be able to open my grill's airflow vent, so I would like to use the Servo library. I have an OpenHAB system inside of my home, I run several Arduino and ESP devices with PubSubClient, PubSubClient is the heart of my automation, the communication is happening via MQTT.

Unfortunately, my last project is not working, the MQTT server drops the connection after several seconds with my new Arduino Due. I made a lot of tests and realized if I set up the Servo.h in the Setup section (Servo1.attach(SERVOPin);) the MQTT client is not working anymore. If I uncomment it, the connection is great again, there is no issue, moreover, there is a problem with serial communication as well if I include Servo.h . I'm not a big coder guy, I looked into Servo.h and I realized it might cause some interrupt or timing issue which conflicts with PubSubClient (and Serial).

Do you have any experience like this? I found another project where MQTT and Servo were working together fine...

Much appreciated your ideas and help.

Kindest Regards, Gergely

PS.: Servo version is 1.1.8 by Arduino, PubSubClient is 2.8.0

IronBamBam1990 commented 2 years ago

Give some script to analyze and debug . Its can be 100 reasons