Connecting XArm 6 to Node Red

Hello,

I have a inquiry regarding the robot. I want to connect the XArm 6 robot to Node red using TCP/IP but first i am required to obtain the IP from the robot. Can i use the IP of the control box, and as for the PORT number is there way to declare it inside of the blockly programming?

Can I also send the data using the IP to the nodered by adding my own code inside the XArm IDE using python?

I used the robot IP which marked on the robot control box 192.168.1.xxx, and set port as 502, seems good.

“Can I also send the data using the IP to the nodered by adding my own code inside the XArm IDE using python?”
Not quite sure, but I recommend you give a try.

1 Like

Hello, i tried running a python code to connect with the XArm but when running it kept saying “No connection could be made because the target machine actively refused it” . In the code i used TCP_IP of the control box (in the picture i blanked out the last digits), port number i used any available port number, and used a buffer size of 10. Do you know ways i could go around this?

here is an example about how to get the repot data of the robot:

30002 is a dedicate port for report, and 502 is the dedicate port of conrol
for more details about the communication protocol, please check the manual

HI Daniel,

I would like to know how do I send a simple request to the xArm 6 with Node-Red? As this is the function code that I want to send to the xArm itself

// Convert payload string to buffer
msg.payload = Buffer.from([0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x29]);
return msg;

Below is the whole flow and the node-red modbus configuration
image

[
    {
        "id": "9d917b22f0302b26",
        "type": "inject",
        "z": "da1d1d735d73916f",
        "name": "reset print",
        "props": [
            {
                "p": "topic",
                "vt": "str"
            },
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "00 01 00 00 00 09 01 10 00 30 00 01 02 00 05",
        "payloadType": "str",
        "x": 560,
        "y": 80,
        "wires": [
            [
                "5beb62d04db97127"
            ]
        ]
    },
    {
        "id": "5beb62d04db97127",
        "type": "function",
        "z": "da1d1d735d73916f",
        "name": "function 3",
        "func": "// Convert payload string to buffer\nmsg.payload = Buffer.from([0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x29]);\nreturn msg;\n",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 700,
        "y": 80,
        "wires": [
            [
                "cfbbd6d03a47c642"
            ]
        ]
    },
    {
        "id": "cfbbd6d03a47c642",
        "type": "modbustcp-write",
        "z": "da1d1d735d73916f",
        "name": "",
        "topic": "",
        "dataType": "HoldingRegisters",
        "adr": "1",
        "server": "54b193381bed3aa4",
        "x": 850,
        "y": 80,
        "wires": []
    },
    {
        "id": "54b193381bed3aa4",
        "type": "modbustcp-server",
        "name": "",
        "host": "192.168.5.201",
        "port": "502",
        "unit_id": "1",
        "reconnecttimeout": "1"
    }
]

Hope to hear from you soon!

Hi bobtb,

As you mentioned you are using standard Modbus TCP to communicate with our robot and want to start the Blockly project.

Please follow the below link and try to start 1 Blockly program via TCP tool first, let me know if any problems.
xArm: start blockly program via Modbus TCP - #2 by Minna

Best regards,
Minna

Based on the link, you wrote a code to execute both 0001 and 0012, I would like to know how did you manage to execute both of it?

  1. Create two Blockly examples named 00001 and 00012.
  2. Send ‘00 01 00 00 00 0B 01 10 00 30 00 02 04 00 01 00 0C’ to trigger 00001 and 00012.

I can’t seem to find 00012 in the above code.

Best regards,
Bob

Hi Bob,

Command: 00 01 00 00 00 0B 01 10 00 30 00 02 04 00 01 00 0C
00 01 00 00: fixed
00 0B: data length
01: ID, fixed
10: function code
00 30:register address
00 02: write 2 registers, trigger 2 Blockly code
04: data length
00 01: Blockly name(00001)
00 0C: Blockly name(00012)

Best regards,

HI Minna, if I have 3 different blocky and I want to execute them this way, is it correct?

Blocky Name 00003 (Execute 2nd)
Blocky Name 00005 (Execute 3rd)
Blocky Name 00007 (Execute 1st)

Command: 00 01 00 00 00 0B 01 10 00 30 00 02 04 00 07 00 03 00 05

00 01 00 00: fixed
00 0B: data length
01: ID, fixed
10: function code
00 30:register address
00 03: write 3 registers, trigger 3 Blockly code
04: data length
00 07: Blockly name(00007)
00 03: Blockly name(00003)
00 05: Blockly name(00005)

I’m looking forward to your reply.

Best Regards,
Bob

Hi Bob,

Trigger 3 Blockly project:
00 01 00 00 00 0D 01 10 00 30 00 03 06 00 07 00 03 00 05

0D: data length is 13
06: data length is6