Node-red-contrib-modbus with RTU 485 device over PI 485 shield

I installed a Seeed RS-485 Shield for Raspberry Pi on a new raspberry Pi4, ran sudo raspi-config, selected “3” interface options, selected P6 serial port, disabled shell, enabled serial port hardware.
I goto into node-red on the pi and am using the node-red-contrib-modbus “modbus read node” and it now finds dev/ttyS0 which I believe is the 485 shield.
The debug msg below shows my errors.

I know my slave settings (baud, data bit, stop bit, parity) are good as I have another modbus master which which works fine with this slave.

Debug msg.
12/18/2020, 4:18:16 PMnode: 88a2045f.091c28
polling : msg : Object
topic: "polling"
from: ""
payload: ""
queueLengthByUnitId: object
unitId: 1
queueLength: 0
queueUnitId: 1
unitId: 1
error: object
name: "TransactionTimedOutError"
message: "Timed out"
errno: "ETIMEDOUT"
nodeStatus: "timeout"
_msgid: "626fb5ee.5115ac"

any helpful ideas? I'd love to make this work & I'm really stumped here.

thank you in advance.

this test does nothing.

[{"id":"d32d366e.2f8c88","type":"serial in","z":"d7b3fdd7.b470a","name":"","serial":"28624537.d44aca","x":250,"y":280,"wires":[["492b1c0d.d20e24"]]},{"id":"9c8b9130.8e265","type":"serial out","z":"d7b3fdd7.b470a","name":"","serial":"28624537.d44aca","x":510,"y":420,"wires":[]},{"id":"492b1c0d.d20e24","type":"debug","z":"d7b3fdd7.b470a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","x":490,"y":280,"wires":[]},{"id":"214e3fea.bc61e","type":"inject","z":"d7b3fdd7.b470a","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"Hello World","payloadType":"str","x":240,"y":420,"wires":[["9c8b9130.8e265"]]},{"id":"28624537.d44aca","type":"serial-port","serialport":"/dev/ttyS0","serialbaud":"115200","databits":"8","parity":"none","stopbits":"1","waitfor":"","newline":"0x0d","bin":"false","out":"char","addchar":"","responsetimeout":"10000"}]

this is my modbus code, gives error


This is another modbus master (hardware and software) configured and tested on the same ModBus slave tied to tied Pi w NodeRed. Obviously not at the same time. It works fine, I'm sharing it to show a successful configuration.

I would have thought that an add-on shield would not have the designation of ttyS0 - would have thought it would be higher up.

Have you checked the permissions on that object - ensured that your user that is starting up NR on the PI has rights to the correct tty object ?


I have a Pi with a RS485 shield that works, If I am correct this article was helpful

Thank you mtoko, the link you provided took me in directions I would have never though of.
Here is what I did:

this was already in /boot/config.txt

but I added both:

now here is what I extracted from $ ls -l /dev
lrwxrwxrwx 1 root root 7 Dec 19 21:44 serial0 -> ttyAMA0
lrwxrwxrwx 1 root root 5 Dec 19 21:44 serial1 -> ttyS0

even thought I had disabled getty through raspi-config, I ran:
sudo systemctl stop serial-getty@ttyAMA0.service
sudo systemctl disable serial-getty@ttyAMA0.servic
sudo systemctl stop serial-getty@ttyS0.service
sudo systemctl disable serial-getty@ttyS0.service

On the 485 shield doc it mentions that gpio 18 is an enable so I added to the flow a rpi gpio out set to PIN 12. now when nodeRed polls my modbus slave I get a com light flash. Maybe this is progress?

unfortunately I getting this on every poll:

12/20/2020, 6:51:36 AMnode: e2df6ea2.8bc99msg : TransactionTimedOutError


"TransactionTimedOutError: Timed out"

12/20/2020, 6:51:46 AMnode: e2df6ea2.8bc99msg : string[60]

"Modbus Failure On State sending Get More About It By Logging"

My current flow is below.

[{"id":"339d575c.8c9728","type":"rpi-gpio out","z":"ce39ceab.35ce","name":"","pin":"12","set":true,"level":"1","freq":"","out":"out","x":650,"y":280,"wires":[]}]

I'm sure this can be made to work, as you mentioned your able to do it. I'm missing something here, it's frustrating but I'm motivated to get this up and running. Any other advise would be highly appreciated.

"TransactionTimeout" I get but I don't know what "Modbus Failure on State sending" is telling me.
I'm a little new to this, but I've made it my mission to get educated. Thanks to folks like yourself, I'm usually able to get over the roadblocks.

I used one of these instead;
worked perfectly!


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