UCN Robotics - PLC Arduino Project

Introduction: UCN Robotics - PLC Arduino Project

For our 2nd Semester Robotics class it is necessary to create an instructables about the robot arm used for the class. This instructable will cover the setup and code (Only Arduino code) used to make this system work, all of which may be freely used for anyone who might find a use for it.

This system will demonstrate a simple method for different automation technologies and systems to communicate with each other. This system will also use a simple binary communication, which could also be done using analogue signals if more precise information was needed.

The steps of this system will be as follows:

1. Object is sent down the conveyor system

2. PLC detects object at the end of the system.

3. Conveyor system Stops.

4. PLC sends signal to Arduino board to begin Robot Sequence.

5. Robot picks up object.

6. Robot Moves object to other conveyor System.

7. System Repeats process.

This system will be moving objects from a feeding conveyor system, because we had acces to this system. But you just need a sensor which can trigger the relay, which sends the signal to the Arduino. Then you can feed the arm manually or by some other means.

There are 6 steps for to follow.

Step 1: Parts needed

Step 2: How to setup the system

Step 3: Programming the Robot

Step 4: Setting up code, finding positions

Step 5: Inputting sequence positions

Step 6: Testing

Step 1: Parts Needed

For this instructable it will be necessary to have:
1. A Phamtom x Pincher robot Arm, which can be found here:

http://www.trossenrobotics.com/p/PhantomX-Pincher-... It comes at a price of 380 $

2. A Sensor connected to a relay. For our system setup, the PLC will control the conveyor and a relay will be used to send signals from the PLC to the Arduino board which will then control the robot. But you can use any relay which can control the signal on the Arduino.

Step 2: How to Setup the System

Before a system can be tested a test setup must be built. Which will be done in the following steps.

1. For setting up the basic functions of the Robot you can follow the guide on Trossen Robotics homepage:


We are going with Servo ID's from base to gripper in the order 1 - 5.

2. Connect the Relay to three pins. this should be done as follows

- common should be connected to the gpio18 signal pin

- the normally closed should be connected to the gpio22 signal pin

- the normally open should be connected to the gpio20 signal pin

- The above is because the gpio22 will send a constant high signal, the gpio 20 sends a constant low signal, and the gpio18 recieves both signals, and all the gpios share a common ground on the PCB board.

Step 3: Programming the Robot

From the Arduino program you can upload the Pincher Code.

Follow this guide to Setup and install the Arduino Software, and drivers.


The main parts of setting up the ArbotiX-M are as follows:

Install the Arduino IDE

Install the FTDI drivers

Install the ArbotiX-M Hardware and Library Files

Connect your ArbotiX-M Robocontroller

Program the ArbotiX-M Robocontroller

The Robot programming is a core part, and properly the one that would cause the most headache.
The base code used for this setup supplied here.. This includes the code and all header files used.

Step 4: Setting Up Code, Finding Positions

When you have it all up and runningn and the communication is up. Code has been uploaded to the Arbotix-m board. Then you are ready to edit the code to your needs.

1. First you have to make sure the code is in the right mode. Because there is a Sequence mode and a set up mode.

In Robot Project main you will have to comment and uncomment some code depending on what you want. (Follow the pictures). For now we need to be in Menu mode.

2. Then go to monitor the COM port which connection between your computer and Arduino is running.

- This can be done with with the inbuilt arduino COM port or another program such as putty.

3. Here you will see a menu like on picture. In menu Relax servo's, you will now be able to move the arm around.

4. When you have found the position you want, then hold it there and Torque servo's

5. Select Servo scan. Now read the positions of the motors.

- make sure to keep track of all the positions that you will use.

Step 5: Inputting Sequence Positions

Now the positions has to be written into the Sequence Array.

1. Put the servo positions you found from before into the array. First value in array is To enable the position step. Use 1 for Enable, and 0 for disable.

- input the steps that have been saved from the servo scans.

-There can be a max of 10 steps but more can be added by increasing the array size.

2. Uncomment the Section and Comment the section in void loop. (See picture)

Step 6: Testing

And now you are ready to do a test on your setup.

Upload the program to the Arduino.

Try and trigger the relay, and then you should see your robot in action.

It should appear as it does in the intro video if you are also using a conveyor setup.

Thank you for following this guide.

Automation Contest 2016

Participated in the
Automation Contest 2016

Be the First to Share


    • Make it Glow Contest

      Make it Glow Contest
    • First Time Author Contest

      First Time Author Contest
    • PCB Challenge

      PCB Challenge



    4 years ago

    Very nice work, thanks for sharing!