Cov txheej txheem:

Arduino Base Pick and Place Robot: 8 Kauj Ruam
Arduino Base Pick and Place Robot: 8 Kauj Ruam

Video: Arduino Base Pick and Place Robot: 8 Kauj Ruam

Video: Arduino Base Pick and Place Robot: 8 Kauj Ruam
Video: You can learn Arduino in 15 minutes. 2024, Hlis ntuj nqeg
Anonim
Arduino Base Xaiv thiab Muab Neeg Hlau
Arduino Base Xaiv thiab Muab Neeg Hlau
Arduino Base Xaiv thiab Muab Neeg Hlau
Arduino Base Xaiv thiab Muab Neeg Hlau
Arduino Base Xaiv thiab Muab Neeg Hlau
Arduino Base Xaiv thiab Muab Neeg Hlau

Kuv tau ua tus nqi pheej yig tshaj (tsawg dua 1000 daus las) cov cuab yeej neeg hlau tsim los pab cov tub ntxhais kawm txhawm rau hack cov neeg hlau loj dua thiab kom muaj peev xwm tsim khoom hauv zos me me los siv cov neeg hlau hauv lawv cov txheej txheem yam tsis ua txhaum lub txhab nyiaj. Nws Eassy los tsim thiab ua rau pawg neeg hnub nyoog ntawm 15 txog 50 xyoo.

Kauj Ruam 1: Cov Cheeb Tsam Yuav Tsum Tau

Cheeb Tsam Yuav Tsum Tau
Cheeb Tsam Yuav Tsum Tau
Cheeb Tsam Yuav Tsum Tau
Cheeb Tsam Yuav Tsum Tau
Cheeb Tsam Yuav Tsum Tau
Cheeb Tsam Yuav Tsum Tau
Cheeb Tsam Yuav Tsum Tau
Cheeb Tsam Yuav Tsum Tau

1. Arduino + Shield + Pins + Cables

2. Tus neeg tsav tsheb: dm860A (Ebay)

3. Steppermotor: 34hs5435c-37b2 (Ebay)

4. M8x45+60+70 bolts thiab M8 bolts.

5. 12 hli Plywood.

6. 5 hli Nylon.

7. Qhov muag tsis pom kev 8 hli.

8. Ntoo Screws 4.5x40mm.

9. M3 Counter sunk, 10. 12v fais fab mov

11. servo motor tsav tsheb arduino

Kauj ruam 2: Download Gui

zapmaker.org/projects/grbl-controller-3-0/

github.com/grbl/grbl/wiki/Using-Grbl

Kauj ruam 3: Kev sib txuas

Kev sib txuas
Kev sib txuas
Kev sib txuas
Kev sib txuas
Kev sib txuas
Kev sib txuas

Txuas cov xov hlau uas tau muab hauv daim duab yog kev nkag siab ntau dua rau koj.

peb yuav tsum txuas tus tsav tsheb mus rau Arduino thiab lwm qhov txuas uas xav tau raws li koj tus neeg hlau.

Kauj Ruam 4: Tshaj Tawm Firmware thiab Txheeb Cov Code tshwm sim hauv Arduino Dashboard

Txhim kho lub firmware ntawm Arduino - GRBL:

github.com/grbl/grbl/wiki/Compiling-Grbl

Nco tseg: Koj tuaj yeem tau txais kev tsis sib haum thaum suav sau hauv Arduino. Tshem tag nrho lwm lub tsev qiv ntawv los ntawm koj lub tsev qiv ntawv nplaub tshev (../documents/Arduino/libraries).

Teeb tsa firmware

Teem pab kom ncua sijhawm tshiab dua. Siv qhov txuas txuas thiab sau:

$1=255

Teeb homing:

$22=1

Nco ntsoov teeb serial rau baud: 115200

Muaj txiaj ntsig G-cov lej

Teeb xoom taw tes rau neeg hlau:

