Hi,
Pretty new to using microcontrollers but really enjoying it so far. For my first real application i'm using a knockoff nano as a simple gate operator and it seems to keep getting hung up.
First it froze after about 12 hours which I thought was because of all the serial data I was printing to debug. So after I commented it out things were fine for over a week. Then today it needed to be reset again.
The nano is soldered to a breadboard and installed with a 4 channel relay inside an enclosure separate from the motor being controlled.
The motor being controlled uses 2 contactors powered by 24VAC for forward and reverse.
Also near the motor are two limit switches that push ground to the Arduino depending on whether the gate is currently open or closed.
To activate we have a keypad with a relay that's NO and closes for three seconds when the code is entered. Also using ground for that with internal pullup resistors for everything.
The signal that activates the relays for motor contactors are digital write High because I didn't think to move the jumpers around on the relay module. And the modules themselves are NO with the 24VAC coming off the secondary on a transformer near the motor.
The relay module is powered by the 5v pin on the nano.
The nano is powered by a 9v power supply
I thought the code was simple enough to run indefinitely without requiring intervention but that doesn't seem to be the case. I'll post it once I get to a laptop and figure out how.
I'm using two activation timers, one to count the length of the trigger pulse and one to prevent the motor from running more than 30 seconds, if for some reason the gate doesn't make it to the limit switches..
I wondered if the activation timers are causing the issue. I've read that millis() should turn over without causing issues. But maybe calling it over multiple instances for multiple timers is filling up memory?
What's more likely is I don't fully understand what I'm doing so any pointers in the right direction would be appreciated.
Here's a picture of the nano and relay module in the enclosure.