Green Robot Machinery
Published © LGPL

Internet Controlled Move and Pick using Robotic Arm

Robotic arm controlled over the internet to perform pick and place operation.

IntermediateWork in progress4,601
Internet Controlled Move and Pick using Robotic Arm

Things used in this project

Hardware components

owi robotic arm
×1
SparkFun Triple Axis Accelerometer Breakout - ADXL335
SparkFun Triple Axis Accelerometer Breakout - ADXL335
×2
Spark Core
Particle Spark Core
×2
H Bridge L298N
×2

Story

Read more

Schematics

Accelerometer wiring

Wiring for Accelerometer based controller

Motor Wiring

Motor wiring schematic. Used H-Bridge to drive the motors.

Code

ARM CONTROL

C/C++
This module consists of H-bridge and motors to control the arm. Three motors are controlled based on the command received from the acclerometer control.
/* ARM MOTOR CONTROL */

//use core 2

/*motor pins*/
#define shoulderf 0
#define shoulderr 1
#define elbowf 5
#define elbowr 6
#define handf 3
#define handr 4

//commands
const char *cmd1 = "up", 
           *cmd2 = "down", 
           *cmd3 = "left", 
           *cmd4 = "right", 
           *cmd5 = "grab", 
           *cmd6 = "drop";

char *core1, *core2;

void ctrl(const char *event ,const char *data)
{
    
        /*UP*/
    if( strcmp(data , cmd1) == 0 )
    {  
       digitalWrite(elbowf,HIGH);
       digitalWrite(elbowr,LOW);
       delay(500);
       digitalWrite(elbowf,LOW);
    }
           /*DOWN*/
    else if( strcmp(data , cmd2) == 0 )
    { 
        
       digitalWrite(elbowr,HIGH);
       digitalWrite(elbowf,LOW);
       delay(500);
       digitalWrite(elbowr,LOW);
        
    }
          /*LEFT*/
    else if(strcmp(data,cmd3) ==0 )
    {
      digitalWrite(shoulderr,HIGH);
      digitalWrite(shoulderf,LOW);
      delay(500);
      digitalWrite(shoulderr,LOW);
    }
         /*RIGHT*/
    else if(strcmp(data,cmd4) ==0 )
    {
      digitalWrite(shoulderf,HIGH);
      digitalWrite(shoulderr,LOW);
      delay(500);
      digitalWrite(shoulderf,LOW);
        
    }
           /*GRAB*/
    else if(strcmp(data,cmd5) ==0 )
    {
      digitalWrite(handf,HIGH);
      digitalWrite(handr,LOW);
      delay(1000);
      digitalWrite(handf,LOW);
        
    }
           /*DROP*/
    else if(strcmp(data,cmd6) ==0 )
    {
     digitalWrite(handr,HIGH);
     digitalWrite(handf,LOW);
     delay(1000);
     digitalWrite(handr,LOW);
  
    }
    
}


 void setup()   
 {
     Serial.begin(9600);
       
    core1 = "Your remote control Device ID";
    
   // pinMode(7,OUTPUT);
   
    pinMode(shoulderf , OUTPUT);
    pinMode(shoulderr , OUTPUT);
    
    pinMode(elbowf, OUTPUT);
    pinMode(elbowr, OUTPUT);
    
    pinMode(handf, OUTPUT);
    pinMode(handr, OUTPUT);
    
    Spark.subscribe("move", ctrl ,core1);
 }
 
 void loop()
 {
  
 }
 

ACCELEROMETER REMOTE

C/C++
This module consist of a particle core and two accelerometers. These two accelerometer are used like joysticks to send command to the robotic arm over the internet.
/* Acclerometer robotic arm control*/

#define ADC_ref 3.3 

//sensitivity of the sensor
#define sensitivity_x 0.3 
#define sensitivity_y 0.3
#define sensitivity_y2 0.3

#define tiltmin 5
#define tiltmax 6

//Sensor pins
#define x_pin A1
#define y_pin A2
#define y2_pin A3

#define handf 3
#define handr 4

//Analog values
unsigned int value_x;
unsigned int value_y;
unsigned int value_y2;


float x_val;
float y_val;
float y2_val;


void setup() 
{
 Serial.begin(9600);
 pinMode(handf,OUTPUT);
 pinMode(handr,OUTPUT);


 Spark.variable("xval", &x_val,DOUBLE);

}

void loop() 
{
    
     //analog values
     value_x = analogRead(A1);
     value_y = analogRead(A2);
     value_y2 = analogRead(A3);

     //calucated values
     x_val = (value_x/4095.0*ADC_ref)/sensitivity_x;
     y_val = (value_y/4095.0*ADC_ref)/sensitivity_y;
     y2_val = (value_y2/4095.0*ADC_ref)/sensitivity_y2;

     delay(2000);
     
    /*CONTROL*/
    
    /*Based on the tilt of accelerometer publish the control strings*/
     
   /*forward- reverse control*/
   
   if( y_val < tiltmin )
   {
    Spark.publish("move","up"); //publish the event
    //Serial.println("forward"); //for debugging
   }
   else if( y_val > tiltmax )
   {
    Spark.publish("move","down");
    //Serial.println("reverse");
   }



   /*right-left control*/
   if( x_val < tiltmin )
  {
    Spark.publish("move", "right");
    //Serial.println("right");
  }
   else if( x_val > tiltmax )
  {
    Spark.publish("move","left");
    //Serial.println("left");
   }



   /*gripping control */ 
  if( y2_val < tiltmin )
  {
    
   Spark.publish("move","grab");
   //Serial.println("grab");
  }
  
  else if( y2_val > tiltmax )
  {
   Spark.publish("move","drop");
   //Serial.println("drop");
  }


}

Credits

Green Robot Machinery

Green Robot Machinery

7 projects • 41 followers
Green Robot Machinery Private Limited

Comments