PLC Controlled Cartesian Robot Project

4002 views 48 Liked

Today I put at your disposal the project I've done for the end of studies in automation engineering. This post covers in detail the realization of a PLC controlled cartesian gantry robot. As you will see later, I use machine vision with a camera. However, this part is not very detailed since we have given less importance to it. The construction of the robot has required much more time than expected. You can nevertheless use it as a reference for your own projects.

Video of working robot:

1: Let's start at the beginning

Our end-of-studies project in automation engineering consisted of designing and building a cartesian gantry robot capable of assembling a simple puzzle autonomously. Here is a 3D preview of our robot and a photo of the completed project:

3D Model of the Robot

Figure 1: 3D model of the robot


Our Robot once completed

Figure 2: Our robot, once completed.

2: Main objectives to achieve

This part is composed of objectives to be achieved. We will discuss the build of the 2 axis robot in the following sections.

2.1: Make the assembly of the gantry in order to obtain precision and solidity

The assembly of the gantry had to be rigid and precise, and to have an excellent repeatability of the movements. Here are other important requirements:

  • Fluid axe movements to minimize the effort provided by the servomotors.
  • Rigidity of the axes for precise and stable movements, despite the mechanical forces involved.
  • Use servomotors with closed loop control, because they are easy to program with the PLC, they are powerful and quiet (unlike stepper motors).
  • Design simple electrical diagrams, given the large number of connections to make and it will help troubleshooting in case of problems.
  • Design and assembly of the electrical control panel. Including : Programmable logic controller (PLC), Transformers, Motor controllers (drives), Ethernet switch, Terminal blocks and circuit breakers.
  • The linear motion parts for the movement of the main axes X and Y must be of good quality. We use rails for linear movements and ball screws. These pieces help to obtain:
  • Fluid and fast movements;
  • Less load on the servomotors;
  • Good accuracy and good repeatability;
  • A quieter robot, thanks to the servomotors;
  • A very rigid robot. The axes will not flex under the forces applied.

2.2: Get the coordinates of the parts with the camera and send them to the PLC

  • Use the shape recognition features of the camera to distinguish and identify each piece that will be placed on the table.

Communication between the Cognex camera and the Micrologix 1400 PLC:

  • The PLC model chosen has an Ethernet connection, the camera too. Communication between the two must therefore be done ideally using this connection.
  • The correct data writing and reading functions must be used in the Cognex camera program.
  • In the PLC, the data exchange is done using message blocks (MSG). There must be a message block for each data type (INT, FLOAT, STR), because a message block can handle only one data type at a time.
  • The coordinates of the pieces, X and Y as well as the orientation angle, are received by the PLC and are then recorded in memory registers for future use for the robot positioning calculation.

2.3: Program the robot to move and assemble the puzzle pieces

  • Programming the robot to obtain precise displacements in the XY plane with good repeatability. Error margin from 0 to 5mm of position and 0 to 2 degrees of orientation.
  • Calculate the dimensions of the surfaces and determine the necessary displacement so that the axes cover the whole surface but not more. The axes must not exceed their mechanical limits. There will be limit switches to stop the motors if boundaries are reached.
  • Programming to turn the robot's head (the stepper motor) to the desired angle for the orientation of the part (needs simple math calculations).
  • Know the number of pulses by rotation of the stepper motor;
  • Then calculate the number of pulses for each degree of rotation.
  • Identification of each of the parts by the camera and the PLC to then have their respective coordinates for the movement of the robot (to grab the piece and deposit it). There are calculations to be made to determine the X, Y positions and the orientation of the part.
  • The positions of the pieces for the assembly of the puzzle are already recorded in the memory registers of the PLC. Just calculate the differences between the position of the part when it is scanned and the required deposit position. It is this difference that will determine the movements that the robot will have to perform.
  • Design how the robot will grab the parts (robot head) with an electromagnet or other mean.
  • The electromagnet seems to be the simplest and least expensive solution, but the parts must be made of metal and the robot's table must not interfere with the magnetic field. It is also necessary to avoid that the parts stick together when the electromagnet is powered.
  • The option of a pneumatic sucker (vacuum) is also studied, but it requires many more parts and is more expensive. Efficiency is also questioned.
  • Add buttons for cycle stop, reset, cycle start, emergency stop and also for jogging each linear axis.
  • You must be able to put the machine in manual mode at any time to allow the axes to be moved in step-by-step mode (jog).
  • When moving an axis in manual mode ("jog"), it is necessary to avoid that the axes exceed the mechanical limits. This is why conditions are added in the programming of the PLC.
  • Also add a button to manually turn the electromagnet on or off.

