Serial on Raspberry PI3B+ don't work

Hello everyone,

after some hours to try everything I found on forum I'm finished to create this topic.
I try to send a string through the serial port of my Raspberry PI3B+ with node-red.

Even I don't hace the correct sentence on the receiver (just a configuration), it works with the simple bash command : echo "Hello" > /dev/ttyAMA0. It works too with /dev/serial0 then the configuiration is OK.

I added a inject node with "hello" and a serial out node to serrial port.
I tried with /dev/serial0 without error but not the slightest character on the receiver.
And with /dev/ttyAMA0 it crashes node-red. Need to delete the node in flows.json file and reboot.

I tried with serial control node and it seems to work: no error and node "connected" with the right parameters.
All other development works fine.

Is someone can help me please?

Thanks a lot.

PS : installation in docker with following version
debian 10 (buster)
node-red 3.1.5
node-red-node-serialport 2.0.2
rebuild --build-from-source done too.

Hi, Welcome to the forum.

Have a look at this topic,

As you are using Docker, have you enabled the serial port in your Docker environment?

Hello,
thanks a lot for your response, i try this this weekend and will give you a feedback.

Regards

Finally, I found some minutes to test your proposition.

I enable the serial port in docker.
The result is no crash of node-red when i inject a string in "serial out". Good evolution.

But,

  • the command echo "hello" > /dev/serial0 is already OK : data received
  • the injection of "hello" in "serial out" node in node-red is NOK : no data received

Other ideas?

Thanks.

You might need to check the node settings to make sure they match the actual settings of the serial port.

Also, I'm surprised that worked because I'd expect Node-RED to have locked access to the port. Though I'm not 100% sure to be honest.

Have you checked in the dmesg log to see if there is an error? Also, have you checked the Node-RED startup log for an error?

all settings checked.
No message in dmesg.
No message in node red console (just inject successfully on top)
How can I access to node-red log please?

I don't have the "Connected" at the bottom of the node "serial out" but it appears on the "config" node.

Sorry, the ttyAMA0 doesn't work... even after @TotallyInformation proposal to enable serial port in docker.
I don't know how verify the serial port is really enable.

Hello,

I found the solution there: https://community.gladysassistant.com/t/node-red-mise-a-jour-de-la-palette-node-red-node-serialport-1-0-1-fait-planter-le-docker-node-red/7154/18

It's in French but the solution is just to rebuild the node-red-node-serialport.
It doesn't work with the initial build.

sorry for disturbing you
have a nice day

Serial requires a compiled C/C++ component. In keeping with all Node.js apps that interface with C/C++ components, when changing major versions of Node.js, you should rebuild the dependencies with npm rebuild or bad-things™️ will happen.

So do remember to do that when node.js major versions change. Other nodes of similar ilk will be SQLite, bluetooth, and quite a number of others. Safest simply to build rebuilds into your process when you upgrade to a new major version of Node.JS.