EGizmo Robotic Arm Keypad Controller with gizDuino ATmega328 UNO (Project Making)

An Entry Level Robotic Arm for Pick N’ Place

Works with USB (**5V Input Supply), additional features 4 suction caps that you can attach on the wall such as glass, metals etc. using suction cup and 4 servo motors.

Demo Video:

Materials Need:

1  x   E-GRA

1 x    GizDuino Atmega328P UNO version5 (Arduino UNO compatible)

1  x   4×4 Keypad kit

1 x    9V 1A Adaptor

1  x   USB Cable

14 x  1pin Jumper wire (male-male)

Wiring Diagram:

* In Buck converter (Optional),  check the voltage output  5V for the Servo Motors.

** Caution: If you want to use it with USB powered, please make sure you calibrated the degrees of each servos correctly, before you plug-in the USB. If the servo motor gets stuck in a long time, it will be broken. ( The servo gets heat or there’s an annoying sounds if it is stuck up). Remove immediately any source of power supply then adjust your code for the initial position:


int G_POS = 120;
int E_POS = 70;
int S_POS = 130;
int B_POS = 80;

Also, adjust the range of each servo. Start in Gripper servo. Open the Serial Monitor. (You can unscrew the servo shaft to see end to end range for grabbing/releasing). See the Keypad Function (section).

Change G_POS value.


void G_GRABING(){
G_POS = G_POS+DEGREES;
if(G_POS>=120){
G_POS=120;
}
GRIPPER.write(G_POS);
Serial.println(G_POS);
}

Keypad Functions:



Pad Number/Letter      Functions
A  ................... Gripper Grab/Hold
B  ................... Gripper Release
3  ................... Elbow Extend
9  ................... Elbow Retract
2  ................... Shoulder Turn Up
8  ................... Shoulder Turn Down
4  ................... Base Turn to the Left
6  ................... Base Turn to the Right

Arduino Library:

SERVO
KEYPAD

Code:

/*
E-GRA SG-90 SAMPLE CODES
THIS IS A COMPLETE CODE FOR CONTROLLING THE
ROBOTIC ARM (GRIPPER, ELBOW, SHOULDER, BASE)
INTERFACE TO GIZDUINO 328 UNO AND KEYPAD.
OPEN THE SERIAL MONITOR TO SEE THE POSITIONS
OR DEGREES.
LIBRARY USED:
SERVO LIBRARY
KEYPAD LIBRARY
THE WIRING CONNECTIONS:
EGRA TO GIZDUINO 328
GRIPPER - PIN 3
ELBOW - PIN 5
SHOULDER - PIN 6
BASE - PIN 9
(NOTE: USE THE PWM PINS FOR THIS APPLICATION)
KEYPAD TO GIZDUINO 328
COLUMNS:
C1,C2,C3,C4 - 13,12,11,10
ROWS:
R1,R2,R3,R4 - 14,15,16,17
KEYPAD FUNCTIONS:
A = GRIPPER GRAB/HOLD
B = GRIPPER RELEASE
3 = ELBOW EXTENDED
9 = ELBOW RETRACT
2 = SHOULDER TURN UP
8 = SHOULDER TURN DOWN
4 = BASE TURN LEFT
6 = BASE TURN RIGHT
CODE BY E-GIZMO MECHATRONIX CENTRAL
http://www.e-Gizmo.net
JANUARY 16,2018
*/
#include <Keypad.h>
#include <Servo.h>
const byte ROWS = 4; //four rows
const byte COLS = 4; //three columns
char KEYS[ROWS][COLS] = {
{
'1','2','3','A' }
,
{
'4','5','6','B' }
,
{
'7','8','9','C' }
,
{
'*','0','#','D' }
};
byte ROWPINS[ROWS] = {
14, 15, 16, 17}; //connect to the row pinouts of the keypad
byte COLPINS[COLS] = {
13, 12, 11, 10}; //connect to the column pinouts of the keypad
Keypad keypad = Keypad( makeKeymap(KEYS), ROWPINS, COLPINS, ROWS, COLS );
char HOLDKEY;
unsigned long T_HOLD;
//SERVOS
Servo GRIPPER;
Servo ELBOW;
Servo SHOULDER;
Servo BASE;
//INITIAL POSITIONS (MUST CHANGE)
// TO GET THE EXACT CALIBRATION
int G_POS = 120;
int E_POS = 70;
int S_POS = 130;
int B_POS = 80;
int DEGREES = 10;
void setup(){
Serial.begin(9600);
GRIPPER.attach(3);
ELBOW.attach(5);
SHOULDER.attach(6);
BASE.attach(9);
//INITIAL POSITION
GRIPPER.write(G_POS);
ELBOW.write(E_POS);
SHOULDER.write(S_POS);
BASE.write(B_POS);
}
void loop(){
char KEY = keypad.getKey();
if(KEY){
HOLDKEY = KEY;
Serial.println(KEY);
}
if(keypad.getState() == HOLD){
if ((millis() - T_HOLD)>100){
switch(HOLDKEY){
case 'A':
G_GRABING();
break;
case 'B':
G_RELEASING();
break;
case '2':
S_TURNUP();
break;
case '8':
S_TURNDOWN();
break;
case '4':
B_TURNLEFT();
break;
case '6':
B_TURNRIGHT();
break;
case '3':
E_EXTENDED();
break;
case '9':
E_RETRACT();
break;
}
T_HOLD = millis();
}
}
}
// E-GRA FUNCTIONS //
// YOU MAY MODIFY THIS SECTION, FOR CALIBRATION OF SERVO MOTORS //
void G_GRABING(){
G_POS = G_POS+DEGREES;
if(G_POS>=120){
G_POS=120;
}
GRIPPER.write(G_POS);
Serial.println(G_POS);
}
void G_RELEASING(){
G_POS = G_POS-DEGREES;
if(G_POS<=80){
G_POS=80;
}
GRIPPER.write(G_POS);
Serial.println(G_POS);
}
void E_EXTENDED(){
E_POS = E_POS+DEGREES;
if(E_POS>=180){
E_POS=180;
}
ELBOW.write(E_POS);
Serial.println(E_POS);
}
void E_RETRACT(){
E_POS = E_POS-DEGREES;
if(E_POS<=70){
E_POS=70;
}
ELBOW.write(E_POS);
Serial.println(E_POS);
}
void S_TURNDOWN(){
S_POS = S_POS+DEGREES;
if(S_POS>=180){
S_POS=180.;
}
SHOULDER.write(S_POS);
Serial.println(S_POS);
}
void S_TURNUP(){
S_POS = S_POS-DEGREES;
if(S_POS<=80){
S_POS=80.;
}
SHOULDER.write(S_POS);
Serial.println(S_POS);
}
void B_TURNLEFT(){
B_POS = B_POS+DEGREES;
if(B_POS>=160){
B_POS=160.;
}
BASE.write(B_POS);
Serial.println(B_POS);
}
void B_TURNRIGHT(){
B_POS = B_POS-DEGREES;
if(B_POS<=10){
B_POS=10;
}
BASE.write(B_POS);
Serial.println(B_POS);
}