MQTT switch freezing

8 years 10 months ago #2809 by simsonite
Hi,

Thanks for the great work and effort that has been put on EasyIoT!

I have a problem with the MQTT switch... My problem is that it freezes after some time. My setup is a NodeMCU powered by a cell phone charger which drives a 3.3v relay which is powered by a separate 230v->3.3v converter. When powering the NodeMCU, a switch module is created and i can switch on/off a lamp N number of times. But after let's say a day of so, the NodeMCU won't respond to my requests. If i reset it, i can run it for another day.

The weird thing is however that i had it connected to a computer with debugging messages for 3 days + and had no problems what so ever. I've tried several chargers but i always lose the control of the NodeMCU after some time when it's not connected to a computer.

Any idea?
Thanks

Please Log in or Create an account to join the conversation.

8 years 10 months ago #2812 by NightOne
Replied by NightOne on topic MQTT switch freezing
I am about 90% sure its a power issue....Do you have a capacitor between the 3.3v phone charger and the NodeMCU....if not put a 1000uF cap to help the power fluctuation from the phone charger.

Please Log in or Create an account to join the conversation.

8 years 9 months ago #2818 by simsonite
Replied by simsonite on topic MQTT switch freezing
Hi again,

I did actually put a 1000uF capacitor previously but it didn't help.

Here's what I did next.
1. I had it connected to the same computer but now without a terminal so I couldn't read the debugging messages. I lost the connection to it after just a few hours.
2. I disabled the debugging messages and powered the NodeMCU with the SonyEricsson charger I used earlier and after 2.5 days, it's still running.

So, it seems that by disabling the serial output, the problem is solved. Seems like the output buffer(?) is getting full and thereafter it just stops responding. Why I didn't came to this conclusion earlier was that I have some temperature sensors which prints debugging messages (but just connected to a charger) and I haven't had a problem with them. But they are not using MQTT.

Thoughts?

Please Log in or Create an account to join the conversation.

8 years 9 months ago #2847 by HM
Replied by HM on topic MQTT switch freezing
Hi there

I got more the less the same problem.
After a while my ESP do not react on IOT commands, but I can ping the module and use the local button.

Does yours still run stable after deactivating "Debug" ?

Best
Henrik

Please Log in or Create an account to join the conversation.

8 years 9 months ago #2854 by EasyIoT
Replied by EasyIoT on topic MQTT switch freezing

HM wrote: Hi there

I got more the less the same problem.
After a while my ESP do not react on IOT commands, but I can ping the module and use the local button.

Does yours still run stable after deactivating "Debug" ?

Best
Henrik


Do you have myMqtt.subscribe("/Db/" + instanceId + "/" + String(storage.moduleId) + "/Sensor.Parameter1"); in myConnectedCb() function? In first version of program it was missing, and switch did not reconnect after disconnect. Proper function is like this:

void myConnectedCb() {
#ifdef DEBUG
Serial.println("connected to MQTT server");
#endif
myMqtt.subscribe("/Db/" + instanceId + "/" + String(storage.moduleId) + "/Sensor.Parameter1");
}

Please Log in or Create an account to join the conversation.

8 years 9 months ago #2857 by HM
Replied by HM on topic MQTT switch freezing
Thank you.

I did not have the right function. :unsure: :whistle:
I will try this, hopefully it helps - I will let you know :woohoo:

Best
Henrik

Please Log in or Create an account to join the conversation.

Time to create page: 0.497 seconds

Forum latest

  • No posts to display.