G10 L2 Xnnn Ynnn Znnn

Siv zero point:

G54

Raug pib ua rau nruab nrab neeg hlau:

G10 L2 X1.5 Y1.2 Z1.1

G54

Tsiv neeg hlau mus rau txoj haujlwm nrawm:

G0 Xnnn Ynnn Znnn

Piv txwv:

G0 X10.0 Y3.1 Z4.2 (rov qab)

Tsiv neeg hlau mus rau txoj haujlwm ntawm qhov nrawm:

G1 Xnnn Ynnn Znnn Fnnn

G1 X11 Y3 Z4 F300 (rov qab los)

F yuav tsum nyob nruab nrab ntawm 10 (slooooow) thiab 600 (nrawm)

Default units rau X, Y thiab Z

Thaum siv cov kauj ruam pib/ntu teeb tsa (250 kauj ruam/chav) rau GRBL thiab

stepper tsav teeb tsa rau 800 kauj ruam/rev cov hauv qab no siv rau txhua lub axis:

+- 32 units = +- 180 degrees

Ua tus piv txwv piv txwv:

Txoj cai no tuaj yeem sib tham ncaj qha nrog Arduino GRBL.

github.com/damellis/gctrl

Nco ntsoov teeb serial rau baud: 115200

Code nyob rau hauv qhov kev pab cuam

ntshuam java.awt.event. KeyEvent;

ntshuam javax.swing. JOptionPane;

ntshuam ua.serial.*;

Serial chaw nres nkoj = tsis muaj;

// xaiv thiab hloov kho kab tsim nyog rau koj lub operating system

// tawm raws li tsis siv lub chaw nres nkoj sib tham (nias 'p' hauv qhov program)

String portname = tsis muaj;

// String portname = Serial.list () [0]; // Mac OS X

// String portname = "/dev/ttyUSB0"; // Linux

// String portname = "COM6"; // Qhov rai

boolean streaming = tsis tseeb;

ntab ceev = 0.001;

Txoj hlua gcode;

int kuv = 0;

tsis muaj dab tsi openSerialPort ()

{

yog (portname == null) rov qab;

yog (chaw nres nkoj! = tsis muaj) port.stop ();

chaw nres nkoj = Serial tshiab (qhov no, npe chaw nyob, 115200);

port.bufferUntil ('\ n');

}

tsis muaj dab tsi selectSerialPort ()

{

String result = (String) JOptionPane.showInputDialog (qhov no, "Xaiv qhov chaw nres nkoj uas sib haum rau koj li Arduino board.", "Xaiv qhov chaw nres nkoj", JOptionPane. PLAIN_MESSAGE, tsis muaj, Serial.list (), 0);

yog (qhov tshwm sim! = tsis muaj) {

portname = tshwm sim;

openSerialPort ();

}

}

void teeb tsa ()

{

loj (500, 250);

openSerialPort ();

}

void kos ()

{

keeb kwm yav dhau (0);

sau (255);

int y = 24, dy = 12;

text ("INSTRUCTIONS", 12, y); y += dy;

text ("p: xaiv qhov chaw nres nkoj", 12, y); y += dy;

text ("1: teeb tsa nrawm rau 0.001 ntiv tes (1 mil) rau ib qho jog", 12, y); y += dy;

ntawv ("2: teeb tsa nrawm rau 0.010 ntiv tes (10 mil) rau ib qho jog", 12, y); y += dy;

ntawv ("3: teeb tsa nrawm rau 0.100 ntiv tes (100 lab) rau ib qho jog", 12, y); y += dy;

text ("xub tuav: khiav hauv x-y dav hlau", 12, y); y += dy;

text ("nplooj ntawv nce & nplooj ntawv qis: khiav hauv z axis", 12, y); y += dy;

text ("$: display grbl settings", 12, y); y+= dy;

ntawv ("h: mus tsev", 12, y); y += dy;

text ("0: xoom tshuab (teeb tsa lub tsev mus rau qhov chaw tam sim no)", 12, y); y += dy;

text ("g: kwj cov ntaub ntawv g-code", 12, y); y += dy;

ntawv ("x: nres streaming g-code (qhov no tsis yog tam sim)", 12, y); y += dy;

y = qhov siab - dy;

text ("khiav ceev tam sim no:" + nrawm + "ntiv tes ib kauj ruam", 12, y); y -= dy;

text ("chaw nres nkoj tam sim no:" + portname, 12, y); y -= dy;

}

