Hi
my project depends on that ESP 32 keeps working 24/7 reading from energy meter PZEM004T using UART (RX TX) and sending the reading through wifi to my firebase
but it works for weeks or sometimes a few days before it stops functioning .. not reading, not sending and not blinking the built-in LED ( it blinks for every loop ) until I reset the esp
my code is a bit long and messy .. but I was sure for every "for" or "while" loops I used a delay to prevent watchdog problems
please any suggestions ... I can't access the Serial monitor when it freezes.. once I try everything reset and no error to see
Leave your Serial monitor connected until it crashes, hopefully you get a stack trace. That'll be helpful to get an idea of what's going wrong. Clean up your code, that can also help finding the problem. Get rid of all uses of String.
wvmarle:
Leave your Serial monitor connected until it crashes, hopefully you get a stack trace. That'll be helpful to get an idea of what's going wrong. Clean up your code, that can also help finding the problem. Get rid of all uses of String.
how can i make it connected for weeks :>
I used many strings .. could this be the problem?
most of them are directly by the Serial.print .. I mean like Serial.println( "starting reading from sensor number 1" )
strings are not the problem, Strings are (that capital is a key difference).
And of course you should put all those string constants in PROGMEM. Use the F() macro and friends. That saves heaps of RAM, and while the ESP32 has a lot it's not a resource you should waste like that.
Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?
Do you have bypass capacitors ?
How are you powering your project?
Have you got your component and wiring layout so it does not come near the mains current wiring?
A picture of your project will help immensely.
wvmarle:
What is the purpose of U1, and why are there all those green "no connect"(?) X-es in its connections?
not sure what EasyEDA does, but my auto trace will connect all of the same designated pins and will show errors if a pin is not connected or not x'ed out.
delay(0) and yield() might be the same.
delay(1) adds a millisecond of nothing.
And it might put the ESP32 in sleep mode (it does on an ESP8266).
Leo..
wvmarle:
On the ESP, the delay(0) command actually does something useful: it's the equivalent of yield().
Wawa:
delay(0) and yield() might be the same.
delay(1) adds a millisecond of nothing.
And it might put the ESP32 in sleep mode (it does on an ESP8266).
Leo..