3: Conceptual approach and design constraints

We started the design of our robot by searching for linear motion parts and motors offering the desired performance and respecting our budget. We then modeled the robot in 3D using Inventor. Thanks to the 3D model, we have established the dimensions of the chassis to fit the selected parts. The 3D model was also useful for drawing plans of custom made parts. The entire project could have been designed with very inexpensive and medium quality parts, while being able to partially meet the objectives. But to fully achieve the required specifications, we wanted to design a solid, precise and sustainable robot. That's why we use quality parts, obtained at an excellent price.

The choice to design a robot whose Y-axis rests at a single point on the movable part of the X-axis, unlike the usual CNC routers, was made in order to save space and reduce the number of required components. This was possible thanks to the linear guides and rails which are very rigid and which resist strong bending and torsion forces. The X axis is therefore able to effectively support the weight of the Y axis.

To obtain the linear movement of the axis, we use ball screws. Unlike lead screws that do not use balls, they are more efficient and require less motor torque. They produce less friction and can allow fast and sustained movements. We use the SFU1605 model because it offers great quality for a great price. We discuss their characteristics further in the following sections.

For the robot chassis, we used extruded aluminum profile. These profiles are very versatile and easy to assemble. No soldering is necessary. We thus obtain a robot that rests on a solid base. The aluminum profiles allow us to easily make changes to the mechanical design if necessary. This choice for the chassis has been expensive, but we are getting a professional looking result.

The heart of our robot is an Allen-Bradley Micrologix 1400 PLC. It is the central piece for all movements of the robot and it communicates with the Cognex vision system for the detection of the puzzle pieces. All robot positioning calculations will be done in this PLC. Allen-Bradley's Micrologix 1400 model was chosen because of its ease of programming, its low cost and its biggest advantage being its Ethernet connectivity. It also has three high frequency outputs to generate pulsed outputs to control servomotors and stepper motors. If needed, additional I / O cards can be added to increase the capacities of the PLC. We did not need it for this project.

For the X and Y main axes, we opted for NEMA 23 closed-loop servomotors and drive combination. The chosen model comes with a 1000 line integrated encoder. We chose these motors because they are quiet, unlike ordinary stepper motors. They were obtained at a very modest price. The closed-loop control of these servomotors provides a synchronized movement that follows a trapezoidal shape curve, which includes acceleration, constant speed plateau and deceleration. The speed and quantity of pulses produced can be configured in the PLC. To control the servomotors, we simply connect the drivers to the MicroLogix 1400's high frequency digital outputs.

To detect and identify puzzle pieces, we use a Cognex camera vision system. The model used is the IN-SIGHT 1000C. This camera has an integrated processor, which makes it a complete vision system. This is an old model and Cognex no longer provides technical support, but it was chosen because you can find used ones for cheap. Newest models of In-Sight cameras can cost thousands of dollars.

The configuration and programming of the vision system is done using the In-Sight PC Host software. The programming interface consists of a spreadsheet that looks like Excel. The software has several functions that we can use to process an image, to do object recognition and to program the system's inputs and outputs, which includes communication methods. With these functions, we can detect the positions of objects and send them on the Ethernet network to the PLC.

At the beginning of the project, we had not established a solution for the Z-axis movement. The choice to install a simple linear actuator was finally made. We already had this linear actuator in stock and it was of ideal size. Custom aluminum parts were made to attach this motor to the robot. We also remembered the idea of installing an electromagnet because of its low price, its simplicity and its efficiency for grabbing our puzzle pieces.

Throughout this text, we will give you the characteristics of the components used. We will also give an overview of our programming method for the vision system and the PLC. We will then explain the operation and functions of the robot.

4: Components of the gantry robot

