SlideShare a Scribd company logo
1 of 12
Download to read offline
The Complet Project
Robotic Arm Based on ATMEGA MCU, Controlled By
Windows C# Application
letselectronic.blogspot.com /2016/07/robotic-arm-based-on-atmega-mcu.html
Hello , Today I m changing my publishing language from French to English for many reasons, one of them the
countries where the followers come from and the first language that is used over there.
For those who want their french versions they have just to ask me Contact Me.
So let's Begin.
Like it is
mentionned in the title of this post, I m going to make a Soft/Hard parts to have finally our Robotic Arm working.
This robotic arm is controlled with :
Soft : Windows Form Application made with C# in Visual Studio 2012.
Atmega 328 like a principale MCU.
The Soft Part was done in Visual Studio 2012, In fact it is a little bit complicated for a beginner programmer because it
include many parts.
More than one only frame
Password/Login Interface
User/Super User interface
Data Base
1/12
How servos work
Serial Communication
More Than One Frame:Because the complexity of the work and also because there is a possibility to add a camera
interface, I chose to implement my work in more than one frame.
Password/Login InterfaceThis one will give the possibility to only registred users to control the robotic arm.
User/Super user interfaceThe super user is like a master because he have the right to modify or delete or even add a
normal user.
Data Basewe want to print and save the position of the robotic arm every 60 secondes in an array composed from 4
collumns (User,Time,Date and Position).
Now the Hard side of this project is how MCU like ATmega 328 is able to control many servo motors in the same time.
We have to know exactly how a MCU could control one servomotor and for this:
I recommend to read this post click me.
How the Soft/Hard Parts will communicate with
each others ?
The answer is UART (universal Asynchrone
Receiver Transmitter) and for those how dont
know it yet, just take a look here Click Me.
Our goal is not to control only one but 4,5,6 or
even more in the same moment. and that's need
a few things to understand like how to manage
the energy and how program will be like.
Let's imagine thats we have a tram including
some data who will be sent from the soft side of
the project and readable in the MCU.
Here the MCU will react with every data one by one, converting every one to an information or order to the servo-
motors.
Why we chose Atmega 328 ?
ATmega 328 is cheaper
than Arduino
Programming ATmega is
easier than PIC or 8051 or
one other MCU.
How Programming ATmega is
easier ?
We are all agree that's programming Arduino is the easier one so let's take advantage from Arduino here.
If you read this:Arduino .
Arduino Uno for exemple is a platform who contains like a principal MCU ATmega 328. so you have just to follow those
steps:
Take out this ATmega 328
Replaced by the one that's we are going to used in your project
2/12
ATmega 328
Arduino/ATmega328 Connection Pin
TTL/Serial Converter
Type your program like you are programming Arduino
Take it back
You have just to remember every I/O in Arduino uno is connected to wich one
in ATmega328.
For that Take a look here
After Programming our MCU, we have to add some electronics composants
to make it work like (Capacitor,Quartz, TTL/Serial Converter,....).
Serial/TTL Converter is the circuit able to make data passed from MCU
readable in the computer. The same comportement in the other direction.
This is The complet Circuit that's you have to do:
And The Program that we will place it ine the MCU's
Mmemory is:
/* Robotic Arm Controlled by C# Windows Application
* Contact Me : Aymenlachkem@gmail.com */
#include <Servo.h>
Servo Servo1, Servo2, Servo3;
String readString, firstString, secondString, thirdString;
int Goal1, Goal2, Goal3;
void setup() {
Serial.begin(9600);
Servo1.attach(9);
Servo2.attach(10);
Servo3.attach(11); 3/12
ROBOTIC ARM BY AYMEN LACHKHEM
Servo3.attach(11);
}
void loop() {
boolean Done = false ;
while (Serial.available()) {
delay(1);
if (Serial.available() >0) {
char c = Serial.read();
readString += c;
} }
if (readString.length() == 1){ONE_BUTTON_CONTROL();}
if (Serial.read() == '9'){if (Done){Serial.write("Done"); }}
if (readString.length() == 9) {Command_Control();}
}
void ONE_BUTTON_CONTROL(){
if (Serial.read() == '7'){
Servo1.write(90);
Servo2.write(90);
Servo3.write(90);
delay(1000);}
if (Serial.read() == '8'){
Servo1.write(0);
Servo2.write(0);
Servo3.write(0);
delay(1000);}
if (Serial.read() == '1')
{
Servo1.write(Servo1.read()+1);
}
if (Serial.read() == '2')
{
Servo1.write(Servo1.read()-1);
}
if (Serial.read() == '3')
{
Servo1.write(Servo2.read()+1);
}
if (Serial.read() == '4')
{
Servo1.write(Servo2.read()-1);
}
if (Serial.read() == '5')
{
Servo1.write(Servo3.read()+1);
}
if (Serial.read() == '6')
{
Servo1.write(Servo3.read()-1);
}
}
void Command_Control(){
{
firstString = readString.substring(0, 3);
secondString = readString.substring(3, 6);
thirdString = readString.substring(6, 9);
char carray1[5];
firstString.toCharArray(carray1, sizeof(carray1));
4/12
firstString.toCharArray(carray1, sizeof(carray1));
Goal1 = atoi(carray1);
char carray2[5];
secondString.toCharArray(carray2, sizeof(carray2));
Goal2 = atoi(carray2);
char carray3[5];
thirdString.toCharArray(carray3, sizeof(carray3));
Goal3= atoi(carray3);
boolean Done = ((Servo1.read() == Goal1) && (Servo2.read() == Goal2) &&
(Servo3.read() == Goal3));
while (!Done) {
int position1 = Servo1.read();
int position2 = Servo2.read();
int position3 = Servo3.read();
if (position1 < Goal1){
Servo1.write(position1 + 1);
}
if (position1 > Goal1){
Servo1.write(position1 - 1);
}
if (position2 < Goal2){
Servo2.write(position2 + 1);
}
if (position2 > Goal2){
Servo2.write(position2 - 1);
}
if (position3 < Goal3){
Servo3.write(position3 + 1);
}
if (position3 > Goal3){
Servo3.write(position3 - 1);
}
delay(20);
}}}
Let's Talk about Soft part of This project :
A windows Application written with C# inside VisualStudio 2012 who have acces to every port Com in the computer will
detect our Circuit Com and control the robotic arm through him
To Make a C# project like i mentionned before there is two part of work to do (Design/Program).
I m working an a new playlist youtube video tutoriel about C# electronic oriented. As soon as possible i will publish it
here.
And here is the robotic Arm Application frame by frame:
5/12
Frame 1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
namespace Robotic_Arm_By_Aymen_Lachkhem
{
public partial class Robotic_Arm_By_Aymen_Lachkhem : Form
{
public Robotic_Arm_By_Aymen_Lachkhem()
{
InitializeComponent();
textBox5.PasswordChar = '*';
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void dateTimePicker1_ValueChanged(object sender, EventArgs e)
{
}
private void button4_Click(object sender, EventArgs e)
6/12
private void button4_Click(object sender, EventArgs e)
{
ProcessStartInfo startInfo = new ProcessStartInfo("iexplore.exe",
"http://https://letselectronic.blogspot.com/p/blog-page.html/");
Process.Start(startInfo);
}
private void button2_Click(object sender, EventArgs e)
{
this.Close();
}
private void button3_Click(object sender, EventArgs e)
{
MessageBox.Show("In Construction");
}
private void button6_Click(object sender, EventArgs e)
{
MessageBox.Show("In Construction");
}
private void button2_Click_1(object sender, EventArgs e)
{
var myLines = new List<string>();
myLines.Add("Hello, This Windows application give their Users the ability to control
serially or with wirless communication a 3 axes robotic arm.");
myLines.Add("- The MCU used is The high-performance Atmel 8-bit AVR RISC-based
microcontroller ATmega 328 ");
myLines.Add("- The Control Application was made in Visual Studio 2012, written using
C# ");
myLines.Add(" ");
myLines.Add("----------------------------------------- Blog: Letselectronic.blogspot.com
-------------------------------------------------------------------------------");
myLines.Add("----------------------------------------- Contact: Aymenlachkem@gmail.com -
-------------------------------------------------------------------------");
myLines.Add("----------------------------------------- Youtube Channel:
Youtube.com/c/AymenLachkem ---------------------------------------------------");
textBox1.Lines = myLines.ToArray();
}
private void Visit_My_Blog_Click(object sender, EventArgs e)
{
ProcessStartInfo startInfo = new ProcessStartInfo("iexplore.exe",
"http://www.letselectronic.blogspot.com/");
Process.Start(startInfo);
}
private void button1_Click(object sender, EventArgs e)
{
Add_user frm = new Add_user();
frm.Show();
}
private void Get_The_Code_Click(object sender, EventArgs e)
{
MessageBox.Show("Just Contact Me :)");
}
private void Login_Click(object sender, EventArgs e)
{
string super_user = "aymen_lachkhem";
string super_pass = "engineer";
if ((textBox4.Text == super_user || textBox4.Text == Add_user.user) && (textBox5.Text
== super_pass || textBox5.Text == Add_user.pass))
{
Main frm = new Main();
7/12
Frame 2
Main frm = new Main();
frm.Show();
MessageBox.Show("Welcome");
}
else
{
MessageBox.Show("Check Again Please");
}
}
}
}
8/12
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Robotic_Arm_By_Aymen_Lachkhem
{
public partial class Add_user : Form
{
public static string user = "0000";
public static string pass = "0000";
public Add_user()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
this.Hide();
}
private void Exit_Click(object sender, EventArgs e)
{
this.Close();
}
private void Register_Click(object sender, EventArgs e)
{
if (textBox4.Text == "" || textBox5.Text == "" || textBox6.Text == "")
{
MessageBox.Show("Please provide User Name and Password");
return;
}
else
{
if (textBox5.Text == textBox6.Text)
{
user = textBox4.Text;
Robotic_Arm_By_Aymen_Lachkhem frm = new Robotic_Arm_By_Aymen_Lachkhem();
pass = textBox5.Text;
Robotic_Arm_By_Aymen_Lachkhem frm1 = new
Robotic_Arm_By_Aymen_Lachkhem();
MessageBox.Show("Welcome");
}
else
{
MessageBox.Show("Differents Passwords");
}
}
}
}
}
9/12
Frame3
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.IO.Ports;
namespace Robotic_Arm_By_Aymen_Lachkhem
{
public partial class Main : Form
{
public Main()
{
InitializeComponent();
getAvailablePorts();
}
void getAvailablePorts()
{
string[] Ports = SerialPort.GetPortNames();
portcom.Items.AddRange(Ports);
}
private void label1_Click(object sender, EventArgs e)
{
}
private void connecter_Click(object sender, EventArgs
e)
{
try
{
if (portcom.Text == "" || baudrate.Text == "")
{
textbox1.Text = "Please select port setting ? ";
}
else
10/12
else
{
serialPort1.PortName = portcom.Text;
serialPort1.BaudRate = Convert.ToInt32(baudrate.Text);
progressBar1.Value = 100;
}
}
catch (UnauthorizedAccessException)
{
baudrate.Text = "Unauthorized Access";
}
}
private void button2_Click(object sender, EventArgs e)
{
serialPort1.Close();
progressBar1.Value = 0;
}
private void button1_Click(object sender, EventArgs e)
{
this.Close();
}
private void annuler_Click(object sender, EventArgs e)
{
this.Hide();
}
private void button4_Click(object sender, EventArgs e)
{
serialPort1.Open();
serialPort1.Write("6");
serialPort1.Close();
}
private void button3_Click(object sender, EventArgs e)
{
serialPort1.Open();
serialPort1.Write("5");
serialPort1.Close();
}
private void button5_Click(object sender, EventArgs e)
{
serialPort1.Open();
serialPort1.Write("3");
serialPort1.Close();
}
private void turn_on_Click(object sender, EventArgs e)
{
serialPort1.Open();
serialPort1.Write("7");
serialPort1.Close();
}
private void turn_off_Click(object sender, EventArgs e)
{
serialPort1.Open();
serialPort1.Write("8");
serialPort1.Close(); serialPort1.Close();
}
private void button10_Click(object sender, EventArgs e)
{
textBox3.Clear(); 11/12
textBox3.Clear();
serialPort1.Open();
serialPort1.Write("9");
string retour = serialPort1.ReadLine();
textBox3.Text += retour + "n";
serialPort1.Close();
}
private void button8_Click(object sender, EventArgs e)
{
serialPort1.Open();
serialPort1.Write("1");
serialPort1.Close();
}
private void button7_Click(object sender, EventArgs e)
{
serialPort1.Open();
serialPort1.Write("2");
serialPort1.Close();
}
private void button6_Click(object sender, EventArgs e)
{
serialPort1.Open();
serialPort1.Write("4");
serialPort1.Close();
}
private void button9_Click(object sender, EventArgs e)
{
serialPort1.Open();
serialPort1.Write(textBox2.Text);
serialPort1.Close();
textBox2.Clear();
}
}
}
I have all files of this project collected in compressed directory so just contact me to have your free files .
See you Soon AYMEN LACHKHEM
12/12

More Related Content

What's hot

Spin Locks and Contention : The Art of Multiprocessor Programming : Notes
Spin Locks and Contention : The Art of Multiprocessor Programming : NotesSpin Locks and Contention : The Art of Multiprocessor Programming : Notes
Spin Locks and Contention : The Art of Multiprocessor Programming : NotesSubhajit Sahu
 
Creation vsm modelos componentes electronicos
Creation vsm   modelos componentes electronicosCreation vsm   modelos componentes electronicos
Creation vsm modelos componentes electronicosjeblanco81
 
Implementing of classical synchronization problem by using semaphores
Implementing of classical synchronization problem by using semaphoresImplementing of classical synchronization problem by using semaphores
Implementing of classical synchronization problem by using semaphoresGowtham Reddy
 
Austin c-c++-meetup-feb2018-spectre
Austin c-c++-meetup-feb2018-spectreAustin c-c++-meetup-feb2018-spectre
Austin c-c++-meetup-feb2018-spectreKim Phillips
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3Jeni Shah
 
Mca ii os u-2 process management & communication
Mca  ii  os u-2 process management & communicationMca  ii  os u-2 process management & communication
Mca ii os u-2 process management & communicationRai University
 
Linux version of PVS-Studio couldn't help checking CodeLite
Linux version of PVS-Studio couldn't help checking CodeLiteLinux version of PVS-Studio couldn't help checking CodeLite
Linux version of PVS-Studio couldn't help checking CodeLitePVS-Studio
 
Miranda NG Project to Get the "Wild Pointers" Award (Part 1)
Miranda NG Project to Get the "Wild Pointers" Award (Part 1) Miranda NG Project to Get the "Wild Pointers" Award (Part 1)
Miranda NG Project to Get the "Wild Pointers" Award (Part 1) Andrey Karpov
 

What's hot (15)

Ardx experimenters-guide-web
Ardx experimenters-guide-webArdx experimenters-guide-web
Ardx experimenters-guide-web
 
Spin Locks and Contention : The Art of Multiprocessor Programming : Notes
Spin Locks and Contention : The Art of Multiprocessor Programming : NotesSpin Locks and Contention : The Art of Multiprocessor Programming : Notes
Spin Locks and Contention : The Art of Multiprocessor Programming : Notes
 
Project02 wit
Project02 witProject02 wit
Project02 wit
 
Creation vsm modelos componentes electronicos
Creation vsm   modelos componentes electronicosCreation vsm   modelos componentes electronicos
Creation vsm modelos componentes electronicos
 
Arduino reference
Arduino referenceArduino reference
Arduino reference
 
Arduino
ArduinoArduino
Arduino
 
0903 1
0903 10903 1
0903 1
 
Implementing of classical synchronization problem by using semaphores
Implementing of classical synchronization problem by using semaphoresImplementing of classical synchronization problem by using semaphores
Implementing of classical synchronization problem by using semaphores
 
Austin c-c++-meetup-feb2018-spectre
Austin c-c++-meetup-feb2018-spectreAustin c-c++-meetup-feb2018-spectre
Austin c-c++-meetup-feb2018-spectre
 
Arduino cic3
Arduino cic3Arduino cic3
Arduino cic3
 
Atmega tutorial
Atmega tutorialAtmega tutorial
Atmega tutorial
 
Computer Science Assignment Help
Computer Science Assignment HelpComputer Science Assignment Help
Computer Science Assignment Help
 
Mca ii os u-2 process management & communication
Mca  ii  os u-2 process management & communicationMca  ii  os u-2 process management & communication
Mca ii os u-2 process management & communication
 
Linux version of PVS-Studio couldn't help checking CodeLite
Linux version of PVS-Studio couldn't help checking CodeLiteLinux version of PVS-Studio couldn't help checking CodeLite
Linux version of PVS-Studio couldn't help checking CodeLite
 
Miranda NG Project to Get the "Wild Pointers" Award (Part 1)
Miranda NG Project to Get the "Wild Pointers" Award (Part 1) Miranda NG Project to Get the "Wild Pointers" Award (Part 1)
Miranda NG Project to Get the "Wild Pointers" Award (Part 1)
 

Similar to Robotic Arm C# ATmega

Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10stemplar
 
Control of Industrial Pneumatic & Hydraulic Systems using Serial Communicatio...
Control of Industrial Pneumatic & Hydraulic Systems using Serial Communicatio...Control of Industrial Pneumatic & Hydraulic Systems using Serial Communicatio...
Control of Industrial Pneumatic & Hydraulic Systems using Serial Communicatio...IJSRD
 
Control of Industrial Pneumatic & Hydraulic Systems using Serial Communicatio...
Control of Industrial Pneumatic & Hydraulic Systems using Serial Communicatio...Control of Industrial Pneumatic & Hydraulic Systems using Serial Communicatio...
Control of Industrial Pneumatic & Hydraulic Systems using Serial Communicatio...IJSRD
 
maXbox Starter 45 Robotics
maXbox Starter 45 RoboticsmaXbox Starter 45 Robotics
maXbox Starter 45 RoboticsMax Kleiner
 
Arduino experimenters guide ARDX
Arduino experimenters guide ARDXArduino experimenters guide ARDX
Arduino experimenters guide ARDXJohnny Parrales
 
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...Sivaranjan Goswami
 
Rodrigo Almeida - Microkernel development from project to implementation
Rodrigo Almeida - Microkernel development from project to implementationRodrigo Almeida - Microkernel development from project to implementation
Rodrigo Almeida - Microkernel development from project to implementationFelipe Prado
 
ma project
ma projectma project
ma projectAisu
 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source codeAndrey Karpov
 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source codePVS-Studio
 
How To make your own Robot And control it using labview
How To make your own Robot And control it using labviewHow To make your own Robot And control it using labview
How To make your own Robot And control it using labviewAymen Lachkhem
 
Buffer overflow tutorial
Buffer overflow tutorialBuffer overflow tutorial
Buffer overflow tutorialhughpearse
 
Basics of Embedded System
Basics of Embedded System Basics of Embedded System
Basics of Embedded System Rajesh Roshan
 
Lab 4 final report
Lab 4 final reportLab 4 final report
Lab 4 final reportKyle Villano
 

Similar to Robotic Arm C# ATmega (20)

Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10Ardx eg-spar-web-rev10
Ardx eg-spar-web-rev10
 
Control of Industrial Pneumatic & Hydraulic Systems using Serial Communicatio...
Control of Industrial Pneumatic & Hydraulic Systems using Serial Communicatio...Control of Industrial Pneumatic & Hydraulic Systems using Serial Communicatio...
Control of Industrial Pneumatic & Hydraulic Systems using Serial Communicatio...
 
Control of Industrial Pneumatic & Hydraulic Systems using Serial Communicatio...
Control of Industrial Pneumatic & Hydraulic Systems using Serial Communicatio...Control of Industrial Pneumatic & Hydraulic Systems using Serial Communicatio...
Control of Industrial Pneumatic & Hydraulic Systems using Serial Communicatio...
 
maXbox Starter 45 Robotics
maXbox Starter 45 RoboticsmaXbox Starter 45 Robotics
maXbox Starter 45 Robotics
 
Arduino experimenters guide ARDX
Arduino experimenters guide ARDXArduino experimenters guide ARDX
Arduino experimenters guide ARDX
 
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
Introduction to Embedded C for 8051 and Implementation of Timer and Interrupt...
 
Unit 7 Java
Unit 7 JavaUnit 7 Java
Unit 7 Java
 
Rodrigo Almeida - Microkernel development from project to implementation
Rodrigo Almeida - Microkernel development from project to implementationRodrigo Almeida - Microkernel development from project to implementation
Rodrigo Almeida - Microkernel development from project to implementation
 
ma project
ma projectma project
ma project
 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source code
 
Static analysis of C++ source code
Static analysis of C++ source codeStatic analysis of C++ source code
Static analysis of C++ source code
 
How To make your own Robot And control it using labview
How To make your own Robot And control it using labviewHow To make your own Robot And control it using labview
How To make your own Robot And control it using labview
 
S044125129
S044125129S044125129
S044125129
 
Modeling and Real-Time Simulation of Induction Motor Using RT-LAB
Modeling and Real-Time Simulation of Induction Motor Using RT-LABModeling and Real-Time Simulation of Induction Motor Using RT-LAB
Modeling and Real-Time Simulation of Induction Motor Using RT-LAB
 
Mp lab manual
Mp lab manualMp lab manual
Mp lab manual
 
Buffer overflow tutorial
Buffer overflow tutorialBuffer overflow tutorial
Buffer overflow tutorial
 
Basics of Embedded System
Basics of Embedded System Basics of Embedded System
Basics of Embedded System
 
OneTeam Media Server
OneTeam Media ServerOneTeam Media Server
OneTeam Media Server
 
Operating System Assignment Help
Operating System Assignment HelpOperating System Assignment Help
Operating System Assignment Help
 
Lab 4 final report
Lab 4 final reportLab 4 final report
Lab 4 final report
 

Recently uploaded

Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.eptoze12
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxDeepakSakkari2
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and usesDevarapalliHaritha
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineeringmalavadedarshan25
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130Suhani Kapoor
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx959SahilShah
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...VICTOR MAESTRE RAMIREZ
 

Recently uploaded (20)

Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.Oxy acetylene welding presentation note.
Oxy acetylene welding presentation note.
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Biology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptxBiology for Computer Engineers Course Handout.pptx
Biology for Computer Engineers Course Handout.pptx
 
power system scada applications and uses
power system scada applications and usespower system scada applications and uses
power system scada applications and uses
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
Internship report on mechanical engineering
Internship report on mechanical engineeringInternship report on mechanical engineering
Internship report on mechanical engineering
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
Application of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptxApplication of Residue Theorem to evaluate real integrations.pptx
Application of Residue Theorem to evaluate real integrations.pptx
 
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
🔝9953056974🔝!!-YOUNG call girls in Rajendra Nagar Escort rvice Shot 2000 nigh...
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...Software and Systems Engineering Standards: Verification and Validation of Sy...
Software and Systems Engineering Standards: Verification and Validation of Sy...
 

Robotic Arm C# ATmega

  • 1. The Complet Project Robotic Arm Based on ATMEGA MCU, Controlled By Windows C# Application letselectronic.blogspot.com /2016/07/robotic-arm-based-on-atmega-mcu.html Hello , Today I m changing my publishing language from French to English for many reasons, one of them the countries where the followers come from and the first language that is used over there. For those who want their french versions they have just to ask me Contact Me. So let's Begin. Like it is mentionned in the title of this post, I m going to make a Soft/Hard parts to have finally our Robotic Arm working. This robotic arm is controlled with : Soft : Windows Form Application made with C# in Visual Studio 2012. Atmega 328 like a principale MCU. The Soft Part was done in Visual Studio 2012, In fact it is a little bit complicated for a beginner programmer because it include many parts. More than one only frame Password/Login Interface User/Super User interface Data Base 1/12
  • 2. How servos work Serial Communication More Than One Frame:Because the complexity of the work and also because there is a possibility to add a camera interface, I chose to implement my work in more than one frame. Password/Login InterfaceThis one will give the possibility to only registred users to control the robotic arm. User/Super user interfaceThe super user is like a master because he have the right to modify or delete or even add a normal user. Data Basewe want to print and save the position of the robotic arm every 60 secondes in an array composed from 4 collumns (User,Time,Date and Position). Now the Hard side of this project is how MCU like ATmega 328 is able to control many servo motors in the same time. We have to know exactly how a MCU could control one servomotor and for this: I recommend to read this post click me. How the Soft/Hard Parts will communicate with each others ? The answer is UART (universal Asynchrone Receiver Transmitter) and for those how dont know it yet, just take a look here Click Me. Our goal is not to control only one but 4,5,6 or even more in the same moment. and that's need a few things to understand like how to manage the energy and how program will be like. Let's imagine thats we have a tram including some data who will be sent from the soft side of the project and readable in the MCU. Here the MCU will react with every data one by one, converting every one to an information or order to the servo- motors. Why we chose Atmega 328 ? ATmega 328 is cheaper than Arduino Programming ATmega is easier than PIC or 8051 or one other MCU. How Programming ATmega is easier ? We are all agree that's programming Arduino is the easier one so let's take advantage from Arduino here. If you read this:Arduino . Arduino Uno for exemple is a platform who contains like a principal MCU ATmega 328. so you have just to follow those steps: Take out this ATmega 328 Replaced by the one that's we are going to used in your project 2/12
  • 3. ATmega 328 Arduino/ATmega328 Connection Pin TTL/Serial Converter Type your program like you are programming Arduino Take it back You have just to remember every I/O in Arduino uno is connected to wich one in ATmega328. For that Take a look here After Programming our MCU, we have to add some electronics composants to make it work like (Capacitor,Quartz, TTL/Serial Converter,....). Serial/TTL Converter is the circuit able to make data passed from MCU readable in the computer. The same comportement in the other direction. This is The complet Circuit that's you have to do: And The Program that we will place it ine the MCU's Mmemory is: /* Robotic Arm Controlled by C# Windows Application * Contact Me : Aymenlachkem@gmail.com */ #include <Servo.h> Servo Servo1, Servo2, Servo3; String readString, firstString, secondString, thirdString; int Goal1, Goal2, Goal3; void setup() { Serial.begin(9600); Servo1.attach(9); Servo2.attach(10); Servo3.attach(11); 3/12
  • 4. ROBOTIC ARM BY AYMEN LACHKHEM Servo3.attach(11); } void loop() { boolean Done = false ; while (Serial.available()) { delay(1); if (Serial.available() >0) { char c = Serial.read(); readString += c; } } if (readString.length() == 1){ONE_BUTTON_CONTROL();} if (Serial.read() == '9'){if (Done){Serial.write("Done"); }} if (readString.length() == 9) {Command_Control();} } void ONE_BUTTON_CONTROL(){ if (Serial.read() == '7'){ Servo1.write(90); Servo2.write(90); Servo3.write(90); delay(1000);} if (Serial.read() == '8'){ Servo1.write(0); Servo2.write(0); Servo3.write(0); delay(1000);} if (Serial.read() == '1') { Servo1.write(Servo1.read()+1); } if (Serial.read() == '2') { Servo1.write(Servo1.read()-1); } if (Serial.read() == '3') { Servo1.write(Servo2.read()+1); } if (Serial.read() == '4') { Servo1.write(Servo2.read()-1); } if (Serial.read() == '5') { Servo1.write(Servo3.read()+1); } if (Serial.read() == '6') { Servo1.write(Servo3.read()-1); } } void Command_Control(){ { firstString = readString.substring(0, 3); secondString = readString.substring(3, 6); thirdString = readString.substring(6, 9); char carray1[5]; firstString.toCharArray(carray1, sizeof(carray1)); 4/12
  • 5. firstString.toCharArray(carray1, sizeof(carray1)); Goal1 = atoi(carray1); char carray2[5]; secondString.toCharArray(carray2, sizeof(carray2)); Goal2 = atoi(carray2); char carray3[5]; thirdString.toCharArray(carray3, sizeof(carray3)); Goal3= atoi(carray3); boolean Done = ((Servo1.read() == Goal1) && (Servo2.read() == Goal2) && (Servo3.read() == Goal3)); while (!Done) { int position1 = Servo1.read(); int position2 = Servo2.read(); int position3 = Servo3.read(); if (position1 < Goal1){ Servo1.write(position1 + 1); } if (position1 > Goal1){ Servo1.write(position1 - 1); } if (position2 < Goal2){ Servo2.write(position2 + 1); } if (position2 > Goal2){ Servo2.write(position2 - 1); } if (position3 < Goal3){ Servo3.write(position3 + 1); } if (position3 > Goal3){ Servo3.write(position3 - 1); } delay(20); }}} Let's Talk about Soft part of This project : A windows Application written with C# inside VisualStudio 2012 who have acces to every port Com in the computer will detect our Circuit Com and control the robotic arm through him To Make a C# project like i mentionned before there is two part of work to do (Design/Program). I m working an a new playlist youtube video tutoriel about C# electronic oriented. As soon as possible i will publish it here. And here is the robotic Arm Application frame by frame: 5/12
  • 6. Frame 1 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Diagnostics; namespace Robotic_Arm_By_Aymen_Lachkhem { public partial class Robotic_Arm_By_Aymen_Lachkhem : Form { public Robotic_Arm_By_Aymen_Lachkhem() { InitializeComponent(); textBox5.PasswordChar = '*'; } private void Form1_Load(object sender, EventArgs e) { } private void dateTimePicker1_ValueChanged(object sender, EventArgs e) { } private void button4_Click(object sender, EventArgs e) 6/12
  • 7. private void button4_Click(object sender, EventArgs e) { ProcessStartInfo startInfo = new ProcessStartInfo("iexplore.exe", "http://https://letselectronic.blogspot.com/p/blog-page.html/"); Process.Start(startInfo); } private void button2_Click(object sender, EventArgs e) { this.Close(); } private void button3_Click(object sender, EventArgs e) { MessageBox.Show("In Construction"); } private void button6_Click(object sender, EventArgs e) { MessageBox.Show("In Construction"); } private void button2_Click_1(object sender, EventArgs e) { var myLines = new List<string>(); myLines.Add("Hello, This Windows application give their Users the ability to control serially or with wirless communication a 3 axes robotic arm."); myLines.Add("- The MCU used is The high-performance Atmel 8-bit AVR RISC-based microcontroller ATmega 328 "); myLines.Add("- The Control Application was made in Visual Studio 2012, written using C# "); myLines.Add(" "); myLines.Add("----------------------------------------- Blog: Letselectronic.blogspot.com -------------------------------------------------------------------------------"); myLines.Add("----------------------------------------- Contact: Aymenlachkem@gmail.com - -------------------------------------------------------------------------"); myLines.Add("----------------------------------------- Youtube Channel: Youtube.com/c/AymenLachkem ---------------------------------------------------"); textBox1.Lines = myLines.ToArray(); } private void Visit_My_Blog_Click(object sender, EventArgs e) { ProcessStartInfo startInfo = new ProcessStartInfo("iexplore.exe", "http://www.letselectronic.blogspot.com/"); Process.Start(startInfo); } private void button1_Click(object sender, EventArgs e) { Add_user frm = new Add_user(); frm.Show(); } private void Get_The_Code_Click(object sender, EventArgs e) { MessageBox.Show("Just Contact Me :)"); } private void Login_Click(object sender, EventArgs e) { string super_user = "aymen_lachkhem"; string super_pass = "engineer"; if ((textBox4.Text == super_user || textBox4.Text == Add_user.user) && (textBox5.Text == super_pass || textBox5.Text == Add_user.pass)) { Main frm = new Main(); 7/12
  • 8. Frame 2 Main frm = new Main(); frm.Show(); MessageBox.Show("Welcome"); } else { MessageBox.Show("Check Again Please"); } } } } 8/12
  • 9. using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace Robotic_Arm_By_Aymen_Lachkhem { public partial class Add_user : Form { public static string user = "0000"; public static string pass = "0000"; public Add_user() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { this.Hide(); } private void Exit_Click(object sender, EventArgs e) { this.Close(); } private void Register_Click(object sender, EventArgs e) { if (textBox4.Text == "" || textBox5.Text == "" || textBox6.Text == "") { MessageBox.Show("Please provide User Name and Password"); return; } else { if (textBox5.Text == textBox6.Text) { user = textBox4.Text; Robotic_Arm_By_Aymen_Lachkhem frm = new Robotic_Arm_By_Aymen_Lachkhem(); pass = textBox5.Text; Robotic_Arm_By_Aymen_Lachkhem frm1 = new Robotic_Arm_By_Aymen_Lachkhem(); MessageBox.Show("Welcome"); } else { MessageBox.Show("Differents Passwords"); } } } } } 9/12
  • 10. Frame3 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.IO.Ports; namespace Robotic_Arm_By_Aymen_Lachkhem { public partial class Main : Form { public Main() { InitializeComponent(); getAvailablePorts(); } void getAvailablePorts() { string[] Ports = SerialPort.GetPortNames(); portcom.Items.AddRange(Ports); } private void label1_Click(object sender, EventArgs e) { } private void connecter_Click(object sender, EventArgs e) { try { if (portcom.Text == "" || baudrate.Text == "") { textbox1.Text = "Please select port setting ? "; } else 10/12
  • 11. else { serialPort1.PortName = portcom.Text; serialPort1.BaudRate = Convert.ToInt32(baudrate.Text); progressBar1.Value = 100; } } catch (UnauthorizedAccessException) { baudrate.Text = "Unauthorized Access"; } } private void button2_Click(object sender, EventArgs e) { serialPort1.Close(); progressBar1.Value = 0; } private void button1_Click(object sender, EventArgs e) { this.Close(); } private void annuler_Click(object sender, EventArgs e) { this.Hide(); } private void button4_Click(object sender, EventArgs e) { serialPort1.Open(); serialPort1.Write("6"); serialPort1.Close(); } private void button3_Click(object sender, EventArgs e) { serialPort1.Open(); serialPort1.Write("5"); serialPort1.Close(); } private void button5_Click(object sender, EventArgs e) { serialPort1.Open(); serialPort1.Write("3"); serialPort1.Close(); } private void turn_on_Click(object sender, EventArgs e) { serialPort1.Open(); serialPort1.Write("7"); serialPort1.Close(); } private void turn_off_Click(object sender, EventArgs e) { serialPort1.Open(); serialPort1.Write("8"); serialPort1.Close(); serialPort1.Close(); } private void button10_Click(object sender, EventArgs e) { textBox3.Clear(); 11/12
  • 12. textBox3.Clear(); serialPort1.Open(); serialPort1.Write("9"); string retour = serialPort1.ReadLine(); textBox3.Text += retour + "n"; serialPort1.Close(); } private void button8_Click(object sender, EventArgs e) { serialPort1.Open(); serialPort1.Write("1"); serialPort1.Close(); } private void button7_Click(object sender, EventArgs e) { serialPort1.Open(); serialPort1.Write("2"); serialPort1.Close(); } private void button6_Click(object sender, EventArgs e) { serialPort1.Open(); serialPort1.Write("4"); serialPort1.Close(); } private void button9_Click(object sender, EventArgs e) { serialPort1.Open(); serialPort1.Write(textBox2.Text); serialPort1.Close(); textBox2.Clear(); } } } I have all files of this project collected in compressed directory so just contact me to have your free files . See you Soon AYMEN LACHKHEM 12/12