MQTT switch freezing

4 years 8 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.

4 years 8 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.

4 years 8 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.

4 years 8 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.

4 years 8 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.

4 years 8 months ago #2859 by simsonite
Replied by simsonite on topic MQTT switch freezing
@Henrik,

I have had it connected to an iPhone charger now for 4 days (DEBUG disabled) and counting with the "old" software and still no problem. By old software I mean the one where the myConnectedCb() function did not have the myMqtt.subscribe("/Db/" + instanceId + "/" + String(storage.moduleId) + "/Sensor.Parameter1"); line. So thanks EasyIoT for the updated function! Any other changes?

I did however have the same problem when having it connected to a cheap China charger. I thought everything was fine (DEBUG disabled), it was online for roughly 3 days but then I lost the connection to it. So there seems to be several causes for this...

1. First, I assume you need a really stable charger (will try again to add capacitor to NodeMCU and try the China charger once more). Otherwise the iPhone charger seems to do the trick.

2. Replace the old software with the new.

3. Have DEBUG disabled.


That should do it...? What do you think EasyIoT?

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

Time to create page: 0.224 seconds

Forum latest

  • No posts to display.