Hello
I have an arduino project with some sensors, and I'm planning to run my project for a long time.
I want to reset the arduino every 1 day (for example).
Can any one help me.
Hello
I have an arduino project with some sensors, and I'm planning to run my project for a long time.
I want to reset the arduino every 1 day (for example).
Can any one help me.
I want to reset the arduino every 1 day (for example).
Why?
Can any one help me.
Connect a servo and an RTC. Every day, rotate the servo until it presses the reset button.
I think if I run the arduino for along time may its hang up. (Just refresh)
I think if I run the arduino for along time may its hang up.
Not if you write the code correctly and provide a proper power supply
So, no way to soft reset it after defined time ?
You will not be able to perform a reset which resembles turning power off and on - you would need some extra hardware for this. But you can use the watchdog timer to perform a "soft" reset which will basically reset/reload your sketch. This should also do the same:
asm volatile ("jmp 0");
On all AVR processors the reset vector is in memory location 0x00.
Two ways you can do this with software, via a pointer or an assembly instruction,
Pointer
void (* re_set)(void) = 0x00;
Assembly
#define re_set() __asm__ __volatile__("jmp 0x00 \n")
Either can be invoked with re_set();
#include <avr/wdt.h>
and
wdt_enable(WDTO_15MS); // self reset after 15 milliseconds
I have used this device https://smile.amazon.com/gp/product/B01KZP9XTI/ref=oh_aui_search_detailpage?ie=UTF8&psc=1 Icstation Adjustable Timer Module Time Delay On Off Control Switch Board 10s to 24h, to cause a reset to the reset pin of the Arduino to happen. In time, I found the Arduino, with well written code, to run for months on end without needing to be reset.
Nothing that I have seen in this thread has convinced me that a periodic reset is needed but we have no details of what the OP is doing with the Arduino.
The effect on the running system of resetting the Arduino also cannot be ignored. The program would have to be written such that a reset would not adversely affect whatever the Arduino is doing. To me that means adding more complexity, code, logic and possibly hardware whereas writing the program in the simplest possible way would reduce the complexity and increase the chances of getting it right.
amr002eg:
I think if I run the arduino for along time may its hang up. (Just refresh)
Its a microcontroller, not some flaky version of Windows!
If you have reliability issues there is a reason that needs investigating and fixing - hardware
interference, software bug.
If you need the extra peace of mind, then an external watchdog timer chip is likely the answer, perhaps
running off an entirely different power supply (in case power supply issues are causing the failures).
MarkT:
Its a microcontroller, not some flaky version of Windows!
Amen