So i have a 328 smt board analog-reading 6 pots, 4 outs to a L298 to relays, and a "wave shield". I'm just using a wall wart power supply. Between the 12vdc and Vcc is a empirical ~100[ch937] resistor because the regulator was getting quite hot. I upload the code and it works swell, with or without the external power (relays and L298). I then unplug the usb and "reboot" on DC to a very reproducible crash. After the hang, the device will no longer work until i re-upload the program again. What is the problem? I wouldn't think its the code. Is there a current surge during boot that the resistor fatally limits? Extra caps at Vcc -> ground don't help. The output (on a scope) of the power supply looks normal.
Do I really need a zener et al? I am missing something as the avr eats it so easily; everything else is triple checked. Any advice is much appreciated. Thanks in advance.
Check the power curve on the "wall wart" plug pack when you turn it off/unplug it. Its probably got a Capacitor in it slowly discharging after you disconnect it from power/switch it off leaving the Arduino running for a short period (like a few milliseconds) allowing a corrupted flash to occur.
I haven't had the issue myself, but I have read around here of issues relating to slow power-off's.
Basically, (and I'm paraphrasing, no doubt badly) 'duino's have got freakishly low Brown-Out Detection fuses set by default - around 2.7Volts I believe ?? This is the point that it will 'detect' a brownout and 'stop' writing to EEPROM etc.
With the default BOD fuses and a capacitated <??> power-supply the 'trickle down to 0 volts' effect causes the arduino to remain operating - running - well below the safe 'write' voltages for the EEPROM/Flash.
I recall reading that changing the BOD fuses to 4.9 Volts will 'fix' the problem because this causes much earlier blocking of potentially dangerous calls. There was something specific in a sketch that would cause it (eeprom write or something ??)
Someone hopefully can correct me - but I think the BOD Fuse settings and a search around the forum for "Brown Out Detection" could be worth a try...
(Note: I am pretty new to all this stuff, just relating a topic I read around here few nights back that seemed to cover the same stuff. Apologies if its completely unrelated....)
Between the 12vdc and Vcc is a empirical ~100[ch937] resistor because the regulator was getting quite hot.
I think your Vcc is to low for the regulator to work properly. 100[ch937] is quite high you'd better put 10[ch937].
With 100[ch937] you drop 1V every 10mA you use on the board.
Edit: Are you using Vin or Vcc input on Arduino board??
If it is Vcc, it is really dangerous for the Arduino as the voltage could rise if the consumption of your system fall.
It is more safe to enter throuht Vin input. The voltage regulator is designed to heat. Just put a 10[ch937] resistor if you want it be less hot, as I was saying before.
Thanks to all. I'm using Vin and just posting sloppily. I'll try scaling back the resistor and maybe move the ON switch between the dc converter and board.
Edit: The changes do seem to protect the flash, but the project still hangs after one sample, which I bet is software........ many thanks.