REQUIREMENTS:
1. DC servo motors (2)
2. Compact Disc (for base of the arm)
3. Broom stick (for the arm)
4. Pencil/Pen
5. AtMega 16 IC
DESCRIPTION:
Recently I joined an MOOC on Introduction to Robotics by Queensland University of Technology, Australia. For those who don’t know what MOOC is, it stands for Massive Open Online Course. Professor Peter Corke was the mentor in introducing me to the world of robotics. Apart from the learning side of this course there was an optional project on building one’s own robotic arm which could track a given path provided by them. Here’s a look at the worksheet which was needed to be worked on:
Fig. 1: Typical Image of Robotic Worksheet
The task was simple; the robotic arm should be able to hold a pen/pencil and track the dotted path from coordinates (X1,Y1) to (X5,Y5). The base of the robot should fit within the grey coloured box (20mm X 20mm) while the arm was supposed to have only two joints for its movement.
To solve this task, I decided to go with Servo motors as they come with high precision movements when compared to steppers and normal DC motors. According to me, this project involved two major parts to be worked on: Mechanical structure and Microcontroller coding. The pictures below show the robotic arm that I came up with:
Fig. 2: Image showing Motor Setup for Simple Robotic Arm
Fig. 3: Image showing Test of Simple Robotic Arm for Drawing on the robotic worksheet
Fig. 4: Image showing Robotic Arm placing Pencil Tool at fixed coordinate within the workspace
Fig. 5: Image showing Robotic Arm moving Pencil Tool over the robotic worksheet
Fig. 6: Image showing movement of Robotic Arm to a fixed coordinate on Robotic Worksheet
Fig. 7: Image of Robotic Worksheet with Robotic Arm placed over it
Fig. 8: Image showing movement of Pencil Tool by Robotic Arm to a fixed coordinate over the Worksheet
So as you can see , my constructed robotic arm contains two servo motors, one for the base (black one) and one for moving the arm (blue one) connected to the pencil. Now comes the coding part which you can check out from the code section. To brief you with the same, let me tell you that I have used timers to operate these servo motors. A 16 bit seemed to be a good choice. In AtMega 16 MCU, timer1 is 16 bit and has two independent output PWM pins (OC1APD5 and OC1BPD4).
We know that servos need a 20ms cycle with 1ms to 2 ms high pulse for its operation, so I chose the clock frequency to be 1 MHz which results in 1us for every clock cycle. Thus we require total of 20,000 incriminations to make it 20ms. This can be achieved by initializing ICR1 register with 20,000 value, this will let the TOP value to be 20,000, just what we want. Now what’s left is to just update the OCR1A and OCR1B values for 1ms -2ms high pulse.
Simply telling you guys, I started working with searching the OCR1A and OCR1B values for 5 coordinate points and it was all hit and trial. Once I got them, I moved on for a smooth transition between two consecutive coordinates. You’ll be able to see that in my coding section for sure.
You may also like:
Project Source Code
###
#include
#include
void main()
{ int i=0,j=0,small_time=50,big_time=1000;
TCNT1=0;
TCCR1A|=(1<
TCCR1B|=(1<
DDRD|=(1<<5)|(1<<4); //initialising OC1A and OC1B pins as output
ICR1=19999;
OCR1A=1050;
OCR1B=695;
_delay_ms(big_time);////////////(X1,Y1)////////////////////////
for(i=1050,j=695;i>450&&j<1425;i-=5,j+=6)
{ OCR1A=i;
OCR1B=j;
_delay_ms(small_time);
}
OCR1A=450;
OCR1B=1425;
_delay_ms(big_time);////////////(X2,Y2)////////////////////////
for(i=450,j=1425;i<1000&&j>700;i+=10,j-=7)
{ OCR1A=i;
OCR1B=j;
_delay_ms(small_time);
}
OCR1B=1050;
for(i=1000;i<1600;i+=10)
{ OCR1A=i;
_delay_ms(small_time);
}
for(j=1050;j<1200;j+=10)
{ OCR1B=j;
_delay_ms(small_time);
}
for(i=1600,j=1200;i>1350&&j<1475;i-=10,j+=10)
{ OCR1A=i;
OCR1B=j;
_delay_ms(small_time);
}
OCR1A=1350;
OCR1B=1475;
_delay_ms(big_time);////////////(X3,Y3)////////////////////////
for(i=1350,j=1475;i<2300&&j>500;i+=10,j-=7)
{ OCR1A=i;
OCR1B=j;
_delay_ms(small_time);
}
OCR1A=2400;
OCR1B=800;
for(i=2400;i<2650;i+=10)
{ OCR1A=i;
_delay_ms(small_time);
}
for(j=800;j<1300;j+=10)
{ OCR1B=j;
_delay_ms(small_time);
}
for(i=2600,j=1300;i>1825&&j<2225;i-=10,j+=12)
{ OCR1A=i;
OCR1B=j;
_delay_ms(small_time);
}
OCR1A=1825;
OCR1B=2225;
_delay_ms(big_time);////////////(X4,Y4)////////////////////////
for(i=1825,j=2225;i<2500&&j>1000;i+=7,j-=10)
{ OCR1A=i;
OCR1B=j;
_delay_ms(small_time);
}
OCR1A=2550;
for(j=1200;j>1100;j-=10)
{ OCR1B=j;
_delay_ms(small_time);
}
for(i=2550;i>2100;i-=10)
{ OCR1A=i;
_delay_ms(small_time);
}
for(i=2100,j=1100;i>895&&j<2125;i-=12,j+=10)
{ OCR1A=i;
OCR1B=j;
_delay_ms(small_time);
}
OCR1A=895;
OCR1B=2125;
_delay_ms(big_time);////////////(X5,Y5)////////////////////////
}
###
Circuit Diagrams
Project Video
Filed Under: Electronic Projects
Filed Under: Electronic Projects
Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.
Tell Us What You Think!!
You must be logged in to post a comment.