SuperHouseTV #15: Watchdog timers for Arduino home automation

Sdílet
Vložit
  • čas přidán 25. 08. 2024

Komentáře • 86

  • @themaconeau
    @themaconeau Před 8 lety +8

    Four-legged watchdog timers are awesome :D

  • @lathiat
    @lathiat Před 8 lety +30

    Loved the living watchdog at the start :-)

  • @NathonDalton
    @NathonDalton Před 8 lety +1

    I'm also happy to see that you're back to doing work on your smart house! I finally own my own home so I'm going to start building my own smart house. I've had your old videos bookmarked for quite some time to use as reference. Thanks for all the great information!

  • @TVSbro
    @TVSbro Před 8 lety +1

    Welcome back Jonathan! Good to see you back on here!!!

  • @siliconrobot6522
    @siliconrobot6522 Před 5 lety

    Nice introduction and good analogy between Software watchdog and your lovly dog. It actualy shows us what watchdog is made for with real life example.

  • @johnsonjuan3
    @johnsonjuan3 Před 7 lety

    Thank you for your very good videos! The way you bring information forward is the best. I frequently come here for learning.

  • @TomoHawkZA
    @TomoHawkZA Před 8 lety +1

    Awesome stuff as per usual. I love how this series is always applicable and practical. One day, when I get settled and have some good time off and ideas, it will be great to use everything from this series.
    Keep at it, as you can see, everyone loves your content.
    Nice prop with the pup.

  • @chrisw1462
    @chrisw1462 Před 4 lety +1

    Nice thing about the ESP32 - you can program the ultra low power co-processor to be the watchdog timer for you. No extra parts.

  • @nathanpearson4600
    @nathanpearson4600 Před 8 lety +1

    man happy to see new videos.

  • @andrewg1969
    @andrewg1969 Před 5 lety +2

    Silly question but how do you wire it so it works with the jumper ' out ' ?

  • @MrBobWareham
    @MrBobWareham Před 7 lety +6

    why don't you use the internal wdt in the Arduino

  • @familyplans3788
    @familyplans3788 Před 4 lety

    this is the classic case of clicking on his web page and enjoying the article by Jack Ganssle on another level of watchdog timers and their applications
    people are really missing out by not clicking on the superhouse website

  • @joseneves4273
    @joseneves4273 Před 7 lety

    Cool video!! Nice way to explain watchdog!! A big thank you and continue doing this really good work.

  • @liamkinne
    @liamkinne Před 7 lety +5

    The external watchdog is a neat solution, but isn't there a watchdog timer on-chip for the 328p? Just wondering why you opted not to do this.

    • @877cms
      @877cms Před 5 lety

      @Paul Taylor old post I know :) I'm wondering where the watchdog is on the ESP's? Is it a hardware one, i.e. will work when the software hangs? I use mainly ESP8266 (Wemos D1 mini) but also have just acquired my first ESP32.

    • @RSP13
      @RSP13 Před 7 měsíci

      Esp32 has a hardware WDT but the only official (documented by Espressif) way to interact with it still depends on software, so I would not count on it. But there is another way to access it without the CPU or the main RAM: search for "RTC" WDT esp32.

  • @jasonperry6046
    @jasonperry6046 Před 8 lety +6

    I was excited to see your new uploads. Every time you post a new video you seem to inspire me to learn more. Is there anyway we could get a system update? I am curious to know how things have changed.

    • @SuperHouseTV
      @SuperHouseTV  Před 8 lety +3

      Thanks Jason! I appreciate the comments. A general update is definitely due, because I've changed quite a few things.

    • @jasonperry6046
      @jasonperry6046 Před 8 lety +1

      I am interested to know what MQTT broker you are using. Mosquito is my front runner but from what I have read the redundancy isn't built in like HiveMQ. I have also been looking at OpenHab but there aren't many good videos.

    • @SuperHouseTV
      @SuperHouseTV  Před 8 lety

      I've been running OpenHAB with Mosquito for a couple of years now. I think I've had Mosquitto running for over 5 years: I'd have to look it up. It's been rock solid, never failed in all that time. There weren't many alternatives way back then, so I need to check out whether the MQTT world has changed

    • @Nathan-mm5el
      @Nathan-mm5el Před 8 lety +1

      When you first install Mosquitto you should recompile it to work with websockets. I am using mqtt/websockets with paho/javascript. It makes for a really great cell phone interface.

    • @daveblanch476
      @daveblanch476 Před 8 lety

      Hi Jonathan, any chance of a tour of you OpenHAB setup?

  • @washedtoohot
    @washedtoohot Před 7 lety

    wow really good analogy with the dog!!

  • @hansenhalim2265
    @hansenhalim2265 Před 5 lety

    The dog is paid actor.

  • @JoeEvansSound
    @JoeEvansSound Před 6 lety

    thanks Johnathan for a great description of a wdt - just what i needed - many thanks :¬)

  • @sonuguru143
    @sonuguru143 Před rokem

    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.

  • @RSP13
    @RSP13 Před 7 měsíci

    Nice intro

  • @JoeEvansSound
    @JoeEvansSound Před 6 lety

    On another note entirely, do you think that one day we will have smart devices around the house that are just sensor/actuator devices that hold no code except for, say, an i.d. that sends a standard data set (via mqtt) that the sensor gives it or rcvs a standard data set and triggers an actuator. All the code would be on one local PC. When we need to do updates to our "smart-house" all the code is done locally. Wouldn't that be great. No climbing in the loft space or under the floor boards. All we would do is to, say, lay one of these sensor/actuator micro controllers in a particular place, attach a sensor or actuator and set a few dip switches to rcv or send and to set an id. And then attach some power. Or does something like this already exist?

  • @mschaffer2826
    @mschaffer2826 Před 5 lety

    My esp8266 iot control stops responding from time to time. I think it is when the router is reset. How do I code it to reset when the wifi is missing using the internal wdt?

  • @mrfrog8502
    @mrfrog8502 Před 8 lety +1

    Thanks for the video. Very informative. Could you do something with the audio moving on because one can clearly hear you swallowing every 20 seconds or so. Much appreciated.

    • @SuperHouseTV
      @SuperHouseTV  Před 8 lety

      Getting audio right is something that drives me nuts. I think it's harder than getting a camera in the right place and focused, which is hard enough! I've experimented with 4 different mics, and tried different placements. A friend who films TV commercials suggested that I get a Zoom field recorder and record it separately, then synch the audio up during editing. Unfortunately I have a budget of about 25c right now so I'll just have to work on better placement for the mics I already have. And not swallowing so much

    • @mrfrog8502
      @mrfrog8502 Před 8 lety

      Haha thanks I appreciate that. Maybe just clip mic away from your shirt on desk lamp or a shelf....

  • @1mrhamel
    @1mrhamel Před 8 lety

    I'm sorry, but I had to pause the video when you said it took forever to get DHCP up and running again. A few solutions have come to mind...
    1) Why not have a more frequent DHCP lease time for the devices to renew all the time, if they fail to renew, they just sit in a somewhat infinite loop (with delay of course to prevent overwhelming of the microcontrollers).
    2) Static IPs + sticky DHCP (optional but can come in handy, TLDR DHCP specific IP address assigned to a MAC address all the time). That way it just has to ping or do test connections back to the automation controller. Eliminating DHCP will take out one lest component required to making the system work.
    Anyway, the 555 timer is a neat out of band watch dog, but it provides no immediate notification if something goes wrong unless you ping all the devices every minute or so. Why not have the eeePC (or whatever you're using now) have a direct USB/serial connection to an Arduino switching relays to circuits designated to running the components, so it can completely be aware of having to reset a device. With after doing 3+ resets, it can throw an exception in whatever script is running or make a notification in some form.

    • @SuperHouseTV
      @SuperHouseTV  Před 8 lety

      Good points.
      1) I haven't looked into the source of the DHCP client code for Arduino, but presumably it wouldn't be too hard to make it more frequent or to recover better if it fails to receive a response. I'd rather not have dozens of devices asking to renew their leases every minute or two though.
      2) I used to use static IP addresses for everything, so I maintain a spreadsheet listing every device on the network (with MAC, physical location, network port, etc) but I'm deliberately trying not to care about addresses anymore except for some specific items. I'm using IPv6 for some things now which requires a different way of thinking.
      Controlling power to devices centrally could work, but it would add some complication and wouldn't work for things like my water tank monitors that are running on solar + batteries and waking up periodically to report values wirelessly. Many of the devices I use with watchdogs are very remote to me, some of them thousands of km away.
      In any case, the suggestions you've made about solving those specific problems are good, and solving them makes the system run better. But even if everything was working fine, a watchdog is still a good insurance policy to have. You don't ever want to need it, but it's better to have it and never use it than to try to remotely recover a device in a nasty location.

    • @1mrhamel
      @1mrhamel Před 8 lety +1

      I just reread my first post and I apologize for the starting sentence.
      My knowledge comes from working in a datacenter here in Los Angeles. We have Ethernet controlled PDUs ("power boards" really) to control the outlets with relays and monitor the power consumption, then we have Supermicro servers that have IPMI in it which allows for out-of-band management, which entails of sensor monitoring (fans and voltages), mounting virtual media (ISOs, floppies), KVM/VNC access. The IPMI chips can run independent Ethernet interfaces or can share eth0.
      Lastly, the water tank, is that a norm for Australia to have external water tanks (assuming it's a water heater)? I just find that interesting. I remember seeing a video about being able to change the thermostat of it all the time, correct me if I'm wrong, but I'm not seeing a purpose where the temperature needs to be changed all the time especially if there is a circulation pump on the hot side.

    • @SuperHouseTV
      @SuperHouseTV  Před 8 lety

      Don't worry about it :-) I've done similar things in DCs in the past, although these days I'm quite abstracted from DC hardware with most critical stuff that I care about running on services like EC2. Regarding the water tank, that's not for heating, it's just bulk water storage for irrigation in the dry months. Here in Melbourne we get a lot of rain in winter, and long hot dry periods in summer so having water tanks is pretty common. I have about 20,000 litres of storage (I think: can't remember exactly) for a smallish suburban house.

  • @TobyRobb
    @TobyRobb Před 8 lety +1

    Great discussion on watchdogs Jonathan. I have mucked around a little with the WDT on the atmega328 after having trouble with my first few IOT projects on Arduino aand MQTT.
    Question: Can you recommend a hardware watchdog circuit? Can i buy those modules? Have you ever used one with a linux system? I am using wr703n openwrt router as serial to web publishing for IOT( emonTX) and they also hang and require rebooting periodically.
    Thanks for the informative videos!

    • @SuperHouseTV
      @SuperHouseTV  Před 8 lety +1

      Thanks Toby! I've published the design files for the module I used in the video: it's a simple 555 based oscillator with a really long off cycle and a really short on cycle, and the input (digital pin from the MCU) just resets it. You can get them from Freetronics, and there's a link to the design files there too: tron.cc/dog

    • @TobyRobb
      @TobyRobb Před 8 lety

      SuperHouseTV Awesome thanks Jonathan

  • @robdevries2216
    @robdevries2216 Před 8 lety +2

    I am just wondering why you wouldn't use the built in WDT? I like watching your videos, you now have be wondering what the programming is like for the MQTT. Could a programming video be in the works?

    • @TobyRobb
      @TobyRobb Před 8 lety +1

      MQTT is really great for IOT. I think Jonathan has done some videos on MQTT if you search his channel.

    • @SuperHouseTV
      @SuperHouseTV  Před 8 lety +3

      Yes, the built-in WDT is great for many projects, but it has a maximum timeout period of 8 seconds on most AVR chips. I want a much longer timeout. That can be achieved by having an ISR increment a counter, but then you're back in the hands of the code running properly for the watchdog to work at all. Another advantage of an external watchdog is that it asserts the reset line directly, so all your peripherals are reset as well. That could be good or bad!
      I want to do more MQTT videos but I'm having trouble figuring out the best way to film it. A voiceover with a screen capture is pretty boring. I experimented with it in the video about archiving security camera footage and found it awkward to do.

    • @1mrhamel
      @1mrhamel Před 8 lety

      Now with NoSQL technologies like Redis and MongoDB. Have you thought about changing that so the devices only have to update certain values? For example, you can have two values in the key store, one for a value of something (like a temperature probe), and the other being the last updated time in epoch format.
      Redis also has a pub/sub capability which will behave very similarly to MQTT but also has that key/value store where data can be saved and read to immediately instead of having to go over the wire.
      ---
      To answer the screen capture question, you can use QuickTime on your MacBook to capture the desktop + audio.

    • @uksa007
      @uksa007 Před 6 lety

      Using the external WDT seems excessive to me, If the code doesn't run properly it's unlikely that it's going to pat the internal WDT, unless you have programmed it to. Using an external WDT is probably less code, but more cost and hassle with additional hardware.

  • @xFuaZe
    @xFuaZe Před 7 lety

    Most microcontrollers, including the ones on the Arduino Uno and Mega have built-in hardware watchdogs.
    Why didn't you opt for this solution? Though yes, the external hardware solution can be used on any device that has a reset pin without knowledge of the specifics of that device.
    Also, if your device is being reset often, then it may indicate a software issue. And it may be a problem since it will lose state, connections and variables.

  • @ipullstuffapart
    @ipullstuffapart Před 8 lety

    I've opted for having a host watchdog, so the web server checks if it hasn't heard from the device for a while, and sends a control signal to my smart PoE switch to power cycle the PoE, means that you never have to put any additional hardware at the endpoints, and if your host is running, then you don't need to worry about watchdog modules running distributed around your network.

    • @SuperHouseTV
      @SuperHouseTV  Před 8 lety

      That's a really nice solution when you have central control over the power of each node :-)

  • @gaetano222
    @gaetano222 Před 7 lety

    Excellent!

  • @oonthayang8655
    @oonthayang8655 Před 4 lety

    smart dog

  • @sanupamu
    @sanupamu Před 6 lety

    Sir if uc hang with high state what happen to watch dog? It reset controller or not. I was seen if high signal come in to the mosfet get than its continuously discharged capacitor. So how could it reset the uc?

  • @astroglide420
    @astroglide420 Před 8 lety

    If you don't mind me asking, who manfucatures your designs? I am totally new to this, and still learning how to use the breadboard to make prototypes and experimenting with sensors, but eventually I will need to have my prototypes miniaturized. Would love to know whom to contact. Oh, I see your using a prototype board to connect your watchdog module! Did you solder that on? I've been staring at my prototype board, and I am more than a little confused on how to use it correctly! You really make it look so easy!

    • @SuperHouseTV
      @SuperHouseTV  Před 8 lety

      I run Freetronics (www.freetronics.com.au) so manufacturing isn't a problem! For prototypes I do the hand assembly myself, for very short runs I have a home-made pick and place machine here in my lab, and for larger runs we work with factories in China.

    • @astroglide420
      @astroglide420 Před 8 lety

      amazing.

  • @MPElectronique
    @MPElectronique Před 7 lety +1

    When do i know when i have to trigger the watchdog please ??
    Thank You.
    Marc.

    • @markushahnenkamm
      @markushahnenkamm Před 6 lety

      every time when your mcu code assumes it has worked as suposed
      so for example, as jonathan said, when he has !successfully! published a temperature data

  • @TVSbro
    @TVSbro Před 8 lety

    I don't know if this is a thing or not, but do you have a server that receives messages from arduinos that are down frequently so you know which ones you need to work on around your home?

    • @SuperHouseTV
      @SuperHouseTV  Před 8 lety

      I have an MQTT broker that receives messages, and one of the topics is simply a catch-all called "events". Every time a device starts up it posts a message to that topic with its ID, so it's a bit like a syslog: by watching the events topic I can see when devices do something unusual. What I DON'T have, but would be quite an interesting project, is a program that subscribes to MQTT and watches for events (or heartbeats, or publication to individual device topics) and raises the alarm if it fails to see activity from any devices for a certain period of time. I do that at the whole-house level as part of my commercial services (I install and configure OpenHAB systems for customers) where each OpenHAB box connects to my server regularly and checks for updates, and I have a "last seen" timestamp and a status screen that shows any devices that haven't been heard from for a while. I don't do that at the device level though. Hmmm, perhaps another video...

    • @1mrhamel
      @1mrhamel Před 8 lety +1

      What you can do is write a script with the alarm logic built in, or you can have it write the specific topic to a log file and use popular *NIX syslog monitoring utilities to filter out and sort each line as needed.

    • @1mrhamel
      @1mrhamel Před 8 lety +1

      I just saw that OpenHAB was created in Java. I honestly try to run from Java based applets, programs, etc. For work I have to purposely run Java 7 (8 is the latest) because of all the security features getting in the way, not to mention memory/performance issues. I wish it was made in C or some scripting language so it was portable to any platform, not just what Oracle dictates.

    • @SuperHouseTV
      @SuperHouseTV  Před 8 lety

      Yes, and that would be a very nice little project. It could just hang off the MQTT server without anything else needing to know that it exists, and raise the alarm if it doesn't see a device for a while. I really like that idea. I think I'll give it a go when I get some time

  • @HeilmanHackatronics
    @HeilmanHackatronics Před 8 lety

    Is there a reason why wifi routers don't seem to have this function?

    • @SuperHouseTV
      @SuperHouseTV  Před 8 lety +1

      It drives me nuts when routers and access points crash all the time. I hate having to reset a router: they should just work indefinitely, no questions asked. You can actually buy external watchdogs for routers (this was the first match when I searched, but there are others too: www.hw-group.com/products/ip_watchdog/index_lite_en.html) but it sucks that routers have such a reputation for being unstable. I gave up on Netgear and Linksys WiFi access points a few years ago and vowed to only ever buy Apple APs, but I've heard great things about Ubiquity so I want to try those one day. Maybe I should do a review of them

    • @J2897Tutorials
      @J2897Tutorials Před 7 lety

      I've used many cheap WiFi Routers over the years (less than 20) and I've only had that problem with one - an _Actiontec_. So I'm not sure it's such a prevalent problem, although I may just have been lucky.

  • @Gamewwx
    @Gamewwx Před 8 lety

    Yes!

  • @PaulWilson
    @PaulWilson Před 8 lety

    I have an Arduino collecting temperature data which I have currently connected using standard jumper cables but I noticed you have a nice and tidy plugs for your connectors can you recommend the easiest and/or best type?
    ie easiest to solder-up with 3 or more wires?

    • @SuperHouseTV
      @SuperHouseTV  Před 8 lety

      I still haven't found a small connector that I like! The connectors in the video are like these: www.vetco.net/catalog/product_info.php?products_id=7212 and www.vetco.net/catalog/product_info.php?products_id=7218. I think they're part of the Molex brand "KK" range, which seems to come in a few different sizes. I use a lot of the 0.1" pitch version, both right angle and straight. If you find anything better, please let me know :-)

    • @SmithyScotland
      @SmithyScotland Před 8 lety

      I use 3.5mm stereo connectors. I buy a stereo extension cable and cut the female part to 10cm - that is then soldered to my arduino. Male end then connected to the sensor - most of which only require 3 connections. Also means i can use off the shelf stereo extension cables to increase range. They're also robust.

    • @SuperHouseTV
      @SuperHouseTV  Před 8 lety

      Paul Smith Sounds like a good solution

  • @anwarigroup
    @anwarigroup Před 5 lety

    what when the watch-doc stop working.

  • @phanmemungdungappbienhoa6092

    I like your arduino, i can Purchase it?

  • @joopterwijn
    @joopterwijn Před 5 lety

    Could you explain a WCT for me? ( Watch 🐱 Timer ) 🤪

  • @JoeEvansSound
    @JoeEvansSound Před 6 lety

    What would be a neat idea is, perhaps, when the device is reset is to send a mqtt msg over to a log somewhere so you can see that the wdt is kicking, sorry patting, in. However, as far as I can see, there is no way on sending a specific wdt mqtt msg as all the wdt is doing is switching the major device on and off so I suppose just sending a "I have started" mqtt msg sent to your log would be good enough. Sorry, did you get what I am trying to say? :¬)

  • @jdphotograph
    @jdphotograph Před 6 lety

    Why don't you give your Arduino endpoint devices static IPs ? Then you wont have an issue with DHCP and you know what device has what IP.

  • @caribbeanchild
    @caribbeanchild Před 6 lety +4

    "feed" the dog

  • @Hans-yr3vd
    @Hans-yr3vd Před 8 lety +1

    Cron Job on froozen system hs no benifits, wake on lan can do better on bios reboot. Greetinx from the Netherlands HI5.

  • @pauldusa
    @pauldusa Před 5 lety

    What happened to your pocket chip carrying instead of the laptop...lol. maybe postman is slow

  • @kyhldk
    @kyhldk Před 7 lety

    doggo!

  • @Popart-xh2fd
    @Popart-xh2fd Před 7 lety

    Who Watch Dog the Watch Dog?