Global Reset Arduino

Like some mine works fine for a few weeks but then freezes, a simple reset solves the problem but i dont want to do it by hand each time and i dont have the patience to figure out some incredibly specific bug.

Is there a global reset - reboot - restart - cycle power - command i can trigger automatically every couple of days? Or do I have to get a normal socket timer? but that has minimum of 1 minute so another arduino with a relay and pray it doesnt bug out like the other?

If your system involves a clock module you could trigger a reset at a certain time, if you have internet access as part of the system a time lookup perhaps?

1 Like

the clock does not turn off and on the entire device, does it?

Arduino clock will overflow after some amount of time. If you are watching for that to get bigger, you eventually run into a problem.

If the freeze is more random, you might be expecting a pulse to control your program flow that is getting lost. If there is one part of your program that always gets called, and you know something is wrong if it doesn’t get called in say 30 second, you can RST a timer each time that code is triggered. If timer expires, have it pulse the code to restart. This is called a watchdog reset.

There could be other issues, but these are probably the most likely problems. It will be heard to give much more help without knowing your code.

Thanks, i will look into the watchdog thing, i stumbled on it before but didn’t think it applied.
Here is the screen, maybe i have it wrongly set.

As coded here, the clock will probably only reset when the relay changes state. I would guess you probably want a reset every time the temperature is read, but this is not really how a watchdog reset should work.

What you have coded will always force a 3 second delay before repeating the loop. A watchdog reset would be outside your loop. The DONE from reading the sensor would reset the clock AND trigger the next cycle (assuming you want the next cycle to start as soon as possible). The next cycle would be triggered by the DONE pulse, or the clock tick (join the two using an ‘any’ node). If you just want to run the cycle every three seconds, then you don’t need to know when the cycle finishes, just let the clock pulse every 3 second and don’t worry about a watchdog reset.

1 Like

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