Slight flickering at a certain brightness

Hi! I have an analog led strip connected to an esp8266 through IRF520N MOSFETs. When the brightness is between around 30 and 60 percent, there is a slight flicker of the LEDs. The esp8266 is properly grounded to to the LED strip’s ground. I’ve tried adding a 10k resistor between the gate of the mosfet and ground, and there is a slight improvement, but the issue is still there. Do you know what could be the cause?

Very possibly you’re running to an issue with your MOSFETs not being logic level devices.
They might work in some cases, but they’re not spec’d to turn on properly with ESP8266 output levels.

Check the KB for proper devices.

I tried with a IRLZ24N, but it still flickers. Could the esp8266 be faulty?

Maybe, but that’s not typical.
Try isolating it out to one colour channel, can you get R, or G, or B to flicker by itself at some brightness level?
You could also try physically swapping the GPIO pins for the colours
What happens if you cut the total string length in 1/2 (if possible).
Can you try running the ESP8266 with a separate power supply (keep the grounds common)?
What version of WLED are you running?

I tried with only G connected and at about 50% it starts flickering. I can’t cut the strip in half. I am running the latest version (compiled it myself). I’ll try with a separate power supply, but that will break my use case as it needs to be compact (I can’t use 2 power bricks).

If one solo channel causes the issue, much less likely to be a power issue which is where I was going with 1/2’ng the strip and/or separate PS’s
Try the other channels by themselves as well to see if it might be one GPIO causing the issue or all of them.
As well you can double check by moving the G channel to a different GPIO.

See if you can find and 8266 version of the current build in Serge’s files, just in case something’s off about your build (lot’s of complaints about recent “improvements” and updates breaking stuff with VSC and PIO).

Thank you, changing pins and adding 10K resistors reduced the flickering to an almost imperceptible level. The only time the flicker appears more pronounced is on yellow - which is weird.

Just for fun, swap the Blue and/or Green channels with the Red, but don’t change your WLED config.
That should give you a different colour that flickers the same amount as Yellow did.
The idea is to try and eliminate some interaction between the MOSFETs and the code.

Glad you’re getting it down to what you can live with…

Turns out the flickering was because I changed the default PWM frequency when compiling it from source. Now flashed again with the default frequency, and it works like a charm.