I am creating a system of 10 nodemcu(s) communicating and sharing data over painlessmesh. Each of these is powered by 240V to 3.3V power supplies. One of these nodes is designated to

  • collect the data from the mesh
  • disconect from the mesh
  • connect with a given internet network via wifi
  • send the data via a REST API
  • reconnect to the mesh

This is done every 3 minutes.

My problem is that although the system works well (from sharing the data over the mesh to making the API request) for a few hours, later on the nodes start dropping, and once they do, they never join the network unless I power cycle them manually. I'd like to log all exceptions/errors (which will appear on the serial monitor) which might be leading to this behaviour.


PS: Happy to get any advice on the system architecture

  • Exceptions are not handled by your code. That's the point of exceptions. To log them you'd need to physically attach some device to the serial port to do the logging. – Majenko Jan 22 at 11:25
  • do you use String or other heap memory allocation? – Juraj Jan 22 at 11:31
  • @Majenko Logging using another device is a good idea. I'll do that. Earlier, I was thinking on the lines of bash, where we can write all the terminal output using > operator – Ritvik Jan 22 at 13:25
  • @Juraj You mean after uploading the code I can print memory allocations and see them on the serial monitor? I did that. They appear to be normal in the short term. I want to be able to see the output around the time of failure. – Ritvik Jan 22 at 13:31
  • You're performing some action every three minutes and crashing on the order of hours. So... what happens if you do these things ever 30 seconds or 3 seconds? I realize this isn't an answer to your question as asked, but it may help to have a shorter debug cycle, whether you're logging or exceptions or not. – timemage Jan 23 at 0:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.