Discussion

Left ArrowBack to discussions page
Robotiq_CustomerRobotiq_Customer Posts: 123 Apprentice
Hi,

I want to communicate in Modbus RTU with the Robotiq FT300, but I can't.
I am using a RS232 to RS485 adapter as I know your sensor communicates in RS485.

Any ideas why it doesn't work?

Thanks
Tagged:

Best Answer

Comments

  • Robotiq_CustomerRobotiq_Customer Posts: 123 Apprentice
    Well thanks!

    This was the problem... My converter wasn't setup properly.

    Thanks for your support!
  • jainaayush2006jainaayush2006 Posts: 1 Recruit
    Hey there,

    I'm also trying to do the same thing, trying to communicate with FT300 with Arduino using RS485 to RS232 adapter and then using RS232 to TTL converter. I not good at coding, so please can someone help me with the code to read the values on Arduino.
  • bcastetsbcastets Posts: 21Vacuum Beta tester Handy
    Hello Aayush Jain,

    The following arduino library looks like a reference for Modbus communication:
    https://github.com/4-20ma/ModbusMaster

    I found some interesting video about how to communicate in Modbus RTU with ardiuno. I recommand you check that:
    https://www.youtube.com/watch?v=HPZrGuBtk_c
    https://www.youtube.com/watch?v=tBw15SfmuwI

    I did not tested but based on those videos, I would make a program like the following to display force and torque on Ardiuno console on PC side:

    #include <ModbusMaster.h>

    #define MAX485_DE 3
    #define MAX485_RE_NEG 2

    ModbusMaster node;

    void preTransmission()
    {

    digitalWrite(MAX485_RE_NEG,1);

    digitalWrite(MAX485_DE,1);

    }

    void postTransmission()
    {

    digitalWrite(MAX485_RE_NEG,0);

    digitalWrite(MAX485_DE,0);

    }

    void setup()
    {

    pinMode(MAX485_RE_NEG, OUTPUT);

    pinMode(MAX485_DE,OUTPUT);

    //Init in receive mode

    digitalWrite(MAX485_RE_NEG,0);

    digitalWrite(MAX485_DE,0);


    //Modbus communication runs at 19200 baud (according to FT300 manual 4.4.1 ModbusRTU)

    Serial.begin(19200);


    //Modbus slave ID 9 (according to FT300 manual 4.4.1 ModbusRTU)

    node.begin(9,Serial);

    //Callbacks allow us to configure the RS485 transceiver correctly

    node.preTransmission(preTransmission);

    node.postTransmission(postTransmission);

    }

    void loop()
    {

    uint8_t resutlMain;

    //Read registers where is written force and torque value (according to FT300 manual 4.4.1 ModbusRTU)

    //Register : Description

    //180: Fx

    //181: Fy

    //182: Fz

    //183: Mx

    //184: My

    //185: Mz


    //Read 6 registers starting from address 180

    resultMain=node.readInputRegisters(180,6);

    if (resultMain == node.ku8MBSuccess)

    {

    Serial.println("----------------");

    Serial.println("Fx: ");

    Serial.println(node.getResponseBuffe(0x00 / 100.0f);

    Serial.println("Fy: ");

    Serial.println(node.getResponseBuffe(0x01 / 100.0f);

    Serial.println("Fz: ");

    Serial.println(node.getResponseBuffe(0x02 / 100.0f);

    Serial.println("Mx: ");

    Serial.println(node.getResponseBuffe(0x03 / 100.0f);

    Serial.println("My: ");

    Serial.println(node.getResponseBuffe(0x04 / 100.0f);

    Serial.println("Mz: ");

    Serial.println(node.getResponseBuffe(0x05 / 100.0f);

    }

    }

Sign In or Register to comment.
Left ArrowBack to discussions page