Hardware PWM Node-Red


I'm looking for a way to use fully hardware PWM on my RPi Zero.
I want to control a PWM fan requiring 28 kHz.
The GPIO PWM nodes are software only (?).

Does anyone have a script to control the PWM signal through red node?

Hi Sleep,

you can use this module:
This is a 1Hz-150Khz Signal Generator Modul.

They have RX and TX inputs.
Connect only to RX with 9600bps, 1 stop bit.
Send string "F28.0" for 28kHz.
Send string "D050" for 50% duty.
Use serial node in Node-Red.

1 Like

It's not possible without this additional hardware?
Would it be possible to create the PWM with RPi hardware?

You can use this python library that support this frequency:

But it is not used in any Node-Red node.

I'm completely new to this stuff.

Could you make a script for me and tell me where to run it?


Does node-red-node-pi-gpiod use that?

Oh yes @Colin, it use the pigpio, sorry.
Node-Red has 4000 nodes and it isn't easy to remember all.
@Sleep I think you can use it for 28 kHz.
An other question: Which hardware do you use for driving PWM fan because the gpio drive only 16mA ?

The node-red software generated pwm is not available for these higher frequencies. I havent figured out how to use the RPis build in hardware to generate 28k.

Yes the pigpiod node uses that Pigpio library which can use hardware pwm, so use that node rather than the default pigpio node

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.