I am building a custom ESC to drive my BLDC motor. The motor spins in open loop and I want to debug the back-EMF detection circuit, but as soon as the motor spins, the signal line of the MCU (MCU uses USB 5V power supply from my laptop) and the voltages in the three motor phases becomes so noisy that back-emf detection is impossible. I added one 1000uf and one 2200uf capacitor in the 12V power supply, but it didn't help.

  1. What's wrong with my circuit?
  2. I found that some of the spikes happens in the PWM raising and falling stage, is this caused by the inductance of the motor? If so, how can I solve this problem?

Here is my circuit:


Here is my breadboard: breadboard

Here is a test PWM signal output from STM32, before the motor spins:

clean pwm

Test PWM signal when the motor is spinning:

spiky pwm

Voltage signal for phase C:

voltage signal

Voltage signal zoomed in:

voltage signal zoomed in

  • 4
    \$\begingroup\$ Those flying cables are good antennas to pick up noise. \$\endgroup\$ Aug 8, 2022 at 10:25
  • 6
    \$\begingroup\$ What's wrong with my circuit = breadboard in a word \$\endgroup\$
    – Andy aka
    Aug 8, 2022 at 10:53
  • 2
    \$\begingroup\$ The diagram shows decoupling capacitors but I don't see them in the picture. Did you include them? Especially with the breadboard you're going to need every bit of decoupling you can get. \$\endgroup\$ Aug 8, 2022 at 13:20
  • \$\begingroup\$ Your build method won't perform much better than a solderless breadboard. When you wire a perfboard/vectorboard by hand, you need to make it function more like a one-layer PWB. Plan your wiring carefuly before you solder anything. Create "bus-bars" using heavy wire (I use 16 AWG) for ground and 12V. Arrange your high power components so they are close to the power and ground buses. When connecting to the power buses, you can use slightly smaller wire (I use 20 AWG). Use even smaller wire, on the bottom, for low-current signals (I use 24 AWG, some people use 26 AWG). \$\endgroup\$
    – Mattman944
    Aug 8, 2022 at 13:35
  • \$\begingroup\$ Long wires, lack of ground plane and lack of decoupling capacitors. \$\endgroup\$
    – winny
    Aug 8, 2022 at 13:47

2 Answers 2


All those fly wires contribute ballpark 1nH per mm of length. Doesn't sound like much, but it adds up.

Inductance means a voltage drop when current is changing (V = L dI/dt). You didn't mention what transistors, or what load current, but I'm guessing some amperes, and it can probably be switched in ~100ns or less, so wire lengths of ~100mm might be dropping several volts peak.

I think you will also find, the noise is visible on "ground" itself (i.e., probing the ground clip where it's connecting to the circuit), or pretty much everywhere else in the system. This is common-mode noise. It means there is voltage generated with respect to some other ground, making a loop back to your oscilloscope (through its power cord ground). It might be the power supply, PC (via MCU + USB connections), or straight-up radiated to space (long wires to power supply / motor?).

All together: it seems you have voltage drops, due to changing current, across wires including what is notionally "ground". In quotes, because there's the fiction of what we want ground to be (an ideal zero-potential reference), and there's the reality of what happens in circuit (voltage drops everywhere).

The best way to avoid this, is to trace current loops in the system: notice the gate-source loops from the drivers, the source-VDD loops from the bootstrap diodes (D2, etc.), the +V/out/GND loops from each inverter -- minimize each of these individually, with shortest wiring lengths, small loop areas, and wide conductors (broad facing area with narrow spacing: think wide copper pours on top and bottom of a PCB).

Indeed, the best single design principle you can employ, is the ground plane.

The best way to do this for a proto, is to use copper-clad PCB, and either cut pads out of the top layer, or add pads on top ("Manhattan" style) to make connections over the top copper (which will be your plane). The plane is a very wide conductor -- still not ideal, but a vast improvement over loose wires -- and its proximity to your conductors keeps loop areas small. Most of all, it acts as shielding, in that the magnetic field from one wire is mostly blocked by the plane, rather than shared by nearby wires (mutual inductance, coupling).

Which is another big problem with the style of layout you've used: the wires are wide open, magnetic fields go everywhere. Hence, you pick up those transients pretty much anywhere in the build -- or indeed in the space above it (try clipping probe tip to clip, making a one-turn loop, and waving that over the circuit). With ground plane design, you'll find that goes away, and you have to actually clip into the circuit to see nasties -- and what nasties will be there, will be much smaller!

As for the circuit design, mind that you have outside signals coming straight into comparators. LM339 responds at up to a few MHz. You may be having chatter here, due to the high frequency noise; maybe this doesn't do anything (latched receiver?), or maybe it's disastrous (those signals being labeled INTR (interrupt?) is a little unsettling..). In short: consider adding at least an RC filter to the motor sense lines, and maybe hysteresis as well.

  • 2
    \$\begingroup\$ I think the only thing I can see to add to this is to make the low-power traces physically separate from the high-power ones. For a board like this, if it's going to work at all for through-hole, I'd put the power section running across the narrow side, then put the comparator underneath. I'd make the high-current wires thicker just for reduction in inductance, and I'd dress all the wires so that they're tight up to the ground plane, not "flying". Or, I'd design a PCB and have it built at a circuit aggregator. \$\endgroup\$
    – TimWescott
    Aug 8, 2022 at 14:23

In addition to the good hints already given, I suggest to slow down the MOSFETS and add some snubber networks. If you use e.g. 100 ohm instead of 10 ohm as gate resistors, the voltage gradients at the phase outputs are not that steep. The efficiency is a bit worse and the MOSFETs will get hotter, but if you want to debug the back-EMF this will help.

A hard snubber network of 10 nF in series with 4.7 ohm / 1 W directly across each low side MOSFET will further dampen the gradients.

Consider this as a kind of "first aid", not as a proper solution to compensate the underlying problems.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.