Pulse Generator in RPi 3B+


I am looking for a code to generate pulse output based on the integer input from the dashboard.
user will input a value between 1 - 200 and this is pulse per min and a led connected to the GPIO 12.
can anyone give me any idea how to do this as I'm new to the node-red.

Node-RED uses Node.js and generally runs on Linux, Windows or Mac. None of that really supports real-time processing. So while you could easily enough produce a message in a time period, it wouldn't be exact. So you need to identify how exact you need the pulses to be. You also need to say whether you are looking for on/off pulses or just a trigger.

Welcome to the forum @plcguy.

You can do that with a couple of Trigger nodes. The first generates a stream of messages that the appropriate rate and the second turns them into on/off pulses.


[{"id":"f5ac7f1a.c6f05","type":"trigger","z":"bdd7be38.d3b55","name":"Configureable repeater","op1":"","op2":"0","op1type":"pay","op2type":"str","duration":"-250","extend":false,"overrideDelay":true,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":300,"y":4300,"wires":[["bd460116.6b503"]]},{"id":"16b6ad6b.3e7e4b","type":"inject","z":"bdd7be38.d3b55","name":"60/min","props":[{"p":"payload"},{"p":"delay","v":"1000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":90,"y":4260,"wires":[["f5ac7f1a.c6f05"]]},{"id":"23f3f81c.77ac28","type":"debug","z":"bdd7be38.d3b55","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":310,"y":4420,"wires":[]},{"id":"e19eaf37.90732","type":"inject","z":"bdd7be38.d3b55","name":"30 per min","props":[{"p":"payload"},{"p":"delay","v":"2000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"1","payloadType":"num","x":100,"y":4340,"wires":[["f5ac7f1a.c6f05"]]},{"id":"bd460116.6b503","type":"trigger","z":"bdd7be38.d3b55","name":"Pulse","op1":"","op2":"0","op1type":"pay","op2type":"num","duration":"50","extend":false,"overrideDelay":false,"units":"ms","reset":"","bytopic":"all","topic":"topic","outputs":1,"x":290,"y":4360,"wires":[["23f3f81c.77ac28"]]}]

If that works for you then all you need to do is work out how to use the dashboard to enter a value and then convert that into a period between pulses for sending to the first node.

Hi and welcome @plcguy.

For near microsecond hardware accuracy in generating pulses and timing input events I use the user mode pigpiod C library via the script commands provided.
Look for a simple example of scripting on the site and play around in a terminal.
Start pigpiod on boot.
Run your text script from an exec node to start stop pulses.