Go Down

Topic: reset arduino with 555 (Read 10101 times) previous topic - next topic


From looking around online, I had seen that using the watchdog aspect of the arduino is not the best idea because with the arduino bootloader it can sometimes get stuck in an infinite reboot sequence which would not be good, as this device will be far far away from any other humans.

That depends on the bootloader. The advice in the Atmel datasheets say the first thing the bootloader should do is disable the watchdog timer to avoid this...

All of the bootloaders that I have looked at in the current source tree CAN clear the configuration and check to see if the reset was due to a WDT, and if so immediately start the sketch.

For example from the source "Arduino / hardware / arduino / bootloaders / atmega / ATmegaBOOT_168.c"
Code: [Select]
int main(void)
uint8_t ch,ch2;
uint16_t w;

ch = MCUSR;
MCUSR = 0;


// Check if the WDT was used to reset, in which case we dont bootload and skip straight to the code. woot.
if (! (ch & _BV(EXTRF))) // if its a not an external reset...
app_start(); // skip bootloader
asm volatile("nop\n\t");

So if you have this bootloader built with WATCHDOG_MODS defined, then you get deterministic watch-dog behaviour... and the restart-time is faster because the boot loader skips all the hanging around for a sketch download to start.

It does seem like a simple software configuration problem to me:).


UPDATE:  when the arduino drives the the 555 trigger low, the RESET pin of the arduino pin is driven low as it should, however the arduino RESET pin is staying low as the pin from the arduino is in some kind of high z state and so the trigger of the 555 is doing something strange.  Is there some way to fix this or get around the 555 problem?  maybe use a transistor on the trigger and connect the base to the arduino output pin? 
I hope this thread isn't dead yet   :(

(FYI, the schematic is as shown in the previous post)


Try this modification.  Keep in mind that the 555 is still a LINEAR device not TTL.

Capacitively couple the arduno to the 555 trigger.  I'd start with a 0.01 cap.


You can set up the 555 as a one-shot (monostable), howeverpin 3 toggles from low to high forthe one-shot time duration, then goes back low. So you'd have to put an inverter on the output,which could be a simple NPN transistor; 555 pin output 3 thru say a 1K resistor to the transistor base, collector to the arduino reset pin, and emitter to ground.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


pwillard, i wish i could give you more than 1 karma point...the circuit now works wonderfully :D

for anyone else trying who reads this post and wants a good clean restart without having to modify bootloader or any other "tricks" to reboot their arduino, below is your circuit!

Note:  The pin from the arduino must be set as an output and pulsed low to trigger a reset


the arduino bootloader it can sometimes get stuck in an infinite reboot sequence

The new "optiboot" bootloader (as used in Uno) has fundamentally correct watchdog handling.  (It uses the WDT internally to start the sketch, so it always disables it before the sketch itself starts.)


Why have the 555 in the first place?  Are you ultimately trying to start a timer (based on the 555) that resets the Arduino after some amount of time?

I suspect the motivation is  hold reset pin low for a certain period of time to guarantee correct operation.  >= 2.5us according to the datasheet - if the reset operation tri-states the I/O pins too early it would abort the reset prematurely possibly leading to an undefined state.  Hence the need for external circuit to condition the reset pulse - remember once reset has begun the I/O pins may not do what you expect!

I notice one of the schematics has a 10nF cap iniine to the trigger input - this should be replaced with 1k resistor as it can cause 5V overvoltage on the 555 trigger input, potentially damaging its protection circuit, on positive-going edges.

Another observation is that the 555 might be rather slow to reliably generate logic signals - I can't find from the datasheet whether the reset pin has schmidt-trigger or not - if not then it may need a fast rise/fall time to guarantee proper operation.  I doubt the reset pin has schmidt trigger behaviour as it is also a high-voltage progrramming mode pin.   So I'd recommend using a fast modern 555 version.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Mar 11, 2011, 12:57 am Last Edit: Mar 11, 2011, 01:04 am by pedrotome Reason: 1

the circuit now works wonderfully :D

for anyone else trying who reads this post and wants a good clean restart without having to modify bootloader or any other "tricks" to reboot their arduino, below is your circuit!

Thank you for the schematic - I've been trying to find one for ages!
I just don't understand what we're supposed to do in terms of code. Do we have to declare in the setup() that the OutputPin is HIGH and, in the loop(), whenever we want to reset the watchdog (to "pat the dog") we just do this:
Code: [Select]

digitalWrite(OutputPin, LOW);
delay(5);  // is 5ms a decent value at all???
digitalWrite(OutputPin, HIGH);


Could you please clarify with an example?

Also, how much time is the watchdog setup to wait, ie, how much time does the Arduino have to execute each loop and therefore to "pat the dog"? How can I modify that?

Thank you again! :)


The nice part of my circuit is that you don't need to continuously "pat" the dog.  whenever you want to restart the circuit, you just drive the specified arduino output pin high or low depending on how it is initialized in the setup code.  basically, the trigger pin of the 555 is held low and happy, then whenever it is triggered by arduino, the 555 sends a low to the arduino reset to restart the arduino.  the 555 then keeps it low until its satisfied (determined by threshold resistor and cap values) then sends another happy high signal to the arduino reset to keep the arduino from restarting again.

FYI, the highs and lows in the above may be flipped and reversed, its been a good long while since i built and tinkered with the circuit.  just remember, no patting of the dog in this


i am trying to find some sample code that i have to put up with the explanation


sorry, i couldnt find any sample code that i have, but really look at what pwillard has to say, it will help tremendously.

also, in the setup, set whatever pin you will use to trigger the monostable to 'output', and in the next line of code, write it to high, then  when you want to trigger a restart, write the output pin to low, which will then trigger the reset and restart your arduino.

keep in mind that what they have been saying about the inline capacitor overloading the pin, may certainly be true, never gave me any trouble.  all i can say, is that the posted circuit worked perfectly for me.  good luck


Hmm... so this is not a Watchdog Timer... My bad, then. I seem to have misunderstood.

Thanks, though!

Go Up