4.1: Mechanical parts

Here are the main specifications for the linear guides chosen for the main axes X and Y:


Forces on Linear Block

Figure 3: Forces on the linear blocks

  • X Axis Model: Rail HGR20 and Block HGW20CC
  • Width: rail 20mm and block 44mm
  • Length of the block: 77.5mm
  • Length of the rail: 700mm
  • Y Axis Model: Rail HGR15 and block HGH15CA
  • Width: 15mm rail and 34mm block
  • Length of the block: 61.4mm
  • Length of the rail: 500mm

Buy those parts in our store

Hiwin HGW20CC

HGW20CC store link

SFU1605 Ball Screw

SFU1605 Ball screw store page

BK12 and BF12

BK12 and BF12 ball screw supports

For linear motion, we use SFU1605 ball screws. These screws have a diameter of 16mm and have a pitch of 5mm. So for every 360 degree motor rotation, the linear displacement is 5mm. The total lengths of the ball screws used for our robot are respectively 800mm and 600mm, including the end supports (BK12 and BF12) to allow to fix them to the frame and to the motors. These ball screws are connected to the motors thanks to flexible couplings specially designed for this task. Figure 4 illustrates the rails, ball screws and motor couplings used.

Custom made aluminum parts are required to assemble the robot. The 3D model of the robot allowed us to determine the exact dimensions of these parts. Some of these parts are visible in Figure 4. They allow to join the linear blocks to the ball screw nut and they are also required to attach the supports of the ball screw on the robot frame.

Linear motion parts 

Figure 4: Linear motion parts

The robot chassis is made of aluminum profile extrusions. For X and Y axes, we use 1.5 "X 4.5" profile. The rest of the chassis is made from 1.5 "X 3.0" frame. The camera stand is made of 1.5 "x 1.5" extrusions. It was necessary to drill holes in the extrusions to secure the linear rails, motor mounts, and ball screw mounts.

4.2: Electrical and control parts

In this section, we list the characteristics of the different electrical parts selected for the project. Let's start with the PLC, the brain of the robot, shown in Figure 5.

Allen-Bradley Micrologix 1400 PLC

Figure 5: MicroLogix 1400 PLC

Here is a table of the main specifications of the PLC:

  • Model: Allen-Bradley Micrologix 1400, part number : 1766-L32BXB
  • Power supply: 24 volts DC
  • Integrated I / O: 12 fast 24V DC inputs
  • 8 normal 24V DC inputs
  • 6 relay outputs
  • 3 fast DC outputs
  • 3 normal 24V DC outputs
  • Consumption: 7.5 to 53 Watts
  • Communications: 1 RJ45 port (Ethernet)
  • 1 8-pin mini DIN RS-232C / RS-485 port
  • 1 9-pin D-Shell RS-232C port
  • Dimensions and weight: 90 x 180 x 87 mm, 0.9 kg

The main characteristics of the servomotors and drivers shown in Figure 6 are as follows. Figure 7 illustrates the circuit diagram for connecting the PLC, the motor driver and the servomotor all together. 2k ohm resistors are required to reduce the voltage from 24V to approximately 4V. We discuss the programming required later in this text.


Servomotor and driver

Figure 6: Servomotor and drive

  • Motor Model: Easy Servo Motor 573HBM20-1000
  • Motor drive model: Leadshine HBS507
  • Power supply: 48 volts DC, 8.0A (peak)
  • Input signals: Pulse, Direction, Enable
  • Output: Alarm
  • Encoder: 1000 lines per rotation
  • Motor Dimension: NEMA 23
  • Pulse angle: 1.2 deg
  • Freq. pulse input: 0 to 200 khz

Buy those parts in our store

Nema 23 Servomotor and Drive

nema 23 servomotor and drive

8x10mm Flexible Shaft Coupling

8x10mm flexible coupling

Nema 23 Motor Mount Bracket

Nema 23 motor mount bracket

Electrical schematic for the servomotors

Figure 7: Electrical diagram for the servomotors.

