Node-RED modbus and optidrive E3 frequency drive

Hi all,

I’m stuck…

I used to operate an “invertek optidrive E3” with an arduino and an RS485 module.

the aduino was sending this command ( and some other )
start[] = {0x01,0x06, 0x00, 0x00, 0x00, 0x01, 0x48, 0x0A}

The invertek uses the following modbus telegram structure
06 Write single holding register
Master telegram

  • Slave address 1 byte = 01
  • Function code 1 byte = 06
  • Register address = 2 byte = 00 00
  • Value = 2 byte = 00 01 ( 00 00 to stop )
  • CRC = 2 bytes = XX XX

all the serial devices use

  • 9600, 8,N,1

now I want to do this with HA and node-Red.

The setup is as folows

Home Assistant on Raspberry Pi 4

URS TCP232-304 : RS485 to ethernet ( ip 192.168.0.7:502 ) → connceted to RS485 to USB to a serial port monitor-> connected to optidrive - 120Ohm terminal

but looking at the serail monitor it gives the follwing ( looks like the register is shifted and cheksum is gone??? ) :

00 01 00 00 00 06 01 06 00 00 00 01 the bold part is the same…

can someone give me advise?
Tnx Tom

I’ve tried it with this flow :

[{"id":"5b0dada6.2ecd9c","type":"tab","label":"Modbus Switch TCP","disabled":false,"info":""},{"id":"5f76b6c73ea57cf5","type":"modbus-flex-write","z":"5b0dada6.2ecd9c","name":"","showStatusActivities":false,"showErrors":false,"showWarnings":true,"server":"a477577e.9e0bc","emptyMsgOnFail":false,"keepMsgProperties":false,"delayOnStart":false,"startDelayTime":"","x":690,"y":360,"wires":[["ba7f78a1eddedc59"],["d0a3cd468e858854"]]},{"id":"e291aac585e61c6c","type":"function","z":"5b0dada6.2ecd9c","name":"function 1","func":"var fc = 6;\nvar sa = 0;\nvar addresses = 1;\nvar value = 1;\nmsg.slave_ip = \"192.168.0.7\";\nmsg.payload = { \"value\": value, 'fc': fc, 'unitid': 1, 'address': sa, 'quantity': addresses };\nreturn msg;\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":460,"y":360,"wires":[["5f76b6c73ea57cf5"]]},{"id":"de246ca2ae167a29","type":"inject","z":"5b0dada6.2ecd9c","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":240,"y":360,"wires":[["e291aac585e61c6c"]]},{"id":"ba7f78a1eddedc59","type":"debug","z":"5b0dada6.2ecd9c","name":"debug 3","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1160,"y":360,"wires":[]},{"id":"d0a3cd468e858854","type":"debug","z":"5b0dada6.2ecd9c","name":"debug 4","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1160,"y":420,"wires":[]},{"id":"a477577e.9e0bc","type":"modbus-client","name":"Modbus Switch TCP","clienttype":"tcp","bufferCommands":true,"stateLogEnabled":false,"queueLogEnabled":false,"failureLogEnabled":false,"tcpHost":"192.168.0.7","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB","serialType":"RTU-BUFFERD","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"none","serialConnectionDelay":"100","serialAsciiResponseStartDelimiter":"","unit_id":"1","commandDelay":"1","clientTimeout":"1000","reconnectOnTimeout":true,"reconnectTimeout":"2000","parallelUnitIdsAllowed":true}]

Having had a related conversation last year with someone else struggling with Modbus between HA (Node-RED) and inverters, I believe that your problem is that you are unfortunately using the wrong adaptor model.

I have the USR-TCP232-410S which works just perfectly with Node-RED Modbus and RS485 serial (to an inverter).
This model has the set up to manage Modbus TCP correctly.

I believe that your model, the 304, does not manage Modbus TCP, but only Modbus over TCP.

The HA-Node-RED Modbus TCP bit sends Modbus commands using Modbus TCP, where the checksum is not required and the unit ID is nominal (as communication is routed via ethernet to a specific ip address). This is a specific variant of Modbus, and the 410 unit can recognise this and turn it from (Modbus TCP) ethernet to (Modbus RTU) serial, removing the TCP specific header and adding back the necessary checksum back in by itself.

Modbus over TCP is just a way of moving between ethernet and serial, and this does take TCP packets and turn them into serial, but it does not do the necessary conversion of the Modbus package. Unfortunately, as I understand the situation, that means that you have to do the work yourself, ie the TPC package bit has to have the Modbus package looking like a serial command in full.

The 304 unit does mention Modbus in relation to heartbeat management, but unlike my 410 I understand that it does not have the ‘Modbus TCP’ option for the ‘TCP server’ work mode.

I would like to say that I am entirely wrong here but I think you cannot make this setup work. What you are probably seeing using your Modbus serial sniffer is the TPC specific header (6 bytes) that should be removed when moving from TCP to RTU, and a failure to add back the necessary checksum.

I can confirm, if it is of any comfort, that the 410S model does work and very nicely too.

Edit: I have only used TCP type ‘default’ in the Node-RED Modbus nodes, as this works for me. I wonder if ‘RTU-buffered’ might be the answer? What you require is Node-RED Modbus node to send the RTU-based package over TCP.

Geoff,

RTU

No difference between default en RTU-bufferd :thinking:

looks like i need to order the 410S

tnx

Geoff,

problem solved, you were right.
Used a waveshare Ethernet to Rs485 converter and this one has the option Modbus RTU <-> ModbusRS485.

tnx

Hello,
I have the same pump and i’m interested on this.
May i ask you to share your project? how you handle the connection and which kind of data are you reading?