MKR Freezes after 1 job

Hi
I´m buiding a water dispenser machine with 8 buttons, 1 water flow sensor, 5 relays, PH, TDS and water opacity sensors, all controlled by an Arduino MKR GSM 1400 that will send data to a database.

Right now i'm struggling with the stability of the system. When i press 1 button to fill up a water bottle everithink works ok. However in the end oj the job of button 1, the arduino board freezes and stop working.

The water flow sensors and the relays uses the 5v pin to power them up and the control pins connected to a logic level converter because the mkr 1400 only supports 3.3v.

The buttons and sensors are conected using the vcc (3.3v).

Could it be something relatted with the interrupts of the water flow sensor? I put the sketch in an attatchment because is to long to post it. Thanks in advance.

sketch (3).txt (10.5 KB)

Have you tried using another power supply for anything that draws significant current?

Your code looks OK at a glance, sounds like a power supply issue.

How much if the code can you test without using relays, like use LEDs as stand-ins?

a7

There's a lot of repetitive code in there. Seems like some arrays would be a welcome simplification.

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