For the movement of the robot head on the Z axis, we use a 12V DC linear actuator. This is shown in Figure 8. It allows linear motion of up to 10 cm, but since it is too much for our application, we limit the distance using a timer programmed in the PLC. To control the direction of the actuator, we use two different relays, connected to two PLC outputs. As you can see in the wiring diagram of Figure 8, this allows us to reverse the electric current at the poles of the motor.


12 volt linear actuator and electrical control diagram

Figure 8: 12 Volt Linear Actuator and Electrical Control Diagram

Buy those parts in our store

12V Linear Actuator

12V linear actuator

15x30mm Cable Drag Chain

15x30mm cable drag chain

Another motor is used for the orientation of the robot head. It is a stepper motor with a 5:1 ratio reduction gearbox. This motor, visible in FIG. 9, is controlled by an driver which amplifies the pulse signal supplied by the PLC. The motor and its driver have the following technical characteristics:

  • Motor model : 17HS4401S-PG518
  • Amplifier/Driver : TB6600
  • Gearbox: 5: 1 ratio planetary type, efficiency 90%
  • Power supply: 12-24V DC
  • Input signals: Pulse, Direction, Enable
  • Pulse angle without gearbox: 1.8 deg ± 10%
  • Pulse angle with gearbox: 0.4 deg ± 10%
  • Dimension: NEMA 17

Stepper motor with planetary gearbox and 24V electromagnet

Figure 9: Stepper motor, 5:1 ratio planetary gearbox and 24V electromagnet.

For grabbing puzzle pieces, we use a custom-made 24V electromagnet from a solenoid. The center of the solenoid was replaced by a bolt. This gives us a magnet powerful enough to hold the pieces. As you can see in Figure 9, the electromagnet is attached to the stepper motor shaft so that it can rotate.

For the robot's manual controls, we chose two 4-position joysticks. The first joystick is used to control the movement of the X and Y axes. The second joystick is used to raise or lower the robot head and turn the head clockwise or counterclockwise. Momentary buttons are used for the system reset, cycle start and stop commands of the robot. An emergency stop button will also be installed. The joysticks and buttons have their own reserved inputs on the controller.

Buy those parts in our store



4 positions Joystick

4 positions joystick

4.3: Electrical assembly

The electrical control components and the transformers are fixed on a common panel. Industrial DIN rails and terminal blocks are used for the management of electrical wires. Figure 10 illustrates the control panel.


Control Panel (with french description)

Figure 10: Control Panel

The robot's main power supply is suitable for connection to a North American 120V AC system. The electric current is then transformed into 24V DC for the PLC, the vision system and 24V DC devices. The servomotors each require a 120V AC to 48V DC 10A transformer. A 2.5A DC 12V transformer is used to power the Z axis linear actuator.

To isolate and protect the outputs of the PLC, we use relays. These are for controlling devices that consume more current, such as the electromagnet and the linear actuator. A relay is also used to shut down the motors if the safety circuit (emergency stop and limit switches) is open.

The Ethernet switch is used to connect the PLC and the Cognex vision system together. It is also used to connect a computer for system programming. Each device has a unique IP address.

Buy those parts in our store

48V DC 10A Power Supply

48V DC 10A Power Supply

Micro Limit Switch

Micro Limit Switch

4.4: Dimensions and Characteristics of the robot

Here is a summary of the specs of the robot

  • Power supply: 120V AC
  • Dimensions of the table: 830mm x 480mm
  • Max movement area: 600mm x 372mm
  • Accuracy: ± 2mm in x and y
  • ± 1 degree (gripper orientation)
  • Dimensions: 960mm x 745mm x 330mm (without the camera support)
  • Weight: about 60 Kg
  • X-axis top speed: 112.48 mm/s
  • Y-axis top speed: 93.73 mm/s

5: Vision system

5.1: Technical specifications

Figure 11 illustrates the vision system used in our project:


Cognex In-Sight 1000C Camera

Figure 11: Cognex In-Sight 1000C Camera

