Hello. I built a solar water heater controller with an arduino duemilanove and today it had a problem where it locked up while I was away, causing it to dump all of my collected heat to atmosphere (over 100,000 btu worth)
I have no idea why it locked up, as its run flawlessly for weeks... It locked up while the recirculation pump was on, and the pump stayed on from that point on.
Now, its apparent to prevent this from happening again, I have to get a watchdog timer setup! However, I keep reading conflicting information. Some posts suggest that if you use the watchdog timer on a stock bootloader, it will definitely loop your board. Others say that it MIGHT loop your board... Still others post tutorials on how to do it without any mention at all as to whether its safe to use or not. So which is it? Not sure if it matters, but the plan would be to use the longest timeout (8 seconds) to do a reset (with no interrupt)
I wouldn't mind changing bootloaders if need be, but I don't know how to. I don't own a computer with a parallel port, so thats out of the question. Can't I do it right on the arduino somehow? What do I need to do to reflash the bootloader? (I run Ubuntu exclusively and don't own a windows box)
Hi, can't help you with this, sorry, I just started with Arduino myself. But I'm interested in your solar project. I have a solar hydronic system I designed and built in 1981. My controller is based on a New Micros nmix-022 board running Forth. I added some very ambitious peripheral circuitry which shockingly still works - lots of point to point wiring, op amps and voltages. I want to redesign and make the whole thing a lot simpler. I think I can do that with an Arduino Mega and a HP-48 calculator for user interface. I live in Springfield, Oregon. I have 6 4x8 foot collectors mounted vertically by a south sloping roof for winter optimization. Storeage is a 1250 gallon tank buried under the kitchen. Let me know if you would like to compare notes.
Smiles, Art Kennedy
jondecker76:
Some posts suggest that if you use the watchdog timer on a stock bootloader, it will definitely loop your board. Others say that it MIGHT loop your board... Still others post tutorials on how to do it without any mention at all as to whether its safe to use or not. So which is it?
What does "loop the board" mean?
I've done some experimenting with watchdog timers, here is one example sketch:
#include <avr/wdt.h>
void setup ()
{
Serial.begin (9600);
wdt_enable(WDTO_1S); // reset after one second, if no "pat the dog" received
} // end of setup
void loop ()
{
Serial.println ("Entered loop ...");
Serial.println ("Point A");
delay (500);
Serial.println ("Point B");
delay (500);
wdt_reset(); // give me another second to do stuff (pat the dog)
Serial.println ("Point C");
delay (500);
Serial.println ("Point D");
delay (500);
while (true) ; // oops, went into a loop
} // end of loop
I don't see why you need to use 8 seconds (of course you could if you wanted to) but surely a simple monitor should be able to "pat the dog" once a second?
I would think that a simple bit of code (basically the wdt_enable() in setup, plus the wdt_reset() in your main loop) would be enough to reset your processor if you have gone into a loop for some reason (eg. ran out of memory).
I don't know what downsides there would be. This stuff about "looping the board" - don't know about that. Surely you can just power it off if that happens?
Some posts suggest that if you use the watchdog timer on a stock bootloader, it will definitely loop your board. Others say that it MIGHT loop your board... Still others post tutorials on how to do it without any mention at all as to whether its safe to use or not. So which is it?
There is some history to the problem. The arduino bootloader from a few 'boards' ago would not handle watchdog timer resets correctly, where if WDT timed out it would cause a reset which would activate the bootloader code, which didn't handle the WDT correctly (it didn't disable the WDT) so it would just time out once again (after it's programmed timeout period) and restart the bootloader once again, etc. So that must be what 'loop the board' means, although I hadn't heard it called that. More like stuck in a WDT timeout loop.
Anyway, adafruit was the first to release a 3rd party bootloader code that correctly handles WDT interrupts so it doesn't get trapped in the bootloader. And I know that the newest UNO board has an updated bootloader that also handles WDT correctly. I can't say about other arduino boards, as I've made it a practice to use the adafruit bootloader for all my 328 based boards.
Yes, by "loop the board" I was referring to a software loop in the bootloader. From what I've read, once you enable the wd on some arduino boards, if it has to reset, the wd stays enabled, but goes to the minimum time and timesout again in the bootloader before its able to start executing your program, and resets again etc etc... Makes it so you can't even load a new sketch in and the only way to fix it from there is with a real programmer. But I can't seem to find which models have this problem. I guess I'll just have to bite the bullet and give it a try - and if it fails hurry up an get an Uno
Anyone know if I can load a bootloader right with the arduino software over USB?
artk13 - I started a post on the fieldlines discussion board on my solar hot water project (mine is a bit smaller than yours at 66 sqFt of collector and 240 gallons of storage) - feel free to chime in on the post there:
Anyone know if I can load a bootloader right with the arduino software over USB?
Any 328 based board can run the newest Uno 328 bootloader code. Once loaded you will then have to select the uno board from then on, even if it's a physical 2009 board or some clone board, etc, as long as it has a 16mhz clock source.
As far as how to burn a bootloader and what you need, that has to be one of the most frequently posted topic these days, a search will show the several methods.
jondecker76:
Yes, by "loop the board" I was referring to a software loop in the bootloader. From what I've read, once you enable the wd on some arduino boards, if it has to reset, the wd stays enabled, but goes to the minimum time and timesout again in the bootloader before its able to start executing your program, and resets again etc etc... Makes it so you can't even load a new sketch in and the only way to fix it from there is with a real programmer.
I can't believe that, from a simple sketch, you can render the board unusable. Turning the power off and on again should fix it. Ordinary sketches can't change program memory, nor the fuses. So a power-off should reset anything it might have done.
Like I said, the information is so varied - from people showing how to do it and claiming no problems, to people that just need to power cycle to reset things, to people that have to reflash a bootloader (though some of these might have been people trying things low-level without the avr library and messing up fuse bits etc...)