Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

how to detect error and restart microcontroller for embedded system with Esp 12 or Esp 32

Status
Not open for further replies.

dashhossein

New Member
one thing that make me confused is how the microcontroller notice the errors and restart by itself
let me give an example
we have cooler system with Esp 32 and temperature sensor,when temperature be Above 25 centigrade degrees cooler will work until temperature reduce to 25 degree .
all the thing will work in the loop .

for example after 1 week of work errors come to esp , how is possible that Esp notice the error and restart automatically for fixing the error .

i don't want restart the board manually
 
It could be some odd error in your program code, or more likely some external electrical interference reseting the micro.

Are you turning the Cooler on by a Relay and is it mains powered ? both can cause a lot of interference that can Reset micros.

You could try a SSR instead of a Relay or a Mosfet if the cooler is DC powered.
 
It sounds like your processor is resetting due to the Watch Dog Timer (WDT). Google ESP WDT and see if there's a way to stop it. Or if the reset is caused by a particular function taking too long, maybe you can increase the time setting of the WDT.

Mike.
Edit, is there a way to log the heap size? Memory leaks can cause errors that take a long time to show up.
 
It could be some odd error in your program code, or more likely some external electrical interference reseting the micro.

Are you turning the Cooler on by a Relay and is it mains powered ? both can cause a lot of interference that can Reset micros.

You could try a SSR instead of a Relay or a Mosfet if the cooler is DC powered.

I think you've been confused by his 'unusual' English? (obviously not his first language) - his question isn't why the ESP is resetting (as it's not), it's how to make the ESP reset if an error occurs.

An obvious answer would be a watchdog timer - but it rather depends what's causing the issue, and where to reset the watchdog timer.
 
Same time, opposite interpretation of the OPs question. Hopefully one of us is correct.

Mike.
 
If you are programming with the arduino IDE, the number of milliseconds since startup can be monitored with millis() command. As in,
If millis() > 100000 {
ESP.restart();
}

the above will trigger a restart every 100 seconds. A much larger number can be used - google to check maximum. I remember it is about 7-weeks worth of milliseconds. I may be wrong.
 
If you are programming with the arduino IDE, the number of milliseconds since startup can be monitored with millis() command. As in,
If millis() > 100000 {
ESP.restart();
}

the above will trigger a restart every 100 seconds. A much larger number can be used - google to check maximum. I remember it is about 5 weeks worth of milliseconds. I may be wrong.

Well that's beautifully simple :D

You're probably right about 5 weeks or so?, I recall it's a fair while till it loops round, but not really 'that' long.

It's not actually resetting when an error occurs, but it may well do all that's required.

Edit: Just checked, around 50 days for overflow.
 
Status
Not open for further replies.

Latest threads

Back
Top