tsis muaj qhov tseem ceeb Pressed ()

{

yog (qhov tseem ceeb == '1') nrawm = 0.001;

yog (qhov tseem ceeb == '2') ceev = 0.01;

yog (qhov tseem ceeb == '3') ceev = 0.1;

yog tias (! streaming) {

yog (keyCode == LEFT) port.write ("G91 / nG20 / nG00 X-" + ceev + "Y0.000 Z0.000 / n");

yog (keyCode == RIGHT) port.write ("G91 / nG20 / nG00 X" + ceev + "Y0.000 Z0.000 / n");

yog (keyCode == UP) port.write ("G91 / nG20 / nG00 X0.000 Y" + ceev + "Z0.000 / n");

yog (keyCode == DOWN) port.write ("G91 / nG20 / nG00 X0.000 Y-" + ceev + "Z0.000 / n");

yog (keyCode == KeyEvent. VK_PAGE_UP) port.write ("G91 / nG20 / nG00 X0.000 Y0.000 Z" + ceev + "\ n");

yog (keyCode == KeyEvent. VK_PAGE_DOWN) port.write ("G91 / nG20 / nG00 X0.000 Y0.000 Z-" + speed + "\ n");

// if (key == 'h') port.write ("G90 / nG20 / nG00 X0.000 Y0.000 Z0.000 / n");

yog (qhov tseem ceeb == '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");

yog (qhov tseem ceeb == 's') port.write ("$ 3 = 10 / n");

yog (qhov tseem ceeb == 'e') port.write ("$ 16 = 1 / n");

yog (qhov tseem ceeb == 'd') port.write ("$ 16 = 0 / n");

yog (qhov tseem ceeb == '0') openSerialPort ();

yog (qhov tseem ceeb == 'p') selectSerialPort ();

yog (qhov tseem ceeb == '$') port.write ("$$ / n");

yog (qhov tseem ceeb == 'h') port.write ("$ H / n");

}

yog (! streaming && qhov tseem ceeb == 'g') {

gcode = tsis muaj; kuv = 0;

Cov ntaub ntawv file = null;

println ("Loading file …"); cov.

selectInput ("Xaiv cov ntawv los ua:", "fileSelected", file);

}

yog (qhov tseem ceeb == 'x') streaming = tsis tseeb;

}

void fileSelected (Xaiv cov ntaub ntawv) {

yog (xaiv == null) {

println ("Qhov rai raug kaw lossis tus neeg siv raug tshem tawm.");

lwm yam {

println ("Tus neeg siv xaiv" + xaiv.getAbsolutePath ());

gcode = loadStrings (xaiv.getAbsolutePath ());

yog (gcode == null) rov qab;

streaming = tseeb;

kwj ();

}

}

tsis muaj kwj ()

{

yog (! streaming) rov qab;

thaum (muaj tseeb) {

yog (kuv == gcode.length) {

streaming = tsis tseeb;

rov qab;

}

yog (gcode .trim (). ntev () == 0) i ++;

lwm yam tawg;

}

println (gcode [kuv]);

port.write (gcode [kuv] + '\ n');

kuv ++;

}

tsis muaj dab tsi serialEvent (Serial p)

{

Txoj hlua s = p.readStringUntil ('\ n');

println (s.trim ()); cov.

yog (s.trim (). pibWith ("ok")) kwj ();

yog (s.trim (). pibWith ("yuam kev")) kwj (); // XXX: tiag?

}

Kauj Ruam 5: Tsim thiab Sau Txhua Qhov Hauv Plywood Sheet

Tsim thiab Sau Txhua Qhov Hauv Plywood Sheet
Tsim thiab Sau Txhua Qhov Hauv Plywood Sheet

Rub tus neeg hlau ib feem thiab tsim qauv hauv AutoCAD thiab luam tawm ntawm daim ntawv 12 hli plywood thiab ua tiav thiab tsim ib feem. Yog tias leej twg xav tau cad cov ntaub ntawv plz tawm cov lus pom hauv kab lus hauv seem kuv yuav 'koj xa ncaj qha.

Kauj Ruam 6: Sib dhos

Los ua ke
Los ua ke
Los ua ke
Los ua ke

sau txhua feem thiab npaj ua ntu zuj zus ntawm cov duab uas tau muab thiab ua raws daim duab duab.

Kauj Ruam 7: Teeb GBRL Chaw

Kev teeb tsa uas tau ua pov thawj los ua haujlwm ntawm peb cov neeg hlau.

$ 0 = 10 (kauj ruam mem tes, sivc) $ 1 = 255 (kauj ruam qeeb qeeb, msec) $ 2 = 7 (kauj ruam chaw nres nkoj invert daim npog: 00000111) $ 3 = 7 (dir chaw nres nkoj invert daim npog: 00000111) $ 4 = 0 (kauj ruam pab kom invert, bool) $ 5 = 0 (txwv pins invert, bool) $ 6 = 1 (sojntsuam tus pin invert, bool) $ 10 = 3 (xwm txheej daim npog ntsej muag: 00000011) $ 11 = 0.020 (kev sib cais sib txawv, hli) $ 12 = 0.002 (arc kam rau ua, hli) $ 13 = 0 (qhia cov ntiv tes, bool) $ 20 = 0 (txwv tsis pub, bool) $ 21 = 0 (txwv tsis pub, bool) $ 22 = 1 (homing voj voog, bool) $ 23 = 0 (homing dir invert daim npog: 00000000) $ 24 = 100.000 (homing pub, mm/min) $ 25 = 500,000 (homing nrhiav, mm/min) $ 26 = 250 (homing debounce, msec) $ 27 = 1.000 (homing rub tawm, hli) $ 100 = 250,000 (x, kauj ruam/hli) $ 101 = 250.000 (y, kauj ruam/hli) $ 102 = 250.000 (z, kauj ruam/hli) $ 110 = 500.000 (x tus nqi siab tshaj, hli/min) $ 111 = 500.000 (y nqi npaum cas, hli/min) $ 112 = 500.000 (z tus nqi siab tshaj, mm/min) $ 120 = 10,000 (x accel, mm/sec^2) $ 121 = 10,000 (y accel, mm/sec^2) $ 122 = 10,000 (z accel, mm/sec^2) $ 130 = 200,000 (x mus ncig tshaj, hli) $ 131 = 200.000 (y max travel, mm) $ 132 = 200.000 (z max mus, mm)

Kauj Ruam 8: Tshaj Tawm Txoj Cai Kawg thiab Txheeb Xyuas Qhov Ua Tau Zoo hauv Arduino Uno Software Dashboard

// Chav nyob: CM

ntab b_height = 0;

ntab a1 = 92;

ntab a2 = 86;

ntab snude_len = 20;

boolean doZ = tsis tseeb;

ntab base_angle; // = 0;

ntab arm1_angle; // = 0;

ntab arm2_angle; // = 0;

ntab bx = 60; // = 25;

ntab los ntawm = 60; // = 0;

ntab bz = 60; // = 25;

ntab x = 60;

ntab y = 60;

ntab z = 60;

ploj q;.

ploj c;

ploj V1;

ploj V2;

cev v3;.

cev v4;.

cev v5;.

void teeb tsa () {

loj (700, 700, P3D);

cam = tshiab PeasyCam (qhov no, 300);

cam.setMinimumDistance (50);

cam.setMaximumDistance (500);

}

void kos () {

// ligninger: cov

y = (mouseX - dav/2)*(- 1);

x = (mouseY - qhov siab/2)*(- 1);

zz = zz;

los = y;

bx = x;

ntab y3 = sqrt (bx*bx+by*by);

c = sqrt (y3*y3 + bz*bz);

V1 = acos ((a2*a2+a1*a1-c*c)/(2*a2*a1));

V2 = acos ((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 = radians (90.0) - q;

V5 = radians (180) - V4 - radians (90);

arm2_angle = radians (180.0) - (V5 + V1);

base_angle = degrees (atan2 (bx, los ntawm));

arm1_angle = qib (arm1_angle);

arm2_angle = qib (arm2_angle);

// println (los ntawm, bz);

// arm1_angle = 90;

// arm2_angle = 45;

/*

arm2_angle = 23;

arm1_angle = 23;

arm2_angle = 23;

*/

// sib tham sib:

// yog (doZ)

//

// {

// base_angle = base_angle+ mouseX-pmouseX;

//} lwm tus

// {

// arm1_angle = arm1_angle+ pmouseX-mouseX;

// }

//

// arm2_angle = arm2_angle+ mouseY-pmouseY;

draw_robot (puag_angle,-(arm1_angle-90), arm2_angle+90-(-(arm1_angle-90))));

// println (puag_angle + "," + arm1_angle + "," + arm2_angle);

}

void draw_robot (ntab puag_angle, ntab arm1_angle, ntab arm2_angle)

{

tig X (1.2);

tig Z (-1.2);

keeb kwm yav dhau (0);

teeb ();

pushMatrix ();

// LOJ

sau (150, 150, 150);

box_corner (50, 50, b_height, 0);

tig (radians (base_angle), 0, 0, 1);

// ARM 1

sau (150, 0, 150);

box_corner (10, 10, a1, arm1_angle);

// ARM 2

sau (255, 0, 0);

box_corner (10, 10, a2, arm2_angle);

// NTSE

sau (255, 150, 0);

box_corner (10, 10, snude_len, -arm1_angle -arm2_angle+90);

popMatrix ();

pushMatrix ();

ntab action_box_size = 100;

txhais (0, -action_box_size/2, action_box_size/2+b_height);

pushMatrix ();

txhais (x, action_box_size- y-action_box_size/2, z-action_box_size/2);

sau (255, 255, 0);

lub thawv (20);

popMatrix ();

sau (255, 255, 255, 50);

lub thawv (action_box_size, action_box_size, action_box_size);

popMatrix ();

}

tsis muaj dab tsi box_corner (ntab w, ntab h, ntab d, ntab tig)

{

tig (radians (tig), 1, 0, 0);

txhais lus (0, 0, d/2);

lub thawv (w, h, d);

txhais lus (0, 0, d/2);

}

tsis muaj qhov tseem ceeb Pressed ()

{

yog (qhov tseem ceeb == 'z')

{

doZ =! doZ;

}

yog (qhov tseem ceeb == 'h')

{

// teeb tsa tag nrho rau xoom

arm2_angle = 0;

arm1_angle = 90;

base_angle = 0;

}

yog (qhov tseem ceeb == 'g')

{

println (qib (V1)));

println (qib (V5));

}

yog (keyCode == UP)

{

z ++;

}

yog (keyCode == DOWN)

{

z -yog;

}

yog (qhov tseem ceeb == 'o')

{

y = 50;

z = 50;

println (qw);

println (c, "c"); cov.

println (V1, "V1"); cov.

println (V2); cov.

println (V3);

println (arm1_angle);

println (V4); cov.

println (V5);

println (arm2_angle);

}

}

Pom zoo: