How to output 1-3 KHz using PWM

Hi there.
Fairly new to Node Red and it works very good so far and is easy to use.

I have a project where I want to control a valve using 0-10V. Everything else like reading values, setup dashboard etc works fine.
My setup is:
RPI 4, Automation HAT (Pimoroni) and a converter "PWM to 0-10V".

The "PWM to 0-10V" converter requires 1-3KHz.

I've done a lot of reading trying to find a good solution but have not found any.
Also, the input needs do be dynamic as I will need to control it with a PID for example.

Basically:

  • Is there a node I can use to get 1-3 KHz out?
  • Is there a way to configure some functions like timestamp, triggers etc to get the desired 1-3 KHz out?
  • Other ideas?

Cheers

That means that the PWM frequency must be somewhere within that range, it can be anywhere. The frequency does not affect the output it is the PWM that affectes the output. I think you will find that the fequency on a Pi is within that range so it should be ok. The standard GPIO Out node will do PWM, but according to the help text for that node node-red-node-pi-gpiod may be better for PWM.

Hi Colin,
Okay thanks. I've used that node-red-node-pi-gpiod now in the flow and I input the node with 50 (on GPIO 5, pin 29 which corresponds to "Output 1" on Automation HAT). So that should work then, and I'm getting low voltages like 0.1-0.6V out.

Then my problem is probably in the wiring between the automation HAT and the "PWM to 0-10V" converter
Can't seem to find it working, quite new to "Sinking" outputs as well. But this problem is probably a question for another forum.

EDIT:
Got it working with the wiring. Thanks for the help!

1 Like

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