I think the crashes are due to the relay module becuase I tried letting it work without loads on a pretty high freuency of activation/deactivation of the relays (every minute) and it didn't crash for more than a hour. That said, maybe I've been lucky but with the loads it happens sooner than after a hour. Another thing that comes to my mind is that the project is programmed to start one relay on a given time frequence (= 1 min on and 4 off), the other relay is activated when the sensor signal the humidity is below a given level and it runs until it reaches another higher level. I tried let it run just on a time table (3 cycles of 1 min on and 4 off for the fan and 1 cycle for the humidifier and the stability seems higher, still crashes after x cycles though)
As @anon35827816 said, there could be some problem with the I2C since the 2 things that most often crash are the LCD module and the SHT sensor, that are on the same I2C connection.
@TomGeorge I'm using a bluepill F103C8. The display is close to the board.
This is the wiring:
The relays module pins were initially near the SHT pins, then I moved them away from the matrix board. I'm not sure it helped. The power is given to the MCU through the USB.
