Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. Watchdog timer

Watchdog timer

Scheduled Pinned Locked Moved Development
9 Posts 4 Posters 2.0k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    Igpels
    wrote on last edited by
    #1

    How do I add a watchdog timer to my motion sensor sketch?
    I can get an example watchdog timer sketch to work, and it resets if wdt is not rest in the loop, but I cannot get it work in the motion sensor sketch.

    dbemowskD 1 Reply Last reply
    0
    • I Igpels

      How do I add a watchdog timer to my motion sensor sketch?
      I can get an example watchdog timer sketch to work, and it resets if wdt is not rest in the loop, but I cannot get it work in the motion sensor sketch.

      dbemowskD Offline
      dbemowskD Offline
      dbemowsk
      wrote on last edited by
      #2

      @igpels-gurrala Could you show us your code. Maybe we can figure out what is wrong.

      Vera Plus running UI7 with MySensors, Sonoffs and 1-Wire devices
      Visit my website for more Bits, Bytes and Ramblings from me: http://dan.bemowski.info/

      I 1 Reply Last reply
      0
      • gohanG Offline
        gohanG Offline
        gohan
        Mod
        wrote on last edited by
        #3

        If you have a battery motion sensor I don't think you can effectively run a watchdog

        1 Reply Last reply
        0
        • scalzS Offline
          scalzS Offline
          scalz
          Hardware Contributor
          wrote on last edited by scalz
          #4

          Hi,

          In MySensors:

          • if you use deep power down, sleep() without time, it doesn't use watchdog, and can be waken up by a pin interrupt only.
          • if you use sleep(ms) it uses watchdog.
          • during runtime, watchdog is enabled, and it resets at each loop().
          1 Reply Last reply
          0
          • dbemowskD dbemowsk

            @igpels-gurrala Could you show us your code. Maybe we can figure out what is wrong.

            I Offline
            I Offline
            Igpels
            wrote on last edited by Igpels
            #5

            @dbemowsk https://hastebin.com/ilonemimev.cpp
            I am using an arduino nano plugged into a 5V phone charger. I can get the watchdog working on its own. But, not when I put the rest of the motion sensor sketch with it.

            1 Reply Last reply
            0
            • gohanG Offline
              gohanG Offline
              gohan
              Mod
              wrote on last edited by
              #6

              there is no real need to sleep a mains powered sensor

              1 Reply Last reply
              0
              • I Offline
                I Offline
                Igpels
                wrote on last edited by
                #7

                @gohan I removed the sleep portion, but still can't get the watchdog to trigger a reset
                https://hastebin.com/xeqavitadu.cpp

                1 Reply Last reply
                0
                • gohanG Offline
                  gohanG Offline
                  gohan
                  Mod
                  wrote on last edited by
                  #8

                  try adding a 10 seconds delay before resetting the wtd timer, it should trigger

                  I 1 Reply Last reply
                  1
                  • gohanG gohan

                    try adding a 10 seconds delay before resetting the wtd timer, it should trigger

                    I Offline
                    I Offline
                    Igpels
                    wrote on last edited by
                    #9

                    @gohan Yep, that did it. Thank you so much.

                    1 Reply Last reply
                    1
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    21

                    Online

                    11.7k

                    Users

                    11.2k

                    Topics

                    113.1k

                    Posts


                    Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • MySensors
                    • OpenHardware.io
                    • Categories
                    • Recent
                    • Tags
                    • Popular