By continuing to use this site, you agree to our use of cookies. Find out more
Forum sponsored by:
Forum sponsored by Forum House Ad Zone

Arduino 555 watchdog timer

stuff to reset a rogue Arduino

All Topics | Latest Posts

Search for:  in Thread Title in  
Michael Gilligan22/04/2016 08:31:07
avatar
23121 forum posts
1360 photos
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.

Howi22/04/2016 08:50:08
avatar
442 forum posts
19 photos

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

Neil Wyatt22/04/2016 09:52:47
avatar
19226 forum posts
749 photos
86 articles

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

Michael Gilligan22/04/2016 09:59:26
avatar
23121 forum posts
1360 photos
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.

SillyOldDuffer22/04/2016 11:10:48
10668 forum posts
2415 photos

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

Andy Holdaway22/04/2016 11:48:09
avatar
167 forum posts
15 photos

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

SillyOldDuffer22/04/2016 12:28:39
10668 forum posts
2415 photos

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

John Fielding22/04/2016 12:52:20
235 forum posts
15 photos

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?

Neil Wyatt22/04/2016 13:07:10
avatar
19226 forum posts
749 photos
86 articles

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

Muzzer22/04/2016 13:23:09
avatar
2904 forum posts
448 photos

How much did you pay for yours? Seems to be about £250 on Amazon which looks pretty good value. As you might expect, the nearest Tek equivalent is about £500. I'm about to buy a basic scope and this might be about right for my purposes.

There are plenty of rail-to-rail opamps around that don't require a negative rail and could be used with a small Schottky diode (like a BAT54 or BAT85) or to drive a small FET 2N7000 etc but this is really an application for a comparator rather than an opamp. Being open collector, there's need for a diode to begin with.

The modern CMOS 7555 version of the 555 is improved and can drive its output close to ground.

Andrew Johnston22/04/2016 13:42:36
avatar
7061 forum posts
719 photos
Posted by SillyOldDuffer on 22/04/2016 11:10:48:

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.

Sadly it's that sort of attitude, and the diatribes by Simon Williams, that mean I no longer participate in electronics threads on this forum.

Andrew

John Fielding22/04/2016 13:56:02
235 forum posts
15 photos

Hi Muzzer,

Actually there are no true rail-rail op amps that I have come across. Although many claim to be "true rail-rail outputs" they aren't. Some time ago I needed a true rail-rail output op amp and the best I found only got to within 50mV of the positive rail and 20mV to the negative rail, which wasn't good enough. Many are true "rail-rail inputs" as they use saturation of the input devices but they aren't linear in this mode. In my application I needed a voltage follower to buffer the D-A output to provide a reference voltage for a radio telescope positioning system. The D-A gave the correct output but after the voltage follower there was a persistent error voltage which was a big problem. Eventually had to admit defeat and run the Op-amp off a slightly higher supply rail to get rid of the error near the top of the range. The bottom wasn't an issue as the positioner had a minimum voltage of 500mV but it extended to 4.96V at the top of the range as I was using a 12-bit D-A. I spoke to the manufacturers and they admitted they aren't really rail-rail, but close enough in their opinion! They then amended the data sheets to show they aren't rail-rail outputs, but still called them such devices.

I agree with your comments about voltage comparators, as I already mentioned in an earlier post on the topic. A good one will swing pretty close to ground for most applications as long as the sink current is only a few mA. Like all semiconductors the collector-emitter junction voltage goes up with increasing current!

Andy Holdaway22/04/2016 14:39:15
avatar
167 forum posts
15 photos

Muzzer, my DSO was about £200 from China delivered. Compared to some of the old scopes I love this one!

It does everything I need (and more), is simple to use, and fairly well documented. I've had it about 18 months now, and although it's not in daily ( or even weekly) use, it makes fault finding much easier. I went for the 100MHz version as I occasionally dabble in higher frequencies, and would highly recommend them.

Andy

Neil Wyatt22/04/2016 15:01:42
avatar
19226 forum posts
749 photos
86 articles

Cor! My Hameg cost less than £40...

Neil

