Good evening everyone
I have used Arduino in some pretty noisy environments and, with proper decoupling and good practices, was able to get the circuit working fine.
However, I was wondering if there was a way to auto detect Arduino hanging up (meaning frozen due to electromagnetic noise, not responding to inputs anymore) and self reset. It would be awesome if, after self reset, the code would resume from where it left off.
Does anyone have any idea how this could be implemented? Thanks
Use the watchdog timer, described in the MCU data sheet. A library is available for some Arduinos.
the code would resume from where it left off
I doubt that is desirable and may not even be possible. Most people assume that electrical noise or other malfunction (e.g. cosmic ray) has corrupted communications, stored data, etc. and allow the WDT to reboot the entire application.
impossible. otherwise it won't be called "reset"
Personally I prefer an external watchdog. The internal is nice but if you have external hardware that can get hung it will not recover unless the external hardware is also reset.
When it gets hung it is doing something it probably should not. It will most likely have corrupt data. Starting at the hung point which it cannot do, it most likely it would stay hung up. If a reset messes up things you need to reconsider your design and account for this possibility.
If this is a safety related application the Arduino is a poor/bad choice.
Thanks everyone for your kind answers
Thankfully the application I'm referring to is related to home appliances that I keep for myself, so nothing too dangerous here. A whole reset without resume would simply be a minor inconvenience due to the cycle starting over from the beginning
This sounds interesting. Any tips to how I can make this work?
Hard to contradict this, it makes sense.
Basically what I want to do is to save to EEPROM (this is a dishwasher) the selected cycle and options, how long it's been since the cycle phase has started and a few other simple pieces of information to resume the cycle from where it left off. Problem is, I can't save everything to EEPROM every step, since a wash cycle comprises more then 30 stages, there are many wash cycles and conditions to remember. Is there a chip that can be written many many times (more than 100'000 of the EEPROM) so I can save every few second the progress?
i would think about more stable environment for Arduino. Faraday cage or something.
[quote="Mattia9914, post:6, topic:1146665"]
Is there a chip that can be written many many times (more than 100'000 of the EEPROM) so I can save every few second the progress?
[/quote] Yes there is, I use them a lot, they are called FRAM. I use the 32K x 8 with I2C interface. They are good for over a billion cycles. Here is a link to get you started on some research, they are not expensive. Ferroelectric RAM with Arduino 2023 | Little Bird Australia
Thanks again
A couple questions:
- When the Arduino freezes is the millis timer still running?
- When the Arduino freezes are interrupts still going to be run?
You never said which Arduino.
If you use the Watchdog, it will never become hung/frozen
True, I forgot to mention. I mean the Mega 2560.
Do millis() ever become frozen? I mean due to Electromagnetic noise
If the microprocessor stops running then millis() stops.
But in your experience, if EMI freezes the MCU without resetting it, does it stop the microcontroller from running?
The MCU is the microcontroller, if it's frozen, it's not running.
Are you defining "frozen" to mean something other than "not running"?
I think what you are asking is if the processor(CPU) hangs, do some of the peripheral devices like the Timers, UART and TWI remain operational and running?
Yes but without a functioning CPU they are useless.
Perfect, this clears up my doubts
Thanks
If you use EEPROM.update or EEPROM.put (which one to use depends on the data type), it will only do an actual write if the data will change.
You must do the calculations. If you have 30 stages in a two hour cycle and your washing machines runs continously, you have 12 x 30 = 360 writes in a day. 100,000 / 360 equals roughly 300 days. If you only run one washing a day, that EEPROM will last years.
If you add wear leveling, the EEPROM will last you propably your whole life in both scenarios.
Thanks, wear leveling is what I was trying to get into. How could I implement it? I've seen tutorials on how to do it but they're all very confusing
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.