[SOLVED] Why a hot motor with floating PWM inputs?

Hi there,

I’ve just spent some time exploring an issue and it made me curious.

Here is my setup:

  • SimpleFOCMini EN pin hardwired to 3.3 V
  • SimpleFOCMini PWM pins connected to GPIO15-16-17 of an ESP32
  • Empty application: no code, no use of SimpleFOC, no pin init, no nothing.

The issue was that, as soon as I turned on the circuits, the motor was getting very hot, very quickly.

I soon discovered that GPIO15 is a special pin on the ESP32: at boot, for a few ms, it sends some logging information. In order to solve the issue, all I had to do was to do a pinMode(15, OUTPUT) in setup().

But why the hot motor? GPIO15 sends some signal at startup and then goes floating. Why does the SimpleFOCMini keeps applying a voltage?

1 Like

According to ChatGPT 3.5:

Allowing the PWM inputs of a motor driver to float (neither driven high nor low) can lead to unpredictable behavior and is generally not recommended. When a PWM input is left floating, it becomes sensitive to noise and electrical interference, and its state is undefined. The consequences of leaving a PWM input floating may include:

  1. Unintended Operation: The motor driver may interpret the floating state as a valid signal, leading to unintended motor behavior. This behavior could include unexpected movement, motor stalling, or other undesirable outcomes.
  2. Noise Sensitivity: PWM inputs are susceptible to noise, and a floating input may pick up stray signals or interference, causing erratic motor behavior.
  3. High Impedance State: Leaving a PWM input floating essentially puts it in a high-impedance state. In this state, the input can act as an antenna, picking up electromagnetic interference and potentially causing false triggering.
  4. Power Consumption: Depending on the internal circuitry of the motor driver, a floating PWM input might cause increased power consumption or unnecessary stress on internal components.

So I guess it answers my question. The specific behavior of GPIO15 is probably not involved here. I will need to be smarter with my EN pin: use a pull-down resistor and let SimpleFOC manage it :slight_smile:

I also tried to connect EN pin to 3.3V permanently. On ESP32 booting time, motors moving erratically. After boot, all works normally. But I use close loop. Even if the speed of the motors is 0, they do not turn off. Stays in “hold” mode all the time. I can see this if I turn motor by hand. I think when you use open loop, motor permanently got minimal voltage. So it gets hot.

@Rem666 , I would like to emphasize the fact that I think connecting permanently the EN pin to 3.3V is very dangerous.

In your case, you say that “After boot, all works normally”. My guess is that, in your program, you immediately use SimpleFOC to drive the motor, meaning that the PWM pins are properly initialized by SimpleFOC (so not floating).

The issue arrises when there is a bug in your program preventing SimpleFOC to get executed. Or when you simply didn’t realize the danger and uploaded an other program to your device, with no motor management.

In that case your motor driver is enabled (because the EN pin is 3.3V) and the PWM pins are floating. This can lead to burns and/or destroying your motor.

I agree.

This situation should be avoided at all costs. Amazingly, ChatGPT is quite correct this time.
The problem is the floating phases…

There are different solutions to your problem:

  1. Connect EN to the MCU board, and use a pull-down resistor on EN. This is probably the best way.
  2. Connect EN to 3.3V, but add pull-downs to your PWM inputs. This is less good in my opinion (and needs more components) but saves one pin on the MCU.
  3. Use the driver’s ENU, ENV and ENW lines and add pull-downs to those. Connect them to the MCU and set them high when you want to activate the phases. Disadvantage: needs 3 more MCU pins. Advantage: you can control the phases individually. Obviously this method would need a different board than the SimpleFOC mini, where the individual EN lines are not available to you.

In your code, the first few lines should be to set the pins into a safe state. Then even if the rest of the setup() crashes, the driver won’t be a a bad state. But since you need to be safe even when the MCU is disconnected or in programming mode, you really need the pull-down resistors as well.

– Edit –

However, in this case I think there is more going on. The DRV8313 chip used on the SimpleFOC mini pulls the INx lines low internally. So there are already pull-downs on the PWM inputs. So I think in your case the pins are not floating, but actually something is driving them high.


You are absolutely right. I am using the strapping pins of the ESP32 (GPIO15 and GPIO0) and it seems two of them, when not initialized, are high instead of floating!

Yes, I use GPIO14 (PWM output at boot).