Articles Download Safety & Security Forum myUR Go to Main Site

Universal Robots A/S
Energivej 51
DK-5260 Odense S

T: +45 8993 8989
sales@universal-robots.com

 
  • Articles
  • Download
  • Safety & Security
  • Forum
  • myUR
  • Go to Main Site
  • Support
  • Articles
  • Conveyor tracking: using encoder that outputs a Modbus register

Conveyor tracking: using encoder that outputs a Modbus register

Track linear conveyor using encoder that outputs a Modbus register

Last modified on Apr 11, 2024

Track linear conveyor using encoder that outputs a Modbus register

Step-by-step guide of how to setup conveyor tracking and pick part from conveyor

The conveyor tracking functionality adjusts robots paths to the motion of a conveyor.
Conveyor tracking for linear and circular conveyors is available from software version 1.8.

This example is based on setup on a CB2 controller but can also be used on CB3 and e-Series.

Conveyor Setup


 

Initial setup:

  • Determine the desired conveyor tracking type

In this sample the robot will await a trigger signal (photo sensor).

When trigger is activated, the robot will move along a linear conveyor with same speed and pickup an object.

Conclusion: conveyor tracking type will be linear tracking.

  • Specify encoder type

Selected encoder type is a single-turn absolute encoder from AMCI.

Product type is AMCI NR25F-B2E11AE04, which supports Modbus TCP.

Resolution is 16 bit, ie. 65535 pulses per revolution.

Datasheet for encoder: nr25-ethernet-rotary-encoder.pdf

  • Hardware interface

Next is to specify the interface to the hardware that is used in the application. One digital input is needed for the photo sensor. Two digital outputs are needed for respectively start/stop the conveyor and open/close the gripper.

Description Signal
Trigger DI[0]
Conveyor START/STOP DO[0]
Gripper ON/OFF DO[8]

Encoder will be supplied by internal 24V power supply from control box. Feedback from encoder will be a Modbus TCP register, which requires an ethernet cable between encoder and controlbox.

Schematic drawing:

 

Schematic Drawing Amci

 

  • Modbus TCP Setup

First the Modbus communication to the encoder must be setup.

The following addresses has been selected for this application:
Description IP Subnet
Control box 172.16.17.10 255.255.255.0
Encoder 172.16.17.50 255.255.255.0

IP-address of encoder is setup using AMCI's Net Configurator. The software can be downloaded from AMCI's website
NOTE: Universal Robots is only providing a download link to vendor. Link can be changed without prior notice by vendor. Consult documentation of encoder in order to use the software.

IMPORTANT: Under Device Setup, set communication protocol as Modbus TCP.

Amci Net Configurator

Next is to setup IP-address of control box. Go to SETUP ROBOT\SETUP NETWORK and enter the following information:

 Setup Network
Save settings by pressing APPLY SETTINGS


Finally setup IP-address of encoder. The encoder datasheet contains information about the register available and their addresses.
On page 72 in datasheet for encoder, there it can be found that register with address 0 contains the 16 bit position value.
Go to INSTALLATION\MODBUS CLIENT and add a Modbus server, by pressing the + button and add a register input with address 0:

 Installation Modbus Setup
Confirm that the round dot left of the register turns green, then communication is ok.

The programming:

First we will need a thread to read the encoder position.
On previous page, it is described how to save the encoder reading from a variable and use this variable to define the conveyor tick count:

Set Conveyor Tick Count

As the encoder in this application is single-turn, it is required to make some program logic in order not to reset the conveyor tick count everytime the encoder has turned one full revolution:

Encoder reading will be saved in a variable named enc-count, and value will be between 0 and 65535 (16 bit).
enc-count and actual register value are continuously compared.
If the register is reset at some point, then an offset of 65535+1 (16 bit + 1) is added to a variable offset named enc-offset.
The combined value of enc_offset and enc_count is incremented and used for setting the conveyor tick count with the script code set_conveyor_tick_count().

Set Conveyor Tick Count Full Thread

Next the direction of the conveyor must be determined.

Cnv Trk 2

Direction will be determined with a pose variable p[x,y,z,rx,ry,rz], where the direction can be scaled accordingly.