The camera has the following characteristics:

  • Model: IN-SIGHT 1000C
  • Power supply: 24 ± 10% VDC, 200mA, 4.8W
  • Image Resolution: 640 x 480 pixels
  • Colors: 16 million (24 bits per pixel)
  • Capture speed: Up to 30 frames per second
  • Trigger: By external input or by software
  • Inputs: 1 trigger input
  • Outputs : 2 outputs (max 28 volts DC)
  • Communication: one 10/100 BaseT Ethernet port, TCP / IP protocol. Supports DHCP or static IP address.
  • 1 RS-232C port (1200 to 115200 baud)
  • Dimensions: 118.60mm x 43.18mm x 38.61mm (without lens)
  • Weight: 210.0 g (without lens)
  • Distance between the lens and the robot table and detection surface: 34 inches.
  • Scan surface at 34 inch : approximately 400mm x 500mm

The vision system is programmed with the In-Sight PC Host software. Figure 12 shows an example of system programming by spreadsheet (this example is not related to our project).

Example of program with the in-sight pc host software

Figure 12: Example of programming with the In-Sight PC Host software.

To take advantage of the camera's communication functions, we use the built-in Ethernet port. We have an Ethernet connection between the camera and the Micrologix 1400 PLC.

5.2: Recognition of parts

To identify our puzzle pieces, we mainly use the function "Patterns" of the software In-Sight PC Host. This function is used to detect a shape that has been pre-recorded in the camera's memory. The function returns the X and Y coordinates of the detected object, as well as its orientation angle. These are the decimal values that are sent to the PLC.

5.3: Communication with the programmable logic controller

In the In-Sight PC Host software, an Ethernet "WriteEIP" communication function is used to send the selected values on the network to the PLC. The writing of values on the network is done when a new image is captured by the camera. The PLC uses the RSLogix 500 message function named "MSG". The reading of the values by the "MSG" function will be activated when a new object is detected. Positioning values are then processed to calculate the motion of the robot axes.

6: Programming the robot

6.1: Structure of the program

The Micrologix 1400 controller is programmed using Allen-Bradley's RSLogix 500 software. Our program is structured in a way that functions, calculations and movements of the robot are separated in different routines. Here is an overview of our PLC program structure:

  1. Main routine;
  2. Parameters of the X-axis servomotor;
  3. Parameters of the Y-axis servomotor;
  4. Stepper motor parameters;
  5. Movement of the X axis;
  6. Movement of the Y axis;
  7. Movement of the Z axis;
  8. Rotation of the head;
  9. Security and alarms;
  10. Communication with the Cognex camera;
  11. Main sequence.

The Micrologix 1400 PLC allows "on-line" changes so we immediately see the result without having to download the program or turn off the power of the robot. However, the manipulation of the structure of the "PTO" function is not allowed when in "online" mode. This is why we have created subroutines dedicated to the parameters of the "PTO" functions for each axis. To change the distance values, to change the speeds of the motors or to make movements, we use different routines.

The main sequence is the routine that controls the automatic cycle of the robot. It groups together a set of synchronized movements in order to move the robot to the required coordinates. It also includes movements of the Z axis to grab or deposit objects.

6.2: Programming the axes of the robot

The movement of the X and Y axes is done by the two servomotors. We can perform motion on the axes by dynamically changing the following parameters:

  • Displacement in millimeters (related to the total number of pulses).
  • Motion speed in m/s (related to the rotation frequency).

The total number of pulses is calculated by converting the position to millimeters. We obtain about 800 pulses per linear millimeter. Here is the conversion data:

Axis Range in mm Range in total pulses
X 0 to 600 0 to 480 101 pulses
Y 0 to 372 0 to 297 663 pulses

The "PTO" function of the PLC produces a speed profile that includes acceleration and deceleration. In the PLC program, we have a logic that makes it possible to vary the number of pulses for the acceleration and deceleration phases according to the distance to be crossed. This makes it possible to obtain fluid movements, without requiring too much mechanical stress on the axis. Figure 13 illustrates an example of a speed profile generated by the "PTO" function.


Example of speed profile of servomotors

Figure 13: Example of speed profile of servomotors

The normal speed of the axes is configured in the PTO function. Thus, the X axis is configured to produce 90,000 pulses per second. The Y axis is configured for 75,000 pulses per second. With the mechanical ratio between the motor and the ball screw, we obtain speeds of 112.48 mm / s for the X axis and 93.73 mm / s for the Y axis. To ensure that we do not exceed the mechanical limits of the axes, we check, thanks to our programming, if the requested movement exceeds the limit value of the axis.

