UART port issue

Hi Guys,

I am new to node red i have an issue with node red using the uart port on pi.

My goal in this is to read Energy meter data via UART port using modbus and share same data on MQTT.

Details:
Starting as a systemd service.
10 May 13:24:31 - [info]
Welcome to Node-RED

10 May 13:24:31 - [info] Node-RED version: v1.0.6
10 May 13:24:31 - [info] Node.js version: v10.19.0
10 May 13:24:31 - [info] Linux 4.19.97-v7+ arm LE
10 May 13:24:37 - [info] Loading palette nodes
10 May 13:24:44 - [info] Settings file : /home/pi/.node-red/settings.js
10 May 13:24:44 - [info] Context store : 'default' [module=memory]
10 May 13:24:44 - [info] User directory : /home/pi/.node-red
10 May 13:24:44 - [warn] Projects disabled : editorTheme.projects.enabled=false
10 May 13:24:44 - [info] Flows file : /home/pi/.node-red/flows_raspberrypi.json
10 May 13:24:44 - [info] Server now running at http://127.0.0.1:1880/
10 May 13:24:44 - [warn]

Here is the error message I get when I use UART /dev/ttyAMA0:

(node:21124) UnhandledPromiseRejectionWarning: Error: Port is not open
at unixWrite (/home/pi/.node-red/node_modules/@serialport/bindings/lib/unix-write.js:25:15)
(node:21124) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)

If I try the same with the USB port it works fine.

the built in port needs to be enabled outside of Node-RED. eg

1 Like

I have tried all the things in the article but no luck the error is not shown but even does not read the data.
10 May 16:22:59 - [info] Stopping flows
10 May 16:22:59 - [info] Stopped flows
10 May 16:22:59 - [info] Starting flows
10 May 16:22:59 - [info] Started flows

Have tried using the standard node-red-node-serialport node to read the data.
I made the changes similar to what the link above describes, and have been reliably receiving data ok at a baud rate of 38400.

Paul in my case i am reading modbus Rs485 data by using node-red-contrib-modbus

Do you have a 485 converter connected to the UART? Or are you using a usb to RS485? Or something else?

Yes I am using RS485 hat on pi.

Before i was using same unit to convert Modbus RTU(RS485) to Modbus TCP/IP with python code.

With that it was working good.

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