20160712_230235

Arduino Braccio Robot Arm, Raspberry Pi Controlled with Arduino and SSC-32

As  new project I am looking to experiment with fruit and or vegetable harvesting using a simple robot arm and some fake plants at home. This project will consist of three parts (for now) and involves the following aspects:

  1. A robot arm that can receive XYZ commands from a PC type platform.
  2. A user interface to provide the instructions based on user actions and some debugging tools.
  3. A stereo camera for depth and images of the situation.

This post will describe the steps taken for part 1. The end result so far is a Raspberry Pi that can send serial commands to an Arduino which in turn controls a robot arm through a servo controller. My next step will be to create a hosted webpage on the Pi to control the arm. Most likely using Python and Flask.

For convenience of development, testing and keeping the workspace clean a platform has been  designed to mount all the components that were required. Once the components had been selected, an initial 3D design was made. With the help of a friend we fabricated and elaborated on the design. Tools and materials used for fabrication where Trespa panels, some power tools and a CNC mill to create the more accurate and delicate parts. A control panel is used to hook up cables and control the power of the robot arm assembly.

The following hardware has been used:

  • Arduino Braccio Robot Arm (link).
  • Arduino Due (link).
  • Arduino UNO (link) as a fall back and for testing the Braccio Shield.
  • Lynxmotion SSC-32 Servo Controller (link).
  • Raspberry Pi 3 (link).
  • Various cabling and power plugs.
  • Various Servo Cabling to redo the wiring on the Braccio Servo’s.

To find a robot arm within a price range of 100-500 was not easy. I was looking for an arm that can carry around 50-150 grams, had a gripper, 3 to 4 Degrees of Freedom (DOF), +/- 5 mm repeatability and could understand “go to XYZ O” commands. Especially the last requirement was surprisingly hard to find in the hobby sector. Very few robot arms seem to come with an Inverse Kinematic (IK) engine and when they do, it can only be controlled through a GUI and not a software interface. I evaluated the following robot arms:

  • Dobot (link). Unfortunately, their Kickstarter backers are not happy with the final results.
  • 7Bot (link) Has lots of happy customers in their forum, great video etc. However they have a huge backlog (100+) of orders so ordering now will mean a long wait.
  • KATIA (link) Is currently not selling and don’t reply to email.
  • Lynxmotion AL5D 4DOF Robotic Arm (link) This one seemed the best bet, however the software interface was not very clear on the website.
  • Braccio, robot arm by Arduino (link). This one seemed incredibly cute, would however require self made firmware.
  • Universal Robots UR3 (link). Unfortunately the price tag was around 25.000 Euro.

The choice was made to order the Braccio robot arm, mostly because it looked very nice and orange, similar to the Kuka industrial robots. Functionality wise it checked out in line with the specs. Given that it only came with same basic firmware that utilises the Braccio shield, which I opted to switch out for the SSC-32 the firmware would have to be made.In the end this took a couple of days work.

The initial software consists of several parts:

  • Arduino Firmware With
    • Serial Interface commands
      • Go to XYZ
      • Set servo x to x angles
      • Execute routine x
    • Inverse kinematics, to facilitate the go to XYZ command.
    • Send commands to SSC-32 Servo Controller
  • Raspberry Pi With
    • Basic python script to communicate over serial
    • Bash script to send multiple python commands in a certain order

Interface from Pi consists of three types of command formats:

RT,2
SP,0,0,0,0,0,0,5000
GT,60,300,220,4000

Where each command is put in between and start and end character < and >. This was based on Serial commands example 3 and 5 from the Arduino forum (link).

The Inverse Kinematics (IK) are based on the code and comments from the circuitsathome website (link).

Arduino Braccio Robot Arm Controlled From Raspberry Pi with SSC-32

In the video, a sequence of several commands from the Pi is executed in order:

  1. 0:00 – 0:01 Execute routine 2, which is move to safe position
  2. 0:02 – 0:06 All joints to 0 position
  3. 0:07 – 0:11 Go to X 60 Y 300 Z 220 within 4 seconds
  4. 0:15 – 0:29 Execute routine 6, which is following a line along X 0 forward and back for Y 200 to 300 while Z remains the same. Then follow a line from X -200 to X200 while Y and Z remain the same.
  5. 0:29 – 0:35 Execute routine 2, which is move to safe position

Which is the following set of serial instructions in a row, put in a bash script for convenience:

#!/bin/bash
python simple-serial-2-arduino-03.py RT,2
sleep 5
python simple-serial-2-arduino-03.py SP,0,0,0,0,0,0,5000
sleep 5
python simple-serial-2-arduino-03.py GT,60,300,220,4000
sleep 5
python simple-serial-2-arduino-03.py RT,6
sleep 11
python simple-serial-2-arduino-03.py RT,2
sleep 4
echo Done!

The python code:

#!/usr/bin/python

import sys
import serial

text = sys.argv[1]

# Print to serial
out = serial.Serial(“/dev/ttyACM0”, 19200)
print text
out.write(“<%s>” % text)

The Arduino code is to long to be put here and will be placed on GitHub once it has been cleaned up.

Leave a Reply