MQTT switch freezing

8 years 9 months ago - 8 years 9 months ago #2878 by HM
Replied by HM on topic MQTT switch freezing
Yes ;)
And my setup is a 5V switchmode supply to drive a relay through a 2N2222, and reducing the voltage for the ESP with a AMS1117 to 3.3V. with a capacitor on the output.

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

8 years 9 months ago #2879 by simsonite
Replied by simsonite on topic MQTT switch freezing
I did disable DEBUG. But that's fantastic if debug works! So it seems like the whole freezing issue had to do with the faulty function then? I added a 1000uf capacitor also.

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

8 years 9 months ago #2887 by ArneiO
Replied by ArneiO on topic MQTT switch freezing
Thank you! I have been scratching my head as to why my modules have been dropping out regularly. I have now reprogrammed them - and so far they appear stable.

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

8 years 9 months ago #2888 by ArneiO
Replied by ArneiO on topic MQTT switch freezing
I recommend the following "trick" for debug printing to serial port.

Insert this code in the start of the sketch:
//#define DEBUG
#ifdef DEBUG
  #define DEBUG_PRINTLN(x)  Serial.println(x)
  #define DEBUG_PRINT(x)    Serial.print(x)
#else
  #define DEBUG_PRINTLN(x)  //Do nothing
  #define DEBUG_PRINT(x)    //Do nothing
#endif

Then use DEBUG_PRINTLN(x) in stead of Serial.println(x) etc. When #define DEBUG is commented out, all serial printing is removed from the code.

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

8 years 9 months ago #2897 by ArneiO
Replied by ArneiO on topic MQTT switch freezing
I have three modules.
Two of them are analog output modules (LED faders), they are now stable after inserting the MQTT subscribe in myConnectedCb().

The third is a Generic (AI, DI) input module, that publish temperature, humidity and luminosity at regular intervals. This module still freeze after inserting MQTT subscribe in myConnectedCb(). I believe the subscribe should be inserted elsewhere in an Input module.
I am now testing with MQTT subscribe in myPublishedCb(). Will report back if it works.

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

8 years 9 months ago #2900 by simsonite
Replied by simsonite on topic MQTT switch freezing
I hate to this but today, my ESP stopped responding again... I've had it online for maybe 4-5 days and today it stopped. I have connected the relay output pin to pin 5 which is the same as the blue led on the NodeMCU is connected to and the blue led is lit but the relay is off and I can't switch it on/off.

What about you guys, still online? My setup is, as I wrote earlier, a cheap 230V -> 3.3V charger from china which powers both the NodeMCU and the relay and I've added a 1000uf capacitor between 3.3V and ground. Debug is off and I have the new software.

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

Time to create page: 0.532 seconds

Forum latest

  • No posts to display.