Mundarija:
- 1 -qadam: Komponentlarga talab
- 2 -qadam: Gui -ni yuklab oling
- 3 -qadam: ulanish
- 4 -qadam: Dasturiy ta'minotni yuklang va Arduino boshqaruv panelida kod natijasini tekshiring
- 5 -qadam: kontrplak varag'idagi barcha qismlarni loyihalash va chop etish
- 6 -qadam: yig'ish
- 7 -qadam: GBRL sozlamalarini o'rnating
- 8 -qadam: Yakuniy kodni yuklang va Arduino Uno dasturiy ta'minot panelidagi virtual natijani tekshiring
2025 Muallif: John Day | [email protected]. Oxirgi o'zgartirilgan: 2025-01-13 06:58
Men o'quvchilarga katta hajmdagi robototexnika vositalarini buzish va kichik mahalliy ishlab chiqaruvchilarga banklarni buzmasdan o'z jarayonlarida robotlardan foydalanish imkoniyatini berish uchun juda arzon (1000 dollardan kam) sanoat robot qo'lini yasadim. 15 yoshdan 50 yoshgacha bo'lgan odamlarni qurish va qurish oson.
1 -qadam: Komponentlarga talab
1. Arduino + Shield + Pins + Kabellar
2. Motor boshqaruvchisi: dm860A (ebay)
3. Steppermotor: 34hs5435c-37b2 (ebay)
4. M8x45+60+70 murvat va M8 murvat.
5. 12 mm kontrplak.
6. 5 mm neylon.
7. Ko'r yuvish mashinalari 8 mm.
8. Yog'och vintlardek 4,5x40 mm.
9. M3 taymer cho'kdi, 10. 12V quvvat manbai
11. servo dvigatel haydovchi arduino
2 -qadam: Gui -ni yuklab oling
zapmaker.org/projects/grbl-controller-3-0/
github.com/grbl/grbl/wiki/Using-Grbl
3 -qadam: ulanish
Rasmda ko'rsatilgan simlarni ulang - bu siz uchun yaxshiroq tushuncha.
Biz dvigatel drayverini Arduino va sizning robotingizga mos keladigan boshqa ulagichlarga ulashimiz kerak.
4 -qadam: Dasturiy ta'minotni yuklang va Arduino boshqaruv panelida kod natijasini tekshiring
Dasturiy ta'minotni Arduino - GRBL -ga o'rnatish:
github.com/grbl/grbl/wiki/Compiling-Grbl
Eslatma: Arduino -da kompilyatsiya qilishda nizo kelib chiqishi mumkin. Boshqa barcha kutubxonalarni kutubxona papkasidan olib tashlang (../documents/Arduino/libraries).
Dasturiy ta'minotni sozlash
Yangilashni yangi tanaffusga sozlang. Ketma -ket ulanishdan foydalaning va yozing:
$1=255
Homingni sozlash:
$22=1
Seriyani bodga o'rnatishni unutmang: 115200
Foydali G kodlari
Robot uchun nol nuqtani o'rnating:
G10 L2 Xnnn Ynnn Znnn
Nol nuqtadan foydalaning:
G54
Markaziy robotni ishga tushirishning odatiy usuli:
G10 L2 X1.5 Y1.2 Z1.1
G54
Robotni tezda joyiga o'tkazing:
G0 Xnnn Ynnn Znnn
Misol:
G0 X10.0 Y3.1 Z4.2 (qaytish)
Robotni ma'lum tezlikda harakatlantiring:
G1 Xnnn Ynnn Znnn Fnnn
G1 X11 Y3 Z4 F300 (qaytish)
F 10 (slooooow) va 600 (tez) orasida bo'lishi kerak
X, Y va Z uchun standart birliklar
GRBL uchun standart qadam/birlik sozlamalari (250 qadam/birlik) ishlatilganda
800 qadam/aylanish uchun o'rnatilgan qadam haydovchi, barcha o'qlar uchun quyidagi birliklar qo'llaniladi:
+- 32 birlik = +- 180 daraja
Kodni qayta ishlash misoli:
Bu kod to'g'ridan -to'g'ri Arduino GRBL bilan bog'lanishi mumkin.
github.com/damellis/gctrl
Seriyani bodga o'rnatishni unutmang: 115200
Ardunio -dagi kod uoload
java.awt.event. KeyEvent -ni import qilish;
javax.swing. JOptionPane -ni import qilish;
importni qayta ishlash.serial.*;
Seriyali port = null;
// operatsion tizimingizga mos qatorni tanlang va o'zgartiring
// interaktiv portdan foydalanish uchun bo'sh qoldiring (dasturda 'p' tugmasini bosing)
String portname = null;
// String portname = Serial.list () [0]; // Mac OS X
// String portname = "/dev/ttyUSB0"; // Linux
// String portname = "COM6"; // Windows
mantiqiy oqim = noto'g'ri;
suzish tezligi = 0,001;
String gcode;
int i = 0;
void openSerialPort ()
{
agar (portname == null) qaytsa;
if (port! = null) port.stop ();
port = yangi Seriya (bu, port nomi, 115200);
port.bufferUntil ('\ n');
}
void selectSerialPort ()
{
String natijasi = (String) JOptionPane.showInputDialog (bu, "Arduino kartangizga mos keladigan ketma -ket portni tanlang.", "Seriya portini tanlang", JOptionPane. PLAIN_MESSAGE, nol, Serial.list (), 0);
agar (natija! = null) {
port nomi = natija;
openSerialPort ();
}
}
bo'sh o'rnatish ()
{
hajmi (500, 250);
openSerialPort ();
}
bo'sh tortish ()
{
fon (0);
to'ldirish (255);
int y = 24, dy = 12;
matn ("KO'RSATMALAR", 12, y); y += dy;
matn ("p: ketma -ket portni tanlang", 12, y); y += dy;
matn ("1: tezlikni 0,001 dyuym (1 mil) ga sozlash", 12, y); y += dy;
matn ("2: tezlikni 0,010 dyuymga (10 mil) ga o'rnatish", 12, y); y += dy;
matn ("3: tezlikni 0,100 dyuymga (100 mil) ga o'rnatish", 12, y); y += dy;
matn ("o'q tugmachalari: x-y tekisligida yugurish", 12, y); y += dy;
matn ("sahifa yuqoriga va sahifa pastga: z o'qida yugurish", 12, y); y += dy;
matn ("$: display grbl settings", 12, y); y+= dy;
matn ("h: uyga qayt", 12, y); y += dy;
matn ("0: nolli mashina (uyni joriy joyga o'rnatish)", 12, y); y += dy;
matn ("g: g-kodli faylni oqimlash", 12, y); y += dy;
matn ("x: g-kodni uzatishni to'xtating (bu darhol emas)", 12, y); y += dy;
y = balandlik - dy;
matn ("joriy yugurish tezligi:" + tezlik + "dyuymdagi qadam", 12, y); y -= dy;
matn ("joriy ketma -ket port:" + port nomi, 12, y); y -= dy;
}
bo'sh tugma bosildi ()
{
if (key == '1') tezlik = 0,001;
if (key == '2') tezlik = 0,01;
if (key == '3') tezlik = 0,1;
agar (! oqim) {
agar (keyCode == LEFT) port.write ("G91 / nG20 / nG00 X-" + tezlik + "Y0.000 Z0.000 / n");
if (keyCode == RIGHT) port.write ("G91 / nG20 / nG00 X" + tezlik + "Y0.000 Z0.000 / n");
agar (keyCode == UP) port.write ("G91 / nG20 / nG00 X0.000 Y" + tezlik + "Z0.000 / n");
agar (keyCode == DOWN) port.write ("G91 / nG20 / nG00 X0.000 Y-" + tezlik + "Z0.000 / n");
agar (keyCode == KeyEvent. VK_PAGE_UP) port.write ("G91 / nG20 / nG00 X0.000 Y0.000 Z" + tezlik + "\ n");
agar (keyCode == KeyEvent. VK_PAGE_DOWN) port.write ("G91 / nG20 / nG00 X0.000 Y0.000 Z-" + tezlik + "\ n");
// if (key == 'h') port.write ("G90 / nG20 / nG00 X0.000 Y0.000 Z0.000 / n");
agar (key == 'v') port.write ("$ 0 = 75 / n $ 1 = 74 / n $ 2 = 75 / n");
// if (key == 'v') port.write ("$ 0 = 100 / n $ 1 = 74 / n $ 2 = 75 / n");
agar (key == 's)) port.write ("$ 3 = 10 / n");
agar (key == 'e') port.write ("$ 16 = 1 / n");
agar (key == 'd') port.write ("$ 16 = 0 / n");
if (key == '0') openSerialPort ();
if (key == 'p') selectSerialPort () ni tanlang;
agar (key == '$') port.write ("$$ / n");
agar (key == 'h') port.write ("$ H / n");
}
agar (! oqim va& key == 'g') {
gcode = null; i = 0;
Fayl fayli = null;
println ("Fayl yuklanmoqda …");
selectInput ("Qayta ishlash uchun faylni tanlang:", "fileSelected", fayl);
}
if (key == 'x') oqim = noto'g'ri;
}
void fileSelected (Fayl tanlash) {
agar (tanlash == null) {
println ("Oyna yopildi yoki foydalanuvchi bekor qilish tugmasini bosdi.");
} boshqa {
println ("Foydalanuvchi tanlandi" + selection.getAbsolutePath ());
gcode = loadStrings (selection.getAbsolutePath ());
agar (gcode == null) qaytish;
oqim = rost;
oqim();
}
}
bo'sh oqim ()
{
agar (! oqim) qaytsa;
while (rost) {
agar (i == gcode.length) {
oqim = noto'g'ri;
qaytish;
}
if (gcode .trim (). length () == 0) i ++;
boshqa tanaffus;
}
println (gcode );
port.write (gcode + '\ n');
i ++;
}
bekor serialEvent (Seriya p)
{
Satr s = p.readStringUntil ('\ n');
println (s.trim ());
if (s.trim (). boshlanadiWith ("ok")) stream ();
if (s.trim (). beginWith ("xato")) stream (); // XXX: haqiqatan ham?
}
5 -qadam: kontrplak varag'idagi barcha qismlarni loyihalash va chop etish
Robot qismi va dizaynini AutoCAD -ga yuklab oling va 12 mm kontrplak varag'i va tugatish va dizayn qismini chop eting. Agar kimdir cad fayliga muhtoj bo'lsa, plzni sharhlar bo'limiga qoldiring, men siz yuborasiz.
6 -qadam: yig'ish
barcha qismlarni yig'ing va berilgan rasmni ketma -ketlikda joylashtiring va rasm diagrammasiga amal qiling.
7 -qadam: GBRL sozlamalarini o'rnating
Bu bizning robotlarimizda ishlashini isbotladi.
$ 0 = 10 (qadam pulsi, usec) $ 1 = 255 (qadam bo'sh kechikish, msec) $ 2 = 7 (qadam portining teskari niqobi: 00000111) $ 3 = 7 (dir port invert niqobi: 00000111) $ 4 = 0 (qadamni teskari burish, bool $ 5 = 0 (chegara pinlari teskari, bool) $ 6 = 1 (prob pin invert, bool) $ 10 = 3 (holat hisoboti niqobi: 00000011) $ 11 = 0,020 (birlashma og'ishi, mm) $ 12 = 0,002 (kamon bardoshliligi, mm) $ 13 = 0 (hisob dyuym, bool) $ 20 = 0 (yumshoq chegaralar, bool) $ 21 = 0 (qattiq chegaralar, bool) $ 22 = 1 (homing tsikli, bool) $ 23 = 0 (homing dir invert niqobi: 00000000) $ 24 = 100.000 (homing ozuqasi, mm/min) $ 25 = 500.000 (homing qidirish, mm/min) $ 26 = 250 (homing debounce, msec) $ 27 = 1.000 (homing pull-off, mm) $ 100 = 250.000 (x, qadam/mm) $ 101 = 250.000 (y, qadam/mm) $ 102 = 250.000 (z, qadam/mm) $ 110 = 500.000 (x maksimal tezlik, mm/min) $ 111 = 500.000 (y maksimal tezlik, mm/min) $ 112 = 500.000 (z maksimal tezlik, mm/min) $ 120 = 10.000 (x tezlik, mm/sek^2) $ 121 = 10.000 (y tezlik, mm/sek^2) $ 122 = 10.000 (z tezlik, mm/sek^2) $ 130 = 200.000 (x maksimal sayohat, mm) $ 131 = 200.000 (y maksimal sayohat, mm) $ 132 = 200.000 (z maksimal sayohat, mm)
8 -qadam: Yakuniy kodni yuklang va Arduino Uno dasturiy ta'minot panelidagi virtual natijani tekshiring
// Birliklar: CM
float b_height = 0;
float a1 = 92;
float a2 = 86;
float snude_len = 20;
mantiqiy doZ = noto'g'ri;
float base_angle; // = 0;
suzuvchi qo'l1_angle; // = 0;
suzuvchi qo'l2_angle; // = 0;
float bx = 60; // = 25;
float = 60; // = 0;
float bz = 60; // = 25;
float x = 60;
float y = 60;
float z = 60;
suzuvchi q;
suzuvchi c;
suzuvchi V1;
suzuvchi V2;
suzuvchi V3;
suzuvchi V4;
suzuvchi V5;
bo'sh o'rnatish () {
hajmi (700, 700, P3D);
cam = yangi PeasyCam (bu, 300);
cam.setMinimumDistance (50);
cam.setMaximumDistance (500);
}
bekor chizish () {
// bog'lovchi:
y = (mouseX - kenglik/2)*(- 1);
x = (mouseY - balandlik/2)*(- 1);
bz = z;
tomonidan = y;
bx = x;
float y3 = sqrt (bx*bx+by*ga);
c = sqrt (y3*y3 + bz*bz);
V1 = akos ((a2*a2+a1*a1-c*c)/(2*a2*a1));
V2 = akos ((c*c+a1*a1-a2*a2)/(2*c*a1));
V3 = acos ((y3*y3+c*c-bz*bz)/(2*y3*c));
q = V2 + V3;
arm1_angle = q;
V4 = radianlar (90,0) - q;
V5 = radian (180) - V4 - radian (90);
arm2_angle = radian (180.0) - (V5 + V1);
base_angle = daraja (atan2 (bx, by));
arm1_angle = daraja (arm1_angle);
arm2_angle = daraja (arm2_angle);
// println (by, bz);
// arm1_angle = 90;
// arm2_angle = 45;
/*
arm2_angle = 23;
arm1_angle = 23;
arm2_angle = 23;
*/
// interaktiv:
// agar (doZ)
//
// {
// tayanch_burchak = tayanch_burchak+ sichqonX-pmouseX;
//} boshqa
// {
// arm1_angle = arm1_angle+ pmouseX-mouseX;
// }
//
// arm2_angle = arm2_angle+ mouseY-pmouseY;
draw_robot (tayanch_burchak,-(arm1_angle-90), arm2_angle+90-(-(arm1_angle-90)));
// println (tayanch_burchak + "," + qo'l1_burchak + "," + qo'l2_burchak);
}
void draw_robot (float base_angle, float arm1_angle, float arm2_angle)
{
rotateX (1.2);
aylantirishZ (-1.2);
fon (0);
chiroqlar ();
pushMatrix ();
// BAZA
to'ldirish (150, 150, 150);
box_corner (50, 50, b_height, 0);
aylantirish (radianlar (tayanch_burchak), 0, 0, 1);
// ARM 1
to'ldirish (150, 0, 150);
box_corner (10, 10, a1, arm1_angle);
// ARM 2
to'ldirish (255, 0, 0);
box_corner (10, 10, a2, arm2_angle);
// SNUDE
to'ldirish (255, 150, 0);
quti burchagi (10, 10, snude_len, -arm1_angle -arm2_angle+90);
popMatrix ();
pushMatrix ();
float action_box_size = 100;
tarjima qilish (0, -action_box_size/2, action_box_size/2+b_height);
pushMatrix ();
tarjima qilish (x, action_box_size- y-action_box_size/2, z-action_box_size/2);
to'ldirish (255, 255, 0);
quti (20);
popMatrix ();
to'ldirish (255, 255, 255, 50);
quti (action_box_size, action_box_size, action_box_size);
popMatrix ();
}
void box_corner (float w, float h, float d, float aylantirish)
{
aylantirish (radianlar (aylantirish), 1, 0, 0);
tarjima qilish (0, 0, d/2);
quti (w, h, d);
tarjima qilish (0, 0, d/2);
}
void tugmasi bosildi ()
{
agar (kalit == 'z')
{
doZ =! doZ;
}
agar (kalit == 'h')
{
// barchasini nolga qo'ying
arm2_angle = 0;
arm1_angle = 90;
tayanch_angle = 0;
}
agar (kalit == 'g')
{
println (daraja (V1));
println (daraja (V5));
}
agar (keyCode == UP)
{
z ++;
}
agar (keyCode == DOWN)
{
z -;
}
agar (kalit == 'o')
{
y = 50;
z = 50;
println (q);
println (c, "c");
println (V1, "V1");
println (V2);
println (V3);
println (arm1_angle);
println (V4);
println (V5);
println (arm2_angle);
}
}