Encoder Input to select a value 0 to 10,000

This will, with a bit of luck, be the first post of many. I have started a project that is way in excess of my capabilities! The end goal is to create a control panel for the control of some industrial equipment. My plan is to build the outline of the control system by using Node-Red; I will heavily rely on this community in order to do so. Once I have a rough system working the plan will be to seek the help of a "professional" to "write it properly" using my project as a rough guide...

So one of my first hurdles is to maximize the use of an encoder. I would like the push button part of the encoder to select/scroll through a variety of parameters such as Velocity, Acceleration and Deceleration. By twisting the encoder I would like to generate a value between 0 and 10,000 for one parameter then push to select the value and move on to the next parameter... I have found some flows on the forum but nothing that increments, selects and then moves on.

All guidance and suggestions will be appreciated, thanks in advance.

Welcome to the forum Graham.
Have you already got the encoder connected and data coming from it? If so then what events have you got so far(button, inc, dec etc).

Yes, I have the encoder connected and receiving a stream of 1 for every CW click and -1 for each CCW click. I am using the method below copied from:

https://discourse.nodered.org/t/using-rotary-encoder/29775/13?u=graham

[{"id":"88d5b9e0.6a69d8","type":"change","z":"f6ce3d25.58cde","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"CLK","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":320,"wires":[["2cb38dd4.874a02"]]},{"id":"4dbfa867.fa67b8","type":"change","z":"f6ce3d25.58cde","name":"","rules":[{"t":"set","p":"topic","pt":"msg","to":"DT","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":490,"y":400,"wires":[["2cb38dd4.874a02"]]},{"id":"2cb38dd4.874a02","type":"function","z":"f6ce3d25.58cde","name":"","func":"var CLK;\n\n\nif ((msg['topic']) == 'CLK') {\n  CLK = (msg['payload']);\n  if (context.keys().includes('DT')) {\n    if (CLK != (context.get('DT'))) {\n      msg['payload'] = 1;\n    } else {\n      msg['payload'] = -1;\n    }\n    return msg;\n  }\n} \n\nelse {\n  context.set('DT', (msg['payload']));\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":720,"y":360,"wires":[["9543b076.48206"]]},{"id":"8e3318a4.9b7e98","type":"comment","z":"f6ce3d25.58cde","name":"CLK","info":"","x":470,"y":280,"wires":[]},{"id":"a7845bc1.044ff8","type":"comment","z":"f6ce3d25.58cde","name":"DT","info":"","x":470,"y":440,"wires":[]},{"id":"fe4bcbaf.faeca8","type":"rpi-gpio in","z":"f6ce3d25.58cde","name":"","pin":"8","intype":"tri","debounce":"0","read":true,"x":290,"y":320,"wires":[["88d5b9e0.6a69d8"]]},{"id":"51e69e11.005ea","type":"rpi-gpio in","z":"f6ce3d25.58cde","name":"","pin":"7","intype":"tri","debounce":"0","read":true,"x":290,"y":400,"wires":[["4dbfa867.fa67b8"]]},{"id":"9543b076.48206","type":"debug","z":"f6ce3d25.58cde","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":950,"y":360,"wires":[]}]

You won't find a flow to do exactly what you want. You will have to work out the logic and then implement it. I suggest building a bit at a time, so you could start with the logic to manage the 0:10000 up/down and showing that on the dashboard. Doing it incrementally like this will mean that you have to re-work bits as you add more features but that is a good way of learning.

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