In this case the direction will be parallel to the X-axis of the robots Base frame, so the variable should look like this:
direction = p[1,0,0,0,0,0,0]
If direction is parallel to Y of Base-frame, it should instead be like:
direction = p[0,1,0,0,0,0]
If direction is angled 45 degrees offset to of Base-frame, it should be like:
direction = p[1,1,0,0,0,0]

So by scaling X, Y and Z value of the pose variable you can specify the direction of conveyor relative to the Base-frame of robot.
Another option to specify the direction of the conveyor is to teach two waypoints along the conveyor and use the script code pose_sub() for automatically calculate the direction.

This is a very easy and user-friendly way to do it:
direction = pose_sub(Waypoint_1,Waypoint_2)
  • Encoder pulses

Finally the amount of encoder pulses must be defined as ticks per meter.
We will use an integer variable for that purpose.

How to calculate ticks per meter:
tpm = rpm * ppr * no_of_channels

Where rpm = rotations of encoder disk per meter and ppr = pulses per revolution
On the encoder used there is mounted a disc with a radius of 77 mm.

This gives the following tpm:
tpm = (1000/(2*phi*77)) * 65535 = 135457

Then we can use the two values for starting the conveyor tracking using the script code track_conveyor_linear(direction, ticks_per_meter):

Track Conveyor Linear

The script code will be inserted after the robot has detected the part with the trigger signal

A little delay is also inserted in order to syncronize the start of the robot with the position of the object (or the trigger sensor can be physically adjusted if preferred)

WAIT

trigger WAIT 0.15

track_conveyor_linear(direction, tpm)


Robot will then follow the speed of conveyor until conveyor tracking is stopped using the script code stop_conveyor_tracking()

Stop Conveyor Tracking

In order for the robot to pickup the object, it is required to insert two positions in the program, a WAIT position and a PICK position.

These positions can be recorded vertically in the same position with only difference the Z-height:

Cnv Trk 3

When program is running and conveyor tracking activated in the program, you will see that the robot follows the conveyor speed while picking up the object:

Cnv Trk 4

NOTE: direction and tpm will most likely have to be adjusted/optimized in order to obtain the correct speed and to ensure that robot moves parallel with conveyor.


This is how the final sample program looks:

Track Conveyor Linear Modbus Register

 

Download sample program at the buttom of the page. File name is track_conveyor_linear_modbus_register.zip
Important: It is required to download and load this installation file as it contains the Modbus setup

We have also attached a small video example. File name is Conveyor_tracking.mp4

Attached files


Conveyor_tracking.mp4
track_conveyor_linear_modbus_register.zip

Attached files

Conveyor_tracking.mp4
track_conveyor_linear_modbus_register.zip

Related articles

Conveyor tracking: using encoder with digital pulses
Conveyor tracking: FIFO queue
LEGACY Conveyor tracking guide (CB3 ≤ 3.8 and e-Series ≤ 5.2)
logo

Product

  • UR3e Robot
  • UR5e Robot
  • UR10e Robot
  • UR16e Robot
  • UR20 Robot
  • UR+ Products

Company

  • About us
  • Contact us
  • Careers We're hiring
  • UR merchandise

Training / Resources

  • Academy
  • Technical Resources
  • Articles
  • FAQ

Insights

  • Blog
  • Case stories
  • Content library
  • News centre
  • Podcast
  • Webinars & Events

Get in touch

  • Ask an Expert
  • Schedule a no-cost assessment
  • Find a distributor
  • Customer support

Connect with us

  • LinkedIn
  • Facebook
  • Twitter
  • YouTube
  • Instagram
  • Universal Robots A/S
  • Energivej 51
  • DK-5260 Odense S
  • T: +45 89 93 89 89
  • sales@universal-robots.com
  • US Corporate Office
  • 27-43 Wormwood St.
  • 02210 Boston, MA.
  • +1-844-GO-COBOT
  • ur.na@universal-robots.com
  • Copyright @ Universal Robots 2025
  • Cookie policy
  • Privacy policy
  • Universal Robots A/S
  • Energivej 51
  • DK-5260 Odense S
  • T: +45 89 93 89 89
  • sales@universal-robots.com
  • US Corporate Office
  • 27-43 Wormwood St.
  • 02210 Boston, MA.
  • +1-844-GO-COBOT
  • ur.na@universal-robots.com

Copyright © Universal Robots 2025

Cookie policy
Privacy policy