Gpiozero PWM flickering

Inexperienced

I am running a python script on my pi that uses GPIOZERO's PWMLED module to change an led strip (connected via MOSFETs) but the lights flicker. The only other solution I have found is to make its priority higher using the renice command but it doesn't do anything.

Posted Apr 27, 2018, 9:06 AM UTC

15
WindWalkerWhooshMost of them•

I would bet you need a pull down resistor on your MOSFET gate. It's probably not fully turning off. I've had similar issues in the past.

3
QuantumCuberOP•

Yeah, I added that into my circuit but it didn't really do anything much. Ive worked out that it is due to the way gpiozero uses software based PWM so a pi 0w probably doesn't have enough RAM to cope.

1
WindWalkerWhooshMost of them•

I'd play with the value of the pulldown. It's not RAM, you're only changing 3 pins (or maybe 1 depending on your setup), and you only need to pull off about 1KHz. But it may not be the issue. Is your MOSFET rated to be fully turned on at the GPIO voltage?

1
QuantumCuberOP•

I don't know but when I would run any command in the rpi the lights would flicker and top shows 80-700% CPU usage

1
WindWalkerWhooshMost of them•

Hmm, maybe it's driving too fast then and using up all the CPU cycles. I should try it with my zero sometime but I already have too many projects in line. Besides I want to use an ESP8266 for light control.

1