DoF - a Robotiq Community
Warning sign
The Dof Community was shut down in June 2023. This is a read-only archive.
If you have questions about Robotiq products please reach our support team.
bcastets

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);

}

}

syed

bcastets said:
We provide on our support page a C package to communication with the ft300. It would be a good material to start.

https://assets.robotiq.com/website-assets/support_documents/document/FT-300_dev_package_SDP-1.0.1_20180328.rar

You can find more details about modbus communication in ft300 manual.
I checked all the details in manual and used the code you provided for Arduino , the code works by making a few minor changes. However, register [resultMain=node.readInputRegisters(180,6)] 01, 03, and 04 are giving values 655 , 65 and 65, the rest seems fine.

Can you kindly guide over this?


regards
syed