I recently set up a new Raspberry Pi 3 with Node Red V1.1.3. The Raspberry Pi 3 uses Raspberry Pi OS lite 5.4.
I copied the node red flows from one working system to this new system. Everything worked except that I noticed a huge CPU usage jump. The new system uses much less memory and has less apps running than the working system. The working system uses Node Red V1.1.2.
I troubled shoot the problem and found that the Serialport node caused the problem. If I remove the serialport node, then the CPU usage quickly drops down to normal level (2-4% typically). If I add the serialport node back, the CPU usage jumps more than 100% and the board will heat up quickly.
There are only two major differences that I can think of:
Raspberry Pi OS (the working system has Desktop, the new system does not). I doubt that this is the problem.
The working system uses Node Red v1.1.2. The new system uses Node Red v1.1.3. I doubt that this is the problem either.
What could cause the problem? Thanks for your help.
Did you happen to copy the whole .node-red directory from from the older system? I'm asking as the serialport library has native code bindings and might need to be rebuilt against the libraries of the new installation.
Another thought that occurred is that the serialport build could have failed due to missing tools/libraries during the installation.
This is somewhat of a longshot but just my first thoughts on what I can think of as a potential issue. If you want to try to force a rebuild (noting possible errors), log in to your Raspberry and run:
Thank you very much. I did a fresh installation of the .node-red on the new system.
But it might be related to what you suggested. The old system uses USB to serial interface (/dev/ttyACM0). The new system uses UART interface (/dev/ttyAMA0). When I changed the serial interface of the new system to /dev/ttyACM0, then the CPU usage drops back to normal (less than 4%). When I change it back to UART interface, the CPU usage shoots up more than 100% again
OK. I changed the serial interface on the old system to /dev/ttyAMA0, the CPU usage on the old system also shoots up more than 100%. Now I am convinced that this problem is due to the /dev/ttyAMA0 port usage with Node Red Serial port node.