ESP32 crash when running pump via MOSFET module

Hi all!

I’m trying to use an ESP32 to toggle a pump.

I have a cycle of 3s on 9s off. At times it runs for several minutes, other times it starts crashing and restarting the ESP32 after a couple of seconds of the pump turning on.

I added a flyback diode 1N4007, but I didn’t notice a difference. Added capacitors to try to minimise the noise, but it doesn’t seem to make much of a difference.

I think this is the main part of the error

main_task: Returned from app_main() Guru Meditation Error: Core 0 panic’ed (Interrupt wdt timeout on CPU0).

It works fine when I cycle 1s on 1s off.

I’m new to this world, I assume I’m doing something fundamentally wrong :smile:

2 Likes

This hints at a loop/wait somewhere that is not allowing the RTOS to do its thing, which includes clearing the watch dog timer.

e.g. normally in the main loop will be a forced delay, allowing the RTOS to take over.

 vTaskDelay(10 / portTICK_PERIOD_MS);

this example will say "you can have the cpu for at least 10 ms). not you can play with the amount of time bit it does need something.

You can put a blocking wait in a loop

    uint64_t GotTime = 0; //esp_timer_get_time();

    while (1) 
    {
        if ((esp_timer_get_time() - GotTime) >= (1000 * 5000)) { // 5 Seconds
           // work load
            GotTime = esp_timer_get_time();
        }
        vTaskDelay(10 / portTICK_PERIOD_MS);
    }
2 Likes

After doing some more testing, I realised that if I remove the power from the MOSFET VIN or if I remove the pump from the VOUT, it doesn’t crash. So it might not be a software issue?

I’ll still give that a shot @Michael99645, thanks.

3 Likes

You may be getting induced currents into the long leads to the ESP32. You could try shortening the wires or putting some ferrite chokes to stop the spikes from getting to the ESP. If you have an Oscilloscope, you may be able to see them.

3 Likes

I moved the pump wires away from the board and twisted them; that fixed the issue.

Thanks for the tip @Michael46871

2 Likes

No problems @Rafael239025 glad I could help.

2 Likes