Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Avinash BaranitharanKarthikeyan
Published

Gesture Controlled Robotic Arm Using Kinect & Arduino

This is a Simulink model to control a robotic arm using gestures that are captured using Kinect; robotic arm developed using servo motors.

IntermediateShowcase (no instructions)3 hours18,482
Gesture Controlled Robotic Arm Using Kinect & Arduino

Things used in this project

Hardware components

Arduino Mega 2560
Arduino Mega 2560
×1
Kinect Sensor
Microsoft Kinect Sensor
Kinect for XBox 360
×1
Microsoft Xbox Kinect Adapter
×1
Adafruit Servo Motor
×4
SparkFun USB to Serial Breakout - FT232RL
SparkFun USB to Serial Breakout - FT232RL
×1
Gripper
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

Arduino IDE
Arduino IDE
Microsoft Kinect for Windows SDK v1.6
Microsoft Windows SDK 7.1
MATLAB
MATLAB
MATLAB 2013a

Story

Read more

Custom parts and enclosures

Simulink Model

Open the GestureControlledRoboticArm.mdl using Matlab after installing the Simulink Support for Kinect.

Matlab Simulink Code & Library Files (Instructions included)

In the .ZIP, you can find the Simulink for Kinect Support developed by Takashi Chikamasa, Mathworks. Inside the "slkinect" folder, you can find the instruction on how to install the library file in Matlab.

Schematics

Arduino - Servo Connection

The data output (angle) from the matlab software is sent to the arduino via TTL device. The connection from the TTL - Arduino & Arduino - Servo motors are as shown in the diagram.

Simulink Model (Gesture Controlled Robotic Arm)

This is the simulink model we have developed to aquire the data from kinect, convert xyz co-ordinates to angle, decrypt the data and send it to Arduino via Serial Communication.

Code

Arduino Program to Receive Angle Data from Matlab

Arduino
The angle output from the Matlab Software is encypted. In the Arduino IDE, we have written a rogram to receive the angle data, decrypt it and send it to the servo motors.
#include <Servo.h> 
 
Servo myservo1; //Servo Shoulder Vertical Movement
Servo myservo2; //Servo Shoulder horizontal Movement
Servo myservo3; //Elbow Movement
Servo myservo4; //Gripper Movement

void setup() 
{
  Serial1.begin(9600);
  myservo1.attach(9); //Attach Shoulder Vertical Movement Control Signal Pin To 9
  myservo2.attach(10); //Attach Shoulder Horizontal Control Signal Pin To 10
  myservo3.attach(3); //Attach Elbow Movement Control Signal Pin To 3
  myservo4.attach(5); //Attach Gripper Movement Control Signal Pin To 5
}

void loop() 
{
 if(Serial1.available()>0) //Check for any data in Serial Port
 {
   byte con = Serial1.read(); //Read serial data and store it in con
  
   if(con > 0)
   {
   if(con < 50)
   {
   con = (180*con)/50;  //Decrypt the data obtained
   myservo1.write(con); //Write the data to myservo1          
   delay(15);
   }
   }
  
   if(con > 50)
   {
   if(con < 100)
   {
   con = (180*(con-50))/50; //Decrypt the data obtained
   myservo2.write(con); //Write the data to myservo2            
   delay(15);
   }
   }
    
   if(con > 100)
   {
   if(con < 150)
   {
   con = (180*(con-100))/50; //Decrypt the data obtained
   myservo3.write(con); //Write the data to myservo3
   delay(15);
   }
   }
   
   if(con > 150)
   {
   if(con < 200)
   {
   con = (180*(con-150))/50; //Decrypt the data obtained
   if(con<20)
   {
   myservo4.write(180); //Write the data to myservo4
   delay(15);
   }
   if(con>20)
   {
   myservo4.write(60);
   delay(15);
   }
  }
 }
      
      }

}

Credits

Avinash Baranitharan

Avinash Baranitharan

2 projects • 13 followers
Master of the Possible, an Engineer.
Karthikeyan

Karthikeyan

1 project • 5 followers
Some what good in arduino.

Comments