Erratic behaviour MKR Wifi 1010 with relays

Hi all,
I'm experiencing several problems with a personal project. The project consist of a MKR Wifi 1010 and 2 relays boards to control persians with using buttons and a web server.

Everything works fine at startup but as time goes by the webserver turns to by unreachable and some days after the buttons doesn't work and I have to reset manually the board. I have tries some strategies without getting a finding.

Has anybody experienced similar problems? I attach the connection diagram hoping someone in the forum could give some idea to follow.

Many thanks in advance.
Alberto
ArduinoPersians.pdf (125.6 KB)

do you use String in the sketch?

You have a overflow in mind, right? My question to Juraj and maybe that helps to find out:
I use

// free mem?

Serial.print("freeMemory: ");
Serial.println(freeMemory());

#ifdef __arm__
// should use uinstd.h to define sbrk but Due causes a conflict
extern "C" char *sbrk(int incr);
#else  // __ARM__
extern char *__brkval;
#endif // __arm__

int freeMemory()
{
  char top;
#ifdef __arm__
  return &top - reinterpret_cast<char *>(sbrk(0));
#elif defined(CORE_TEENSY) || (ARDUINO > 103 && ARDUINO != 151)
  return &top - __brkval;
#else  // __arm__
  return __brkval ? &top - __brkval : &top - __malloc_heap_start;
#endif // __arm__
}

I am right that when the free memory stays constant the same i have no overflow or can i also have a crash in the heap with stable values?

Thanks for your quick reply.

I'm using string variables.
I tried this piece of code to monitor the available memory. Even I upload this amount to the cloud but at certain moment the board is not longer sending this information (I guess, the board losses the internet connection). I analyzed the uploaded data but I didn't see any changes. Free memory kept at the same level.

The code
PersianasDobleCloudNTPEuropa.ino (27.4 KB)

Hi all,

after several test, I've implemented a second power supply following the post of A34F] in [SOLVED] Wiring of a dual channel relay: HL-52S question - #3 by Aeherst

The behaviour is more consistent now but there are some problems that I've unable to solve.
First: If I reset the router, the board is not able to reconnect again to the WLAN. Anybody has suffer this problem? and How did you solve it?

Thanks in advance,
Alberto
ArduinoPersians_v2.pdf (166.8 KB)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.