Thank you very much for your contributions!
I read your comments, thought about it and spend a lot more time more testing this.
Rpi Zero W 32Bit is on the very very low end of computing power. But if you get everything right, you can run surprisingly big systems on it, with very very low energy consumption. My Rpi setup is headless SSH (no Wayland), turned off Bluetooth radio, hdmi socket off, gpu_men=16ā¦.with now 700 nodes.
When I tried to update to Rpi Bookworm, Node-Red v4.0.5, Node.js v20.18.0ā¦I had problems with node-red-contrib-sensor-ds18b20 and node-red-node-pisrf.
I want to be fair to Raspberry - Node-Red - Node.js unofficial-builds project (officially Node.js stopped to support ARMv6 as of Node.js 12).
I can finally confirm: YEAH IT WORKS !!!
For all experts, it's boring and case is closed.
Maybe Santa will drop of Rpi Zero W 2 64Bit
For everyone with similar problems, what did I do and how did I debug this ?
DS18b20 sensor: I exchanged SD cards for and back. New system - old system, checking settings in raspberry bullseye, node-red configā¦..until I recognizedā¦..I am losing connection to this specific sensor on the old software system now as well. Murphy's law... . I replaced this sensorā¦.problem solved.
Node-red-node-pisrf, thatās a longer story.
On a long wire (>15m) I am running one of these JSN-SR04T v2 ultrasonic sensor modules. This module is known to be ādifficultā (physical sensor position, reflections of ultrasonic sound in thigh spaces, wide sensor beamā¦.) From 3 possible modes, I use the standard mode. To trigger a measurement, Pisrf has to send a very short burst of signal on one wire, while it is listening on a second wire for a result. If this interval of triggering a measurement is not happening in a regular interval, it will produce more outliers and a very high number of just faulty measurements, which canāt be filtered out.
So, first I decided to send a longer trigger signal and changed line 32 in nrsrf.py of the PiSrf library. I am not sure if that is beneficial to the communication between Rpi and the module but since itās mounted on a long wire, I just tried to give it a ābetterā signal (ā¦wire resistance, signal flanksā¦)
Then I used command ātopā on Rpi, to watch infoās about the running OS system.
First line to the right: āload averageā. That's where you should look first.
Three values for average CPU load of 1min/5min/15min. You can find a complex Linux definitionā¦ very simple imagine a row of cars, going bumper to bumper over a bridge. No car has to break. Speed of all cars is 1GHz. Thatās the speed of the RPi Zero W CPU. The value would be 1.0. A value below 1.0 means light traffic with bigger distances between cars. If you see higher values than 1.0, thatās heavy traffic. A value of 2.0 means, while one car is passing over the bridge, a second car has to wait until the first car has passed the bridge. You are looking at a backlog. Speed is still 1Ghz but cars (processes on your CPU) have to wait until they can āpass the bridgeā. No immediate breakdown, because traffic is going up and down. But still, the timing of these processes running on your CPU are influenced by a delay. If you just turn a single gpio pin to high, in most cases, it doesn't matter if this happens 25ms later. If you have connected a device, which expects signals within a specific time frame, this delay will cause problems.
I recognized higher average loads. ( simple: 3.0 is HEAVY trafficā¦all over 5.0 is criticalā¦7,9,12 you can pull the plug, your Rpi might be frozen and not recover from that...)
How to find the source of high workload?
Disable flows/nodes on your workspace and watch if short time load average is going down. If not even by a tiny bit, disable a different group of nodes. Search your workspace systematically. Itās a time consuming and subjective process. I found a ābadā gpio-out-node, causing higher traffic and I replaced this one. I checked all my JavaScript code in function nodes. Is there something marked red...deprecated or obsolete code language because of updates...
Lower load average = better timing I saw subjective less outliers returned by node-pisrf.
To support this further, I changed node-red-pi --max-old-space-size=256 to 128. Garbage collection kicks in earlier. I set the āniceā value of node-red (Linux process priority) from 0 (all processes are equalā¦) to -10 then -20 (highest priority)...to get that node-pisrf code with less delay through the process traffic. Python 3 processes went automatically up to -20 as well. I changed swapping from 200 to 280 to allow temporarily a bit more "memory" space.
All these settings have advantages and disadvantages. You have to try a bit and find out, if these changes are a solution to your problem, without causing somewhere new issues.
After working though all my flows and trying better settings of the OS, I see the same accuracy of measurements with node pisrf, like I did with my old software setup. Next system update I will solder a resistor onto the JSN-SR04T v2 module to change to automatic mode (no triggering necessary). Maybe that's easier on timing too.
Hope this helps someone...Thanks!