Esp32 restarts when controlling 4 high power dc motors

Hi,

I have created a circuit that can control 4 dc motors simultaneously and driving them using SimpleDCMotor library.

The circuits works perfectly fine when I use drv8833 to control 4 small dc motors with encoders ( motor). These motors are rated 12v with max 300ma. You can see the whole setup working video here

But now when I replace drv8833 with zk-bm1 driver and higher power dc motor ( motor) , esp32 restarts.
It works perfectly controlling 2 motors simultaneously but restarts when I start using 4 motors.

You can see my circuit as shown below. Please don’t mind the design ( I am new to pcb designing and quickly drew this)

Things I have tried:

  1. 2 separate power sources for motor and (esp32 + motors encoder)
  2. 3 separate power source 12v for motor, 5v for esp32 and 3.3 for motor encoders
  3. Added Capacitor 440uf at input 5v of esp32

So this is somehow related to pwm wires controlling this hungry motors, since the only difference is base rpms and max current these 2 motors can draw. But I am not able to figure out what I should do, could you please help me.

Hello, and welcome.

All that said, it seems you got a problem with the bulk capacitance. You need to quadruple the bulk caps and your problem may disappear? Also increase the capacitance a lot on the esp32.

Last but not least, isolate the esp32 from any EMF interference.

Cheers,
Valentine

Measure the current needed for each of the zk-bm1. The ESP32 can provide up to 40mA per pin (20mA recommended), but the LDO usually is limited to 250mA or so. You use 8 pins, even at 20mA each, you can exceed the LDO current and end up with a brownout and reboot (160mA for the 8 GPIOs, plus 100-150mA for the ESP32 itself).

You might need to use a separately powered buffer to limit the ESP32 current draw. Or you can try powering the ESP32 board with a clean, 1A 3.3V (so that you bypass the LDO on the ESP32 board)

1 Like

This library is also maintained by simpleFOC, I thought?

Wow, didn’t pay attention and I totally forgot about this. Thanks for pointing out! @runger would be really unhappy haha.
I confused this with the Arduino DCMotor library DCMotor - Arduino Reference

Cheers,
Valentine

I doubt it’s the current draw on the PWM lines… the current on the inputs of the DRV8833 is measured in micro-Amps:

However the fault output is open drain, and I would put a series resistor between it and the MCU pin.

I think two explanations are more likely candidates:

  1. Power issues, as mentioned by the others. DC motors are noisy, and the power draw when starting them up can be high. Try enabling them one by one with some delay in between to see if it helps, and try to decouple the power supplies for motors and MCU…

  2. Software issues - are you using FreeRTOS tasks? Are you sure it’s not an issue of the watchdog timer or peripherals misconfigured? If you can share your code we can take a look to see if we spot any problems…

Yes, the DRV8833 is clearly not causing excessive current draw problems.

The problem the OP reports, though, is not with the DRV8833, it’s with the zk-bm1 module. I cannot find a schematic, but it looks to be a module with just MOSFETs driven by the INx pins thru some resistors and transistors. There’s no “driver chip” visible in any of the pictures for that module. It’s possible that it uses a lot more power than the ESP32 can provide, that’s why I suggested to measure the current draw

Thanks for your reply guys. I was away and couldn’t test the power issues and reply back
Although I don’t know the exact reason, I found out the problem.
I had a common wire from 12V boost converter which then split and connected to all the drivers. Although there was no problem in boost converter output, the common wires thickness (AWG) was not enough for the sudden draw of current from all 4 motors starting simultaneously (I thought there was no load to draw that much current). I increased the thickness of this wire and everything worked seamlessly!

1 Like