6.3: Gripping the pieces of the puzzle

Gripping is done by positioning the robot's head over a puzzle piece, making a downward movement on the Z axis and turning the electromagnet on. The electromagnet is automatically activated during the automatic cycle of a puzzle assembly, but it can also be activated manually if the manual mode is selected.

It is necessary to readjust the lower limit of the Z axis if a puzzle does not have the same thickness. Since we do not use a limit switch or proximity sensor on the robot head, we must correctly adjust the timer time, in the PLC, which limits the descent of the Z axis.

7: Robotic assembly of the puzzle

7.1: Programming the robot to assemble the puzzle

As part of this project, we record in advance the positions of the pieces of the puzzle in the PLC. To determine the required position of a piece when assembling the puzzle, a simple search in the memory registers of the PLC allows to obtain the coordinates x and y.

7.2: Automatic cycle

To start the automatic cycle, the following steps must be followed:

  1. Place the pieces of the puzzle randomly in the detection zone.
  2. Make sure the emergency stop button is released.
  3. Press the "RESET" button to reset the robot and clear faults.
  4. Press the "START" button to start the automatic cycle.

The automatic cycle works according to the following steps:

  1. Recognition of a piece of the puzzle by the camera in the detection zone.
  2. If a piece is detected, the robot moves towards the piece.
  3. The robot grips the piece with the electromagnet.
  4. The robot moves to the assembly area at the x and y coordinates calculated by the PLC. The orientation of the piece is adjusted by the stepper motor of the robot's head.
  5. The robot deposits the piece. The electromagnet is deactivated.
  6. The robot returns to the standby position.
  7. If the puzzle assembly is complete, the automatic cycle is disabled. If the assembly is not completed. We resume at step 1.

There are three ways to stop or cancel the automatic cycle:

  • Press the "STOP" button.
  • Press the emergency stop button.
  • Set the "AUTO / MAN" switch to the "MAN" position.

During an emergency stop, the automatic cycle can be restarted as follows:

  1. Correct the problems.
  2. Make sure the emergency stop button is released.
  3. Press the "RESET" button to reset the robot and clear faults.
  4. Press the "START" button to start the automatic cycle.

8: Additional functions of the robot

8.1: Manual mode

A manual mode is available and is activated using the "AUTO / MAN" selector switch. This mode then makes it possible to carry out jogging movements on each of the axes with the two joysticks. A button also allows to activate or deactivate the electromagnet. The manual mode can be activated at any time during the automatic assembly cycle of the puzzle. Here is the procedure to return to automatic mode:

  1. Return the selector knob to the "AUTO" position.
  2. Press the "RESET" button to reset the system and clear faults.
  3. Press the "START" button to start the assembly of the puzzle in automatic cycle.

8.2: Security

Some security features are added to the robot. Including limit switches to limit the movement of the axes. Triggering one of these switches causes the motors to be deactivated.

An emergency stop button is also used to allow the operator to shut off the power to the motors, resulting in a complete shutdown of the robot.

Encountered difficulties

Here is a list of the main difficulties encountered throughout the realization of this project:

  • Aluminum profile extrusions do not have flat surfaces, so adjustments were needed to achieve proper rail alignment.
  • We had trouble finding the right communication protocol to exchange data between the vision system and the programmable logic controller.
  • To obtain a good repetition of the movements of the axes, a calibration was necessary. This was done mathematically in the programming of the PLC. We have tried to find the most accurate positioning values possible, but we do not guarantee reliable long-term results. A calibration is frequently necessary.
  • The rotary motions produced by the stepper motor were erratic. It has been difficult to find the right configuration for this motor. The adjustment is sensitive to fluctuations in electrical current. After our research, we discovered a phenomenon of resonance between the phases of the stepper motor. We will try to change the stepper or drive in the future.


I hope you like that I shared this project with you. This project was greatly beneficial to apply concepts learned during my studies in automation engineering. It is a project that brings together several fields of engineering such as electricity, mechanics and computer science. This project enriches our knowledge of programmable logic controllers and machine vision systems.


Leave a comment

Log in to post comments