I've developed a PWM LED strip dimmer equipped with a 230VAC to 5VDC converter and an ESP32 board (schematics below). If I hook up the oscilloscope to the input of the LED, the PWM signal shows weird behavior:

osci pwm signal

It somehow jumps to negative voltages, but it only happens if the circuit is somehow powered by an AC/DC power supply, i.e. by the builtin AC/DC supply or if it's connected to the MacBook by USB and the laptop is connected to the charging brick (it doesn't have electrical earthing). Only if it's powered by a battery i.e. the MacBook is not connected to the charger, the PWM signal looks fine.

Do you have an idea, of what the culprit could be?


  • \$\begingroup\$ Can you zoom out on the time base? \$\endgroup\$
    – winny
    Commented May 14, 2022 at 12:41
  • 1
    \$\begingroup\$ Do you happen to have a device with grounded plug connected to ungrounded socket? And it seems you might have high impedance floating supply, or what kind of supply module that is, does it require Y caps for EMI filtering, or has it got internal ones? The fact that you are switching neutral instead of live might have something to do with it. \$\endgroup\$
    – Justme
    Commented May 14, 2022 at 13:05
  • 1
    \$\begingroup\$ @winny I think the pattern is repeating at 50Hz. \$\endgroup\$
    – JoLau
    Commented May 14, 2022 at 19:36
  • 1
    \$\begingroup\$ Increasing scope timebase and switching sync mode to AC grid possibly will reveal the cause. When power transistor turns off, its output becomes floating and acts as antenna. Adding resistor in parallel to LEDs possibly will solve the case. \$\endgroup\$
    – Vladimir
    Commented May 14, 2022 at 19:57
  • 1
    \$\begingroup\$ @JoLau Please edit into the schematics where the scope probe tip and ground are connected. It may solve the issue. \$\endgroup\$
    – Justme
    Commented May 14, 2022 at 20:28

1 Answer 1


The funny waveform is explained by the scope probes being connected to incorrect places for what you are trying to measure.

You are trying to measure voltage waveform of the LED from the LED terminals, as the probe tip is connected directly to LED positive supply and probe ground is connected to the LED negative terminal.

However, the LED negative terminal is not system ground, as it is switched to system ground by the FET. So only when FET is on, the LED negative is approximately same voltage as system ground. But when FET is off, the LED negative terminal is not connected to anything except scope ground.

Due to the floating power supplies, the LED positive can float to negative direction compared to scope ground. There must be an isolated or floating supply. If you had a ground/earth referenced supply, it would basically short out the FET so LED current would flow via scope ground to earth and the LED would be always on. The return path could be via PC USB cable as the PC ground is also connected to earth.

OK, so to measure it correctly, you would use two probes in differential mode. One probe tip to LED positive, and other probe tip to LED negative. Both scope ground clips to system ground (PGND). Then set the scope to display A minus B waveform and you have voltage waveform of LED output pins.


Your Answer

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

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