Arduino 555 watchdog timer

Advert

Arduino 555 watchdog timer

Home Forums Electronics in the Workshop Arduino 555 watchdog timer

Viewing 25 posts - 26 through 50 (of 66 total)
  • Author
    Posts
  • #235635
    Simon Williams 3
    Participant
      @simonwilliams3

      I say chaps, have we not fallen into the trap of "if you want to make it complicated ask an expert"?

      I get the feeling that the OP is more than somewhat bemused at the extent of the expertise this spotlight on the intricacies of safety circuits has revealed. But it isn't answering the original question.

      At risk of lecturing all and sundry, for which I apologise, the OP made his risk assessment, identified the hazard, and devised some control measures. Other solutions exist.

      So to focus on making sure that the control measures are effective, how do you reset an Arduino with the output of a 555?

      My cursory glimpse at the equivalent circuit of the 555 output stage shows a pair of npn transistors connected between the supply rails. I fancy one needs to think about the leakage currents through the base bias resistors to be sure that pin 3 will actually go properly low.

      Alternatively – and more simply – should not the Arduino reset input be fed from an open collector output? Minds other than mine understand the intricacies of these things better than I do.

      For my part I like the idea of not allowing the microprocessor in the Arduino to suicide itself in times of peril. If the innards have gone doolally, then exterior means to bring the Express to a safe halt are indeed prudent. That goes back to the next stage of the risk assessment – have the implemented control measures reduced the risk to an acceptable level?

      Rgds to all Simon

      Advert
      #235636
      Steve Addy
      Participant
        @steveaddy35670

        Thank you Simon.

        Without wishing to offend anyone, people are exhibiting their knowledge and may as well be speaking in Japanese. I'm an amateur engineer and get by quite nicely in that field, but electronics are new to me. There is no point in talking about other processors, I'm playing Arduino period! I am not taking to the road or the main line with 3000hp.

        All I'd like is some ideas as to why it doesn't reset in words of one syllable and I'll have a play with the circuit when I'm in a suitable mood.

        I did try to look what happened to D2 when a reset was forced with the switch, it appeared to go high, but I was struggling to concentrate as usual. During normal operation it is going low for 30 milliseconds and discharging the capacitor, by way of "heartbeat".

        My mother is driving me crackers with constant stupid phone calls, I'm not in the right frame of mind for this at the moment at all!

        Steve

        #235637
        Neil Wyatt
        Moderator
          @neilwyatt

          The 555 is adding complexity for the sake of it, IMHO.

          The reset pin will have a ~30K pullup internally so happy being driven by an open collector.

          Good point made earlier about the diode – the minimum input low voltage hreshold is 0.2V which will be fine with an open collector transistor in saturation, but not with a diode in line.

          Final thought – if you do implement an external reset – have you made sure thats fails all your systems safe? Will teh regulator close itself if no signal comes from the arduino, for example?

          Neil

          #235638
          John Haine
          Participant
            @johnhaine32865

            I'd still like to know what the Arduino output that triggers the 555 does when reset is asserted. But I agree with Neil that the 555 is adding complexity for no obvious benefit (in fact, the contrary!).

            If you do want something external to generate a reset if you stop getting watchdog pulses, a better choice is an edge triggered retriggerable monostable such as the CD4538.

            Edited By John Haine on 21/04/2016 21:34:35

            #235644
            Simon Williams 3
            Participant
              @simonwilliams3

              Sorry John, but this OP isn't ready for CMOS static sensitive stuff yet.

              The same essential functionality exists with the 555 – so the original question stands. How do you implement a reset with a 555? There are other ways to do the same job, but that wasn't the question.

              Equally the point that he is adding complexity for the sake of may be correct, but – with respect – is irrelevant. The OP wanted to learn how to do this stuff, and asked why does it not behave as he expected. He can build an entire Heath Robinson panorama of unnecessary complication – and learn much as he does it. But it is nice (and ever so much more rewarding) if the lights come on when you expect them to.

              Rgds to all

              Simon

              #235648
              Steve Addy
              Participant
                @steveaddy35670

                That CD4538 thing has twice as many pins and I'm buggered if I understand it………

                #235651
                Simon Williams 3
                Participant
                  @simonwilliams3
                  Posted by Steve Addy on 21/04/2016 22:13:36:

                  That CD4538 thing has twice as many pins and I'm buggered if I understand it………

                   

                   

                  That's the complexity leaking out.

                  Come on chaps, I don't know enough about the innards of an Arduino chip to know if the answer is as simple as ditch the diode, feed the reset I/p with an open collector and rely on the pull up resistor inside the A' chip. But some of you jolly clever chaps must do.

                  The OP was asking for help in his hour of befuddlement. I don't feel we've maintained our high standards of brotherhood in adversity here.

                  Edited By Simon Williams 3 on 21/04/2016 22:52:08

                  #235654
                  Michael Gilligan
                  Participant
                    @michaelgilligan61133

                    Steve,

                    Having found Chris Ramsay's description **LINK** … I now know that he was using a Pro Mini, and you are using a Uno R3.

                    I don't know much about Arduino, but I have read somewhere that the Uno reset arrangement is a little different [requires more current ?] … something to do with the USB chip ?

                    Hopefully this might ring a bell with someone.

                    MichaelG.

                    #235655
                    John Haine
                    Participant
                      @johnhaine32865
                      Posted by Simon Williams 3 on 21/04/2016 21:53:41:

                      Sorry John, but this OP isn't ready for CMOS static sensitive stuff yet.

                      That rules out using an Arduino then. Anyway in a 40 year career in electronics I've never blown a 4000 series CMOS device through static. They are remarkably robust.

                      #235656
                      Simon Williams 3
                      Participant
                        @simonwilliams3

                        John – thank you , fair comment.

                        I have!

                        Rgds Simon

                        #235660
                        Simon Williams 3
                        Participant
                          @simonwilliams3

                          Isn't there a problem with the component values for the 555 timing circuit?

                          The values as shown and as per the link MichaelG added show R1 = 1M, R2 = 3K3. This gives a mark space ratio of about 300 to 1.

                          A 555 can't do this. You can go to about 100 to 1 (but not with this basic circuit) but 300 to 1 is going too far.

                          Why does the reset pulse have to be short?

                          Simon

                           

                          Edited By Simon Williams 3 on 21/04/2016 23:49:24

                          #235661
                          Michael Gilligan
                          Participant
                            @michaelgilligan61133
                            Posted by Andrew Holdaway on 20/04/2016 22:27:28:

                            Steve, what is the purpose of the IN4001 diode on pin 3 of the 555?

                            .

                            This version of the WatchDog includes a brief explanation.

                            MichaelG.

                            #235662
                            Michael Gilligan
                            Participant
                              @michaelgilligan61133
                              Posted by Simon Williams 3 on 21/04/2016 23:29:06:

                              The values as shown and as per the link Mike G added …

                              .

                              Simon,

                              I do prefer to be called Michael

                              Thanks

                              MichaelG

                              #235664
                              Simon Williams 3
                              Participant
                                @simonwilliams3
                                Posted by Michael Gilligan on 21/04/2016 23:41:40:

                                Posted by Simon Williams 3 on 21/04/2016 23:29:06:

                                Simon,

                                I do prefer to be called Michael

                                Thanks

                                MichaelG

                                My Apologies. So it shall be.

                                Simon

                                #235665
                                Michael Gilligan
                                Participant
                                  @michaelgilligan61133

                                  Thanks, Simon

                                  MichaelG.

                                  … Now back to the 555 mystery !!

                                  #235674
                                  Andy Holdaway
                                  Participant
                                    @andyholdaway

                                    Forgetting for now about diodes and sink current, what I fail to understand is that the OP says that the Arduino resets with a push button connected to the reset pin, and he has tried a relay from the 555 output to do the same, but the Arduino does not reset.

                                    Now it may be that the relay has high resistance on its contacts, or was not pulling in fully, but that aside, the relay is doing exactly the same as the push button.

                                    The 555 circuit should work, but clearly doesn't. I had assumed the OP was using a pro mini as well from the original diagram that was linked to. Maybe it is down to different reset strategy on the Uno, I don't know. I'll have a look through the datasheets later.

                                    Andy

                                    #235676
                                    Michael Gilligan
                                    Participant
                                      @michaelgilligan61133
                                      Posted by Andrew Holdaway on 22/04/2016 07:54:56:

                                      Forgetting for now about diodes and sink current, what I fail to understand is that the OP says that the Arduino resets with a push button connected to the reset pin, and he has tried a relay from the 555 output to do the same, but the Arduino does not reset.

                                      Now it may be that the relay has high resistance on its contacts, or was not pulling in fully, but that aside, the relay is doing exactly the same as the push button.

                                      The 555 circuit should work, but clearly doesn't. I had assumed the OP was using a pro mini as well from the original diagram that was linked to. Maybe it is down to different reset strategy on the Uno, I don't know. I'll have a look through the datasheets later.

                                      .

                                      Thanks, Andy

                                      … Like you, I am somewhat bemused by the relay problem dont know

                                      Slight variations on this 555 arrangement have been around for years; so we can assume that it has worked for others … 'though I haven't yet seen a specific reference to it working with Uno R3. [probably just not looking hard enough].

                                      On Chris Ramsay's page, Steve mentions his use of Uno [which is what prompted me to post the link].

                                      MichaelG.

                                      #235679
                                      Howi
                                      Participant
                                        @howi

                                        Push button works but relay does not?

                                        Try operating the relay manually.

                                        Try a longer pulse from the 555, it may be too short for the relay to operate fully.

                                        Try a reed switch, it will operate faster than a relay.

                                        There HAS to be a reason why the push button works but the relay does not!

                                        This should involve simple logic not complicated electronics.

                                        Follow the KISS principle – Keep It Simple Stupid

                                         

                                        Howard

                                        #235691
                                        Neil Wyatt
                                        Moderator
                                          @neilwyatt

                                          The maximum input low voltage on reset is 0.1 x Vcc. if you are running at 5V athgat's 0.5V soi if the forward drop over that diode is 0.6 V it won't reset.

                                          Ditch the diode.

                                          A open collector driver will be fine the internal reset pullup is always active, but you could add a 10K pullup to be on the safe side..

                                          Neil

                                          #235694
                                          Michael Gilligan
                                          Participant
                                            @michaelgilligan61133
                                            Posted by Steve Addy on 20/04/2016 22:56:36:

                                            I have learned about the voltage drop across a diode Andrew, I don't know why it is there, but it doesn't work without it either.

                                            .

                                            Neil,

                                            For info . …^^^…

                                            MichaelG.

                                            #235715
                                            SillyOldDuffer
                                            Moderator
                                              @sillyoldduffer

                                              Steve,

                                              Fortunately I'm also in the midst of an Arduino based project and had the wherewithal to build and test your circuit all ready to go on my dining table this morning.

                                              My set-up is a Duemilanove, a Siglent DSO, and a breadboard containing the NE555 circuitry.

                                              I used a modern NE555. The original NE555 tends to crowbar the power supply when it switches and this can cause odd results. If you happen to have one of these you will also need to heavily decouple the power rail. Better to buy a modern 555.

                                              I can confirm that the circuit works for me with the component values given.  It reliably resets the Duemilanove.

                                              The NE555 is set up as an ocsillator with a long period and high duty rate. Fo me the output of the NE555 is high for 14 seconds and then goes low for 12mS. The waveform is repeated unless the Arduino breaks the cycle with a heartbeat pulse. Therefore the Arduino needs to send a heartbeat at least once every 14 seconds.

                                              sds00002.jpg

                                              Zooming in on the short pulse:

                                              sds00001.jpg

                                               

                                              I tested the heartbeat function by manually shorting the capacitor because I'm too lazy to write the code needed to produce the ticks! As it works with a manual heartbeat I don't see why the Arduino shouldn't do the job just as well, assuming that the low pulse is long enough to discharge 22uF through 560 ohms.

                                              Like Simon Williams I'm suspicious of the component values used. This is because they are outside the normal range recommended for an NE555. Consequently the circuit might not work for everyone. It doesn't help that the maths that comes with the original circuit appears to be wonky, though that might be me! There's some ambiguity about whether the capacitor should be 220uF or 22uF.

                                              If it's 220uF that's a bad idea because it's well outside the recommended range! Even if the circuit works with 220uF there's a two minute wait between reset pulses and it would be easy to miss them on an oscilloscope (unless you deliberately set it up to catch them.)

                                              The diode is needed to stop the NE555 squirting volts into Arduino through the reset pin which is an output. I used a silicon small signal type rather than a 1N4001, mainly because I don't have any 4001s. I don't think the type of diode is a problem with the circuit values given but note the 4001 is a power rectifier that switches relatively slowly. Unlikely, but the type of diode might be part of the problem.

                                              You had to reduce the value of the 1M resistor to 47k to get the circuit to work at all. I suspect this is because the 22 microfarad capacitor is leaking or is the wrong way round. All electrolytics leak and some are worse than others. I would try replacing it.

                                              With 47k rather than 1M and a good 22uF, the 555 issues a 12mS reset pulse every 660mS.

                                              You said you might have done something simple. When I first looked at the diagram I "saw" the reset and Vcc wiring the wrong way round. Shorting the power line rather than the reset would create the symptoms described. I also get confused by the cross-connections needed to wire 555's correctly and usually make at least one mistake whenever I breadboard one.  Well worth triple checking.

                                              A number of people have criticised the external circuit as being unnecessary. The technique was new to me but reading more widely about the quirks of resetting Arduinos revealed there are several valid use cases for it. I would ignore their advice.

                                              You mentioned trying an Op Amp and the awkward need to provide these beasts with a negative rail. I don't think an Op Amp would help in this particular application but an easy way to provide an op amp with a negative supply is to use a voltage conversion chip like an ICL7660.

                                              And of course "Failsafe systems fail by failing to fail safely", ho ho.

                                              Good luck,

                                              Dave

                                              PS Sorry to hear about your mum.  I lost my father to Dementia recently and it was Hell.

                                               

                                              Edited By SillyOldDuffer on 22/04/2016 11:11:44

                                              Edited By SillyOldDuffer on 22/04/2016 11:15:09

                                              Edited By SillyOldDuffer on 22/04/2016 11:30:18

                                              #235721
                                              Andy Holdaway
                                              Participant
                                                @andyholdaway

                                                Dave, great work! I was going to do the same but couldn't find a 555 anywhere in my 'drawers of important stuff'! I also don't have a Uno, but do have several micro's and mini's, and a couple of Megas.

                                                Is the forward voltage drop on a 1N4148 the same as a 1N4001? I notice that the original circuits show a 4148, so that may be contributing to the problem.

                                                Looks like we've got the same DSO as well!

                                                Andy

                                                #235727
                                                SillyOldDuffer
                                                Moderator
                                                  @sillyoldduffer

                                                  Hi Andrew,

                                                  I nearly failed to do this interesting investigation because I'm down to my last 555: must buy some more. I would like to experiment with different models too. I have a Uno but it's tied up at the moment and will take some disentangling. I may be able to try it later. Likewise my Mega is in hiding and I don't have time to search for it today. So I still don't know if different models of Arduino are more or less fussy about reset pulses.

                                                  I hadn't spotted that the original circuit specified a 1N4148 so it's pure coincidence that I used one. You may be on to something there.

                                                  I believe the 1N4148 and 1N4001 both have the same forward voltage drop. In this sort of application the big difference between the two types is their junction capacity and what that capacitance does to the shape of a pulse. A 1N4148 will be less than 1pF and a 1N4001 could well be more than 20pF. I must have some rectifier diodes that could be tried in this circuit to see what happens.

                                                  My Siglent is an SDS1072CML and I'm very impressed with it. It almost makes debugging electronics fun! Over the years I've owned several "pre-loved" conventional oscilloscopes and despite being beautifully made they all developed horrible multiple faults as they aged. In the end I bought a new DSO. Although it felt like an expensive buy at the time I've never regretted it. It piddles all over kit that cost several thousands in my youth.

                                                  Cheers,

                                                  Dave

                                                  #235731
                                                  John Fielding
                                                  Participant
                                                    @johnfielding34086

                                                    Hi Silly Old Duffer,

                                                    The 1N4148 is typically 4pF and the 1N4000 series is about 50pF, but these are much too small to cause a problem. It can only be one of two things. Either the asserted reset pulse is not going low enough, as Neill pointed out, or more likely to be the reset low duration is not long enough. Most uPs need a minimum duration of the reset pulse to provide a reliable rest pulse to be recognised. If they could be triggered by nano-second long pulses then they would be forever resetting, which would keep the uP out of running.

                                                    I didn't notice a POR capacitor on the original schematic? Normally one is needed to hold the uP off until the supply rail has stabilised after initial switch on. It can either use an external or internal pull-up resistor and a smallish capacitor, preferably a tantalum for low leakage. On the Motorola GP32 processors the recommended reset circuit is via a 1N4148 to the open collector device which forces the reset pin low. Not sure what Atmel recommends for the AVR types.

                                                    For these kind of add ons I prefer a simple monostable with a voltage comparator which gives a defined pulse duration. Something like a LM339 family works well and very low cost. I detest the 555 timer and all its problems! But YMMV?

                                                    #235734
                                                    Neil Wyatt
                                                    Moderator
                                                      @neilwyatt

                                                      How long is the reset pulse to the 555?

                                                      The time constant of your 560R and 22uF capacitor is about 12 milliseconds so you need a significantly longer pulse to reset the 555.

                                                      If you are sending a pulse a few uS long, the 555 won't even notice.

                                                      Neil

                                                    Viewing 25 posts - 26 through 50 (of 66 total)
                                                    • Please log in to reply to this topic. Registering is free and easy using the links on the menu at the top of this page.

                                                    Advert

                                                    Latest Replies

                                                    Viewing 25 topics - 1 through 25 (of 25 total)
                                                    Viewing 25 topics - 1 through 25 (of 25 total)

                                                    View full reply list.

                                                    Advert

                                                    Newsletter Sign-up