The Watchdog Timer on Arduino

Поделиться
HTML-код
  • Опубликовано: 9 июл 2024
  • In this video we take a look at the Watchdog Timer on Arduino and the three different ways to configure it. We show a simple example using the Watchdog Timer and you can find the code from the example at the ForceTronics Blog forcetronic.blogspot.com/2016/...

Комментарии • 52

  • @teodorvasile3301
    @teodorvasile3301 2 года назад +2

    Firstly thank you for this informative video. It really shows all the different settings of a watchdog timer. For me the "Interrupt" only configuration of the WDT worked fine, but the other two didn't work properly. In both cases "Reset" and "Interrupt+Reset" configurations the reset happened instantly, as if the configured time interval for the WDT was not taken into account.
    I spent some time in trying to solve this out and found a solution, which is to disable all interrupts with "cli()" before setting the WDT in the "setWDT()" function and ultimately activate all interrupts again with "sei()". Now everything works as intended and hopefully this solution helps others as well.

  • @znklnkrt2944
    @znklnkrt2944 2 года назад +4

    Your videos are really good. Probably the best i've ever had the privilege to come across. thank you for your time and effort.

  • @musicbykinesthetics
    @musicbykinesthetics 5 лет назад +2

    Great explanation, thanks!

  • @ronen124
    @ronen124 8 лет назад

    nice and clear exposition, thanks

  • @theovannieuwenhuizen5756
    @theovannieuwenhuizen5756 5 лет назад +2

    Kudos, very informative!

  • @eriklaken1025
    @eriklaken1025 5 лет назад +2

    Thank you, i am learning this item and getting al the peaces to getter. :)

  • @BGLENN-dp4tx
    @BGLENN-dp4tx 5 лет назад +2

    Great work. Thanks.

  • @arvand26
    @arvand26 3 года назад

    on Atmega8A I compile and showing error --'WDTCSR' was not declared in this scope-- in atmega328 no problem

  • @gus_smith
    @gus_smith 7 лет назад +1

    This is interesting. Is the watchdog reset similar to pressing the reset button manually?

  • @sonuguru143
    @sonuguru143 Год назад

    Hello Sir,
    I need your help.
    I want to set watchdog timer for my arduino program.
    My condition is if digital read pin 5 goes low for max. 8 second then arduino should reset.
    Please guide me.

  • @ashwininventing7719
    @ashwininventing7719 7 лет назад +1

    Good day. Nice video! I have a question on whether it is possible to do a watchdog timer reset every 30 minutes? If yes, how do I go about changing your code?

    • @ForceTronics
      @ForceTronics  7 лет назад

      As per the datasheet, the max setting for the watchdog timer on the ATmega328 MCU is 8 seconds

    • @andreweastland9634
      @andreweastland9634 7 лет назад +4

      +ForceTronics
      If you want 30 mins then just count resets in the isr and only action after 30 mins worth, (use a volatile to store the vount)

  • @teodorvasile3301
    @teodorvasile3301 2 года назад

    Did anyone of you tried this example in TinkerCAD? For me it didn't work and I was thinking maybe to try it in another simulation software like Fritzing. Any feedback is much appreciated. Thanks.

  • @gavinalbright7299
    @gavinalbright7299 4 года назад

    How would I use the watchdog timer with a switch case statement if there are different variable times for the "sleep" period? Would I have to write the code for each case statement for the time? Any help would be greatly appreciated. I'm also using the ATtiny85, so there is some different variations in the libraries. Thanks!

    • @ForceTronics
      @ForceTronics  4 года назад

      If I understand the question right, you would write the switch statements to set the value of a variable that corresponds to the time interval you want. Then once you have the variable set you feed it to the watchdog timer code

  • @doocterloobster1617
    @doocterloobster1617 3 года назад

    you did that graphic?

  • @ultimatio593
    @ultimatio593 3 года назад

    se podría utilizar el Watchdog cuando detecte que se fue el internet y toca apagar y prender el moden de la fibra, para que vuelva el internet, yo escuchado con el ping Watchdog pero no se como aplicarlo, tengo el arduino uno, un modulo ethernet y un rele los cuales accedo manual mente y mediante el programa lo apago y prendo lo que busco es hacer automático, en el caso de ayudarme yo le pago

  • @mtalhakhalid1679
    @mtalhakhalid1679 2 года назад

    WatchDog reminds me of Spike Dog from TOm and Jerry

  • @MPElectronique
    @MPElectronique 7 лет назад +1

    If i understand, the watchdog timer prevents your program of freezing ?
    Thanks!
    Marc.

    • @ForceTronics
      @ForceTronics  7 лет назад +1

      Yes, it resets the MCU if it freezes. It also has secondary purposes like serving as a wake up timer when using sleep mode.

    • @MPElectronique
      @MPElectronique 7 лет назад

      thamks

    • @MPElectronique
      @MPElectronique 7 лет назад

      reset from setup() function ?
      Thank You.
      Marc.

  • @creationceremony
    @creationceremony 6 лет назад

    i want to add delay of 10 seconds to my action whenever my sensor triggers can i use these for the same purpose ?
    if yes how
    please give me hint
    i m desperately waiting for it.

    • @ForceTronics
      @ForceTronics  6 лет назад

      You could use the watchdog timer for a delay, although I would just recommend using the built-in Arduino function delay() or millis(). You can find examples how to use these on the Arduino website

  • @sanjanavirupaksha4557
    @sanjanavirupaksha4557 6 лет назад +1

    nice and informative video... can a watchdog timer be designed on eagle or kicad software using this arduino code ?
    Thank you

    • @ForceTronics
      @ForceTronics  6 лет назад +1

      Thank you. Not sure I understand the question, do you mean Eagle CAD software for doing PCB layouts? The WDT is internal to most modern microcontrollers, it is not an external circuit.

    • @sanjanavirupaksha4557
      @sanjanavirupaksha4557 6 лет назад

      ForceTronics yes sir.. I meant eagle CAD software for designing PCB layouts

    • @ForceTronics
      @ForceTronics  6 лет назад

      The code from this tutorial can be used with AVR based Arduino boards. The Arduino boards are programmed via the Arduino IDE, the code in this video is made for the Arduino IDE. PCB layout software is just for building the circuit for a microcontroller, it does not program the microcontroller

    • @suvigyamishra4604
      @suvigyamishra4604 6 лет назад +2

      lol

  • @prmajiq
    @prmajiq 5 лет назад

    the #include too eyser

  • @aniqaejaz7592
    @aniqaejaz7592 6 лет назад

    hi, i am working on a project
    i wanted to know that i want my sensor system to work only 2-3 hours in a day. and the other time i want it off.
    could you advise me what to do?

    • @josephdaquila2479
      @josephdaquila2479 4 месяца назад

      Did you get it to work?

    • @aniqaejaz7592
      @aniqaejaz7592 4 месяца назад

      bro that was my project 6 years ago 🤣🤣 I don't remember @@josephdaquila2479

  • @arsalansyed4709
    @arsalansyed4709 3 года назад

    ty!

  • @niklas8751
    @niklas8751 7 лет назад

    Can you help me? I just want to reset my Attiny85 every 5 sek. How can I do this?

    • @ForceTronics
      @ForceTronics  7 лет назад

      I am not real familiar with the Attiny85, but I believe it is an AVR MCU so if it has a watchdog timer you should be able to leverage from this video. There is also a hardware driven approach for resetting an MCU that I discuss in this video ruclips.net/video/vt9C-hMa1Ok/видео.html

  • @vargaszilvia774
    @vargaszilvia774 3 года назад

    nice doggo:))

  • @gazzacroy
    @gazzacroy 4 года назад +1

    cool

  • @kampkrieger
    @kampkrieger 5 лет назад

    :( it does not work for me. I do a wdt_disable(); at start of the setup then I check the MCUSR & WDRF and reset it, (if it was true I do not play the startup tune)
    at the end of setup I do wdt_enable(WDTO_4S);
    but if interupt occours, all that happens is that the LED flickers wildly

    • @cavalier3920
      @cavalier3920 4 года назад

      To follow-up on my earlier reply: I got rid of the flicker by loading this code using an Atmel IDE via an SPI connection. I have no idea where the hick-up is as I'm a hack.

    • @aleceduardo6013
      @aleceduardo6013 2 года назад

      my arduino nano also has this problem, maybe it's a bootloader problem

    • @kampkrieger
      @kampkrieger 2 года назад

      @@aleceduardo6013 did you try the new bootloader? the old one is explicitly broken in terms of wdt (and then new one is 10x fastern in uploading code)

  • @DuongTrongHue
    @DuongTrongHue 8 лет назад

    Interesting video. Can you share your code. Thanks

    • @ForceTronics
      @ForceTronics  8 лет назад

      +Saytinh The link to the code can be found in the video description

    • @DuongTrongHue
      @DuongTrongHue 8 лет назад

      +ForceTronics I cannot go to that link "This webpage is not available". Can you check?

    • @ForceTronics
      @ForceTronics  8 лет назад +1

      +Saytinh The webpage is to my blog and I just tested and it worked. You can always just search "forcetronics blog" and it should come up.

    • @DuongTrongHue
      @DuongTrongHue 8 лет назад

      +ForceTronics Still not able to go your blog. Maybe my DNS (I used open DNS 8.8.8.8). But can I go your bog by IP. If can plz give me your IP.

  • @thanasisathanasi4965
    @thanasisathanasi4965 4 года назад

    I liked the dog in the beginning who is angrily watching for the interrupt to come out !!!! But the video does not really explain the issue from the dog. It just uses a library cheat !

  • @bradream4026
    @bradream4026 2 года назад +1

    to close to your mic man a little more distance

  • @eriklaken1025
    @eriklaken1025 5 лет назад

    Sorry, never learned english....