Hi there,
I have recently been using the rev-pi-nodes-server on Node RED and I started to conduct some tests on the polling rate that it has. One thing I noticed is that the input pin only provides an output under the condition that a value change has been detected, which differs from how polling operates. Nevertheless, I tested the node with a temperature sensor and collected the data along with timestamps, I induced a change in the temperature sensor by placing my finger on it. After analyzing the data and the timestamps, I noticed that how fast the change is detected is not consistent between data points. For example, when the ADC sampling rate is set to 20Hz, on average the time taken between points lie in the region of 200-270 ms, but occasionally it would be off by 100 ms. My questions are:
1) How does the revpi nodes server operate? Why would there be such discrepancies in the time taken between data points?
2) If polling were to be achieved, meaning fixed rate of receiving data, how would it be achieved with the rev pi nodes server?
Thank you!
Trouble with Rev Pi Nodes Server
Re: Trouble with Rev Pi Nodes Server
Hi halcyon0606, I have moved your post here so that the experts of the RevPi Nodes for Node-RED may help you as fast as possible.
-
- Official 3rd Party Support Erminas
- Posts: 38
- Joined: 22 Jan 2020, 14:31
Re: Trouble with Rev Pi Nodes Server
Hi,
to answer your questions:
Greetings,
Jonas
to answer your questions:
The server (https://github.com/erminas/noderedrevpinodes-server) is internally using RevPiModIO (https://revpimodio.org/en/doc2/) to get the pin values from the RevPi memory image. RevPiModIO has a tight polling loop which triggers decoupled event callbacks on pin value changes in the server. The server sends those value changes over network to the Node Red Backend, which are finally send to the javascript client/browser/frontend. At each of those steps you have additional delay. My first guess would be your observed discrepancies are caused by network delay, but if it is always off by excatly by 100ms then there might be a bug somewhere.1) How does the revpi nodes server operate? Why would there be such discrepancies in the time taken between data points?
The single and multi input nodes don't support fixed data rates. If you need a fixed rate, I would suggest using the getpin node (with optionally something like https://flows.nodered.org/node/node-red ... ples-timer), which instanlty polls a value when it's triggered in Node Red. Keep in mind, that you will still experience the already mentioned network delays.2) If polling were to be achieved, meaning fixed rate of receiving data, how would it be achieved with the rev pi nodes server?
Greetings,
Jonas