# Establish rs485 connection with Tool

**URL:** <https://forum.universal-robots.com/t/establish-rs485-connection-with-tool/14821>\
**Category:** Robot Communication\
**Created:** [June 10, 2021, 8:31am UTC](https://forum.universal-robots.com/t/establish-rs485-connection-with-tool/14821 "2021-06-10T08:31:32Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![aswathamang](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@aswathamang](https://forum.universal-robots.com/u/aswathamang)\
**Post date:** [June 10, 2021, 8:31am UTC](https://forum.universal-robots.com/t/establish-rs485-connection-with-tool/14821/1 "2021-06-10T08:31:32Z")

</div>

Hai,

I am using a UR5e robot and i am trying to communicate with my Custom end-effector tool using rs485. As far as i have tried i am not able to find a way to access(send, receive data) that rs485 pin. Can anyone suggest a way to send commands to a robot end-effector via the rs485. Any help from your side would be of great help.

Thanks in advance,

---

<div class="post-metadata">

**Author:** ![sya](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/sya/32/216_2.png) [@sya](https://forum.universal-robots.com/u/sya)\
**Post date:** [June 10, 2021, 4:25pm UTC](https://forum.universal-robots.com/t/establish-rs485-connection-with-tool/14821/2 "2021-06-10T16:25:10Z")

</div>

Hi,

Suggest you read this thread and may give you some idea.

> [@RS485 tool communication on e-series](https://forum.universal-robots.com/t/rs485-tool-communication-on-e-series/2713):
>
> Anyone have an example of how to setup/read/write to the tool communications port in a URCap on e-series robot? The “set\_tool\_communication” from the script manual seems strait forward. however, What are the commands to read and write to it?

---

<div class="post-metadata">

**Author:** ![aswathamang](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@aswathamang](https://forum.universal-robots.com/u/aswathamang)\
**Post date:** [June 10, 2021, 5:54pm UTC](https://forum.universal-robots.com/t/establish-rs485-connection-with-tool/14821/3 "2021-06-10T17:54:46Z")

</div>

Thank you so much for your response @sya . It looks like URCap is the only way to read and write from rs485 tool communication.

---

<div class="post-metadata">

**Author:** ![sya](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/sya/32/216_2.png) [@sya](https://forum.universal-robots.com/u/sya)\
**Post date:** [June 11, 2021, 1:56am UTC](https://forum.universal-robots.com/t/establish-rs485-connection-with-tool/14821/4 "2021-06-11T01:56:42Z")

</div>

Hi @aswanthamang,

It is not necessary to be the form of URCap but it cannot be achieved by Polyscope or ur script directly indeed so far.

Thanks

---

<div class="post-metadata">

**Author:** ![aswathamang](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@aswathamang](https://forum.universal-robots.com/u/aswathamang)\
**Post date:** [June 11, 2021, 5:59am UTC](https://forum.universal-robots.com/t/establish-rs485-connection-with-tool/14821/5 "2021-06-11T05:59:42Z")

</div>

@sya  
Thank you so much for your response. I will try with the daemon first.  
Have a good day

---

<div class="post-metadata">

**Author:** ![aswathamang](https://avatars.discourse-cdn.com/v4/letter/a/b5a626/32.png) [@aswathamang](https://forum.universal-robots.com/u/aswathamang)\
**Post date:** [June 20, 2021, 12:42pm UTC](https://forum.universal-robots.com/t/establish-rs485-connection-with-tool/14821/6 "2021-06-20T12:42:05Z")

</div>

I found an easy way to communicate with the rs485 port. And i have documented that elaborately below so that it might be easy for beginners to easily integrate their custom end-effectors in UR robots :-

Download the rs485.urcap file attached here rs485-1.0.urcap  
[rs485-1.0.urcap](https://forum.universal-robots.com/uploads/short-url/xvIQHEWx09sFhYL3L0PEM3Scx0i.urcap) (138.7 KB)

Transfer the URCaps file to the Robot controller with the help of this reference:-

> <https://github.com/UniversalRobots/Universal_Robots_ROS_Driver/blob/master/ur_robot_driver/doc/install_urcap_e_series.md>

Once if the urcap file is loaded successfully you will be able see the output in the teach pendant saying that “RS-485 daemaon runs”

 ![rs485_TP_output](https://us1.discourse-cdn.com/flex020/uploads/universal_robots/original/2X/a/aaec158cf460c3a799651dc344d7ba770cc63896.jpeg)

Once if that is achieved, Copy paste the following code in jupyter notebook or any other python programming interface to send and receive the data in TCI from remote port.

```auto
import socket
host = 'robot_ip'
port = 54321 # Remains the same, because it is specified as default port in URCaps code
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.sendall(b'Hello rs485 port from ash')
data = s.recv(1024)
s.close()
print('Received', repr(data))

```

**References**

1. [https://www.tutorialspoint.com/python/python\_networking.html](https://www.tutorialspoint.com/python/python_networking.html) → helped in socket python code  
**2) [https://www.geeksforgeeks.org/socket-programming-python/](https://www.geeksforgeeks.org/socket-programming-python/)** → helped in socket python code
2. [GitHub - UniversalRobots/Universal\_Robots\_ToolComm\_Forwarder\_URCap: Utility to forward the UR Tool Communication Interface (RS-485) to a remote PC.](https://github.com/UniversalRobots/Universal_Robots_ToolComm_Forwarder_URCap) → the urcap package that we used
3. [GitHub - BomMadsen/URCap-ToolCommunicationInterface: URCap sample that demonstrates assuming control and using the RS485 TCI interface on e-Series robots.](https://github.com/BomMadsen/URCap-ToolCommunicationInterface) → gives a code level understanding of the URCap daemon (XmlRpc, /dev/ttyTool etc)

I Hope it helped!!!

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.universal-robots.com/system/32/1_2.png) [@system](https://forum.universal-robots.com/u/system)\
**Post date:** [June 22, 2021, 12:42pm UTC](https://forum.universal-robots.com/t/establish-rs485-connection-with-tool/14821/7 "2021-06-22T12:42:59Z")

</div>

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.
