Raspberry PI connect to RS485

I have a lot of experience with using the FTDI rs485 cables to talk to yaskawa ac drives. I like the node-red-contrib-modbus package myself. It's very simple and has a lot of tweakables.

In your case, it looks like you should have everything you need in your python file to make this work. The biggest thing that messes people up with serial connections is the wiring. Does this controller have separate rs232 and rs485 ports? Most don't. On yaskawa drives, one must jumper the S+ to R+ and S- to R- for rs485, since it uses a differential signal. Also, don't forget the commond wire, which should bond both the Pi and the controller to the same ground potential.

I used the Modbus scanner on a windows computer to get all the communications settings correct (9600, N81) and to ensure that communications with the controller were working including the USB to RS485 converter and confirming modbus registers. With all this working and confirmed it was only necessary to work with Node Red configuration knowing that all else was working

Thank you @gemini86 for your response. I think the wiring is correct now because the python can actually run the fans.
I think the problem now is just trying to get that python file to work in Nodered.
I'm trying to read the status of a working fan (i turned it on physically so it's spinning), but have an error of reading ('sequential dequeue command not possible') as shown in the picture:

This is my setting of the Modbus Read node from node-red-contrib-modbus"

can anyone please help?

What do you have in the 'optionals' tab?

link a Modbus response node to the bottom output and set quantity to less than 100 (it is requesting 100 registers)

The datasheet of your controller shows that the status word is at 1001H (hex), so in the modbus node, that would be 4097 decimal. It also shows the status being 5 words in length. I do not know what the data formatting is, if they're using ieee 754 floating point data words, integers divided by some factor to represent floats, individual bit flags, etc. That's going to be deeper in the drive's actual modbus spec.

optional tab just to show errors and activities. I think for debugging

it does not work, show me the same error. Should i write some command into the register before reading?

Hey Bond, this could likely be a simple issue, but we need the device manual (the full manual) to be able to help out. What did you change the modbus read node to now?

Hi @gemini86, I only changed the quantity to 10 from my previous post.
This is the full manual: Manual

Try reading (function 3) word address 3000, quantity 3.

how did you work out the quantity to be 3?

From the manual you linked. Can't cite the PDF right now, I'm on mobile. Any luck?

i'm writing some command to read the controller status. But it give me some kind of none sense output.

Fan1 is ON
Fan 8 is OFF
But the two output are pretty similar.

So here I'm confused by the registers you're reading and writing to. The manual shows the command registers, and the status registers as:

Also, may I get more info on the equipment? Are these fan controllers separate drives? or are these fans all on one controller? The manual you sent is an AC inverter, which would only control one load at a a time.

I have 8 controllers controlling 8 fans. The address are from 1 to 8.
I turned on fan 1 and fan 2 manually.
I am trying to ready their frequencies now. Then i will set different frequencies for different controllers.

How are the controllers wired to the pi? Daisy chain on a single rs486 bus? "Address" refers to the register address you're trying to write, not the controller device ID. "Unit-id" if you're using node-red-contrib-modbus. So, you need to create 8 "server" configurations, one for each fan, then poll the same address on each fan, but select the needed "server".

Hopefully this makes sense.

1 Like

Each controller has A, B and Ground terminals connected to USB to Serial converter as my first post in this topic. Then the USB plugged into the PI.
The server in the Write node, i have set that to serial input as:
And this is my string as input to the write node to read frequency (According to the manual):

Should i exclude the address from the string?

So you have 8 of these converters? If so, each of these addresses should be identical to access the same function (also assuming the inverters are identical). You just point to a different usb device for each. If these controllers are able to be configured with different device IDs (device address), then I would just use one usb-rs485 converter to communicate to all of them. But that's me.

Anyway, you don't need to be sending any string, message or anything to read a register. Just configure what register you want to read in the address field and what modbus function you need, and it will compose the modbus message for you. As far as reading the correct register address: Note that the manual shows these addresses in HEX format. register 1001H would need to be configured in as 4097 in decimal. Also note that some modbus devices are 1 indexed, which means they don't start at 0 (like they should) and instead everything is off by 1. So, the manual may say to read register #1, but this is at memory address 0 (the first memory address) I've run into this a few times. Looking again at your python code, it looks like that may be the case. So instead of trying to read address '1001' try reading '4096'. confusing, I know.

Also, per your python code; they're using the same usb device to communicate with all 8 fans, so this would suggest a common rs485 bus with each controller using a different device-id or unit-id.

Thank you for your response, it's very helpful for me.
Now as you say i don't need to send a string of command.
And I can set the device IDs and register address in the actual Write node.
So where would i put the 'value' then?
For example, from the manual:
This is to set the controller frequency. If i want to set it to full speed (50Hz). Where should i put the value of 10000?