(Who helped his genius mate Ray decode the reset vector for an Amstrad PCW bit by bit (yes bit not byte) using the Heathkit scope my Dad built in the late 60s or early 70s...)

Muzzer22/04/2016 15:11:35
avatar
2904 forum posts
448 photos

I see. Of course, there can never be a "true" rail-to-rail" device running from a single rail, since it's a matter of what source / sink current you have and what saturation voltage you need. Whether bipolar or MOS, the output devices will always generate some level of saturation voltage. In the context of this discussion, they are widely available. For a positioning system, sounds as if you'd need an instrumentation grade device and a negative rail.

If you are running a 12 bit D-A (0.024% steps), you will usually have a precision voltage reference and wouldn't tend to use the voltage reference rail itself to power the buffer amp? So the headroom you use to generate the reference would naturally provide headroom for the opamp too. But perhaps you'd long committed to a layout by then.

Murray

Muzzer22/04/2016 15:13:03
avatar
2904 forum posts
448 photos
Posted by Andrew Holdaway on 22/04/2016 14:39:15:

Muzzer, my DSO was about £200 from China delivered. Compared to some of the old scopes I love this one!

It does everything I need (and more), is simple to use, and fairly well documented. I've had it about 18 months now, and although it's not in daily ( or even weekly) use, it makes fault finding much easier. I went for the 100MHz version as I occasionally dabble in higher frequencies, and would highly recommend them.

Andy

What have you got? Also a Siglent?

John Haine22/04/2016 15:16:03
5563 forum posts
322 photos

Just to point out that all silicon PN diodes have about the same forward voltage drop, around 0.6V at room temperature. This is a characteristic of the material not the specific diode construction. Other diode types, such as Schottky, have a smaller drop; others like LEDs can be larger. But 0.6V for a silicon diode at small currents is a reasonable assumption. At higher currents, a small signal diode like the 1N4148 may drop more than a rectifier like the 1N4001 because the junction is smaller and its resistance more significant.

Andy Holdaway22/04/2016 15:19:30
avatar
167 forum posts
15 photos

And 50 years ago, Heathkit was all we could aspire to, but thankfully times (and technology) have moved on! cheeky

Andy

SillyOldDuffer22/04/2016 15:23:05
10668 forum posts
2415 photos
Posted by Andrew Johnston on 22/04/2016 13:42:36:
Posted by SillyOldDuffer on 22/04/2016 11:10:48:

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.

Sadly it's that sort of attitude, and the diatribes by Simon Williams, that mean I no longer participate in electronics threads on this forum.

Andrew

Many apologies Andrew, no offence intended. I should perhaps have said something like " I would ignore their advice in this particular case". The criticism is certainly valid in other circumstances.

Sorry,

Dave

Andy Holdaway22/04/2016 15:46:39
avatar
167 forum posts
15 photos

Muzzer, yes, I have the Siglent SDS1102 (from memory, it's at home). Can't fault it for the things I use it for.

Andy

All Topics | Latest Posts

Please login to post a reply.

Magazine Locator

Want the latest issue of Model Engineer or Model Engineers' Workshop? Use our magazine locator links to find your nearest stockist!

Find Model Engineer & Model Engineers' Workshop

Sign up to our Newsletter

Sign up to our newsletter and get a free digital issue.

You can unsubscribe at anytime. View our privacy policy at www.mortons.co.uk/privacy

Latest Forum Posts
Support Our Partners
cowells
Sarik
MERIDIENNE EXHIBITIONS LTD
Subscription Offer

Latest "For Sale" Ads
Latest "Wanted" Ads
Get In Touch!

Do you want to contact the Model Engineer and Model Engineers' Workshop team?

You can contact us by phone, mail or email about the magazines including becoming a contributor, submitting reader's letters or making queries about articles. You can also get in touch about this website, advertising or other general issues.

Click THIS LINK for full contact details.

For subscription issues please see THIS LINK.

Digital Back Issues

Social Media online

'Like' us on Facebook
Follow us on Facebook

Follow us on Twitter
 Twitter Logo

Pin us on Pinterest

 

Donate

donate