wedesoft / arduino-sainsmart

Arduino software to control SainsSmart 6-axis palletizing robot arm
BSD 2-Clause "Simplified" License
73 stars 19 forks source link
arduino arm robot sainsmart servo

arduino-sainsmart Build Status

Arduino software to steer the SainSmart DIY 6-axis palletizing robot arm and Sunfounder Rollpaw gripper.

Smooth motion profiles

The software uses smooth sin²(t) (where t is the time) speed profiles to drive the robot joints. At any time the sum of up to two speed profiles is output to the drives. Using sin²(t)+cos²(t)=1 one can achieve constant motion. The plot shows jerk (blue), acceleration (red), speed (green), and position (magenta).

SainSmart 6-axis servo steering

Schematics

equipment

SainsSmart 6-axis robot arm

Redboard

DFRobot IO expansion shield for Arduino

6V DC/3A power supply

USB Mini-B cable

2.1 x 5.5mm DC Socket

JR Servo Extension Wire

Sunfounder Rollpaw gripper

Altogether the equipment cost is about 200£. Furthermore you need a PC with a USB port.

software build

First install the dependencies. Please refer to the file .travis.yml for more information.

Create the initial calibration file with the limits and offsets of each servo:

cp calibration.hh.default calibration.hh

Then build the Arduino program using make:

make

Note: You might have to change the BOARD_TAG in the arduino/Makefile. See /usr/share/arduino/hardware/arduino/boards.txt for supported board tags.

software test

You can also build and run the tests on the PC using the check target:

make check

install on Arduino

The upload target will upload the program via /dev/ttyUSB0 to the Arduino board.

make upload

Warning: program the board before connecting the servos the first time to prevent erratic motion!

Warning: once servos are plugged into the board, always connect the servo power to the DFRobot I/O expansion shield before connecting the USB cable to the Arduino to prevent the board power from stalling which causes erratic motion!

Warning: self-collisions or collisions with the surface and other objects can damage the servos!

You can then adjust the limits and offsets for your robot and then compile and upload the modified software.

control robot

You can control the robot using the screen serial terminal (make sure ttyUSB0 is the correct port):

screen /dev/ttyUSB0 115200

Examples of servo commands are:

You can exit the screen terminal using Ctrl-A \.

Warning: self-collisions of the robot can damage the servos!

XBox controller

You can control the robot using a calibrated XBox controller.

ruby control.rb

Note that for some reason you sometimes need to run the serial terminal first, press t a few times, and then exit for the Arduino to wake up.

XBox Controller

External links