Cov txheej txheem:

Lub Teeb Tswj Lub Cev Stepper Tsav + Phab Ntsa Bracket/Sawv: 6 Kauj Ruam
Lub Teeb Tswj Lub Cev Stepper Tsav + Phab Ntsa Bracket/Sawv: 6 Kauj Ruam

Video: Lub Teeb Tswj Lub Cev Stepper Tsav + Phab Ntsa Bracket/Sawv: 6 Kauj Ruam

Video: Lub Teeb Tswj Lub Cev Stepper Tsav + Phab Ntsa Bracket/Sawv: 6 Kauj Ruam
Video: Vaajtswv Txuj Lug Yog Lub Teeb Ci Pumkev || Nkauj Ntseeg 2024, Hlis ntuj nqeg
Anonim
Lub teeb tswj Stepper Tsav + Phab Ntsa Bracket/Sawv
Lub teeb tswj Stepper Tsav + Phab Ntsa Bracket/Sawv

Lub rooj muag khoom no yog siv los tsev Arduino tswj lub tshuab hluav taws xob, tsim los tswj cov ntaub thaiv raws li qib teeb nyob hauv chav. Koj tseem tuaj yeem ntxiv lub vijtsam LCD los luam tawm lub teeb ci. Lub iav 3D tsuas yog siv rau kev ua qauv qhia, yuav tsum muaj lub iav tiag tiag rau daim ntawv thov xws li daim ntaub thaiv tab sis kuj tseem muaj lwm daim ntawv thov uas koj tuaj yeem xav txog.

Kauj ruam 1: Cov khoom xyaw

Txhawm rau pib txoj haujlwm no koj yuav xav tau;

- 2 Arduino nti-teeb- Ib qho Arduino lub cev muaj zog tiv thaiv- Ib qho Arduino LCD Screen- 1 Breadboard- 1 bi-polar Stepper Motor- 1 D roj teeb- 1 Lub Teeb Pom Kev Tiv Thaiv- 1 10k Ω Resistor- 10 Txiv neej-txiv neej xov tooj -6 Txiv neej- poj niam xov hlau- Nkag mus rau lub tshuab luam ntawv 3D

Kauj Ruam 2: Kev tsim kho ntawm Arduino

Kev tsim kho ntawm Arduino
Kev tsim kho ntawm Arduino

Thawj kab ntawm lub cev tiv thaiv kab mob nrog Arduino pins thiab thaum lawv nyob nraum kab, tso nws khov kho. Tom ntej txuas tus stepper lub cev muaj zog cov xov hlau rau hauv tus pin 8, 9, 10 thiab 11 ntawm lub tshuab tiv thaiv lub cev. Tom qab ntawd txuas D roj teeb hauv qhov qhib raws li qhia hauv daim duab. Tom ntej no koj yuav xav tau 6 xov hlau (txiv neej rau poj niam) rau lub vijtsam LCD thiab txuas lawv mus rau lwm chav Arduino raws li qhia hauv daim duab qhia chaw, tom qab ntawd teeb tsa LDR raws li qhia saum toj no, nrog tus tiv thaiv txuas mus rau kab tsis zoo. Thaum ntxiv LDR, ntawm sab nrog tus tiv thaiv, ntxiv A0 kev sib txuas thiab ntawm qhov rov qab, ntxiv 1 5V cov tswv yim rau txhua lub rooj tsav xwm uas koj tab tom siv, yog li yog koj siv 2 pawg, koj yuav xav kom txhua tus muaj 5V thiab A0 tus pin mus rau LDR.

Txuas tag nrho cov xov hlau kom nws zoo ib yam li daim duab -2 Cov tswv yim rau LDR- 2 Cov Lus Tawm los ntawm LDR thiab cov tiv thaiv txuas rau hauv av- 8 xov hlau mus rau LCD, 1 5V, 1 Hauv av thiab 6 cov tswv yim-4 xov hlau txuas rau stepper- 2 txuas rau lub roj teeb- Cov qhob cij hauv av yuav tsum txuas nrog

Kauj Ruam 3: Coding Arduino

Coding Arduino
Coding Arduino

Nov yog qee qhov qauv piv txwv los hloov qhov xwm txheej ntawm lub iav raws li LDR

Nov yog txoj cai uas yuav tso cai rau txoj haujlwm kom tswj tau daim ntaub thaiv. Daim duab saum toj no piav qhia txoj hauv kev sib txawv los ntawm cov kab zauv IF hais txog ntawm daim ntaub thaiv kom nce, nqis lossis nyob qhov twg nws nyob. (nyem rau ntawm daim duab kom pom tag nrho vim muaj teeb meem kev teeb tsa)

#defineLDRA0 // Txhais qhov sib txawv "LDR" rau A0 tus pin#suav nrog// Xws li tus lej tsav tsheb

constintstepsPerRevolution = 200; // Thaum stepper lub cev muaj zog tau qhib, nws tag nrho kev sib hloov yog sib npaug rau 200 cov kauj ruam

SteppermyStepper (stepsPerRevolution, 8, 9, 10, 11); // Txhais cov tswv yim rau tus stepper li tus pin 8, 9, 10, 11

voidsetup () {myStepper.setSpeed (60); // Teem nrawm npaum li cas lub cav ua lub tshuab tig tig (LDR, INPUT); // Txhais qhov sib txawv "LDR" raws li kev nkag mus Serial.begin (9600); // Pib nyeem ntawv ib ntus }

voidloop () {intlightlevel = analogRead (LDR); // Txhais qhov sib txawv "lightlevel" raws li qhov kev txiav txim uas nyeem tus nqi ntawm "LDR" Serial.print ("Lub teeb theem:"); Serial.println (lub teeb); // Luam tawm tus nqi ntawm "qib qis" nrog cov lus sau saum toj no

/* Tam sim no muaj lub voj uas txheeb pom lub teeb ntawm txhua qhov ntawm txoj hauv kev* 3 qhov kev xaiv muaj, nce mus, nqis, nyob hauv tib txoj haujlwm* Nws tau tsim los kom yog tias lub teeb ci nyob ib yam, nws yuav nyob zoo li qub, yog tias tsis yog nws yuav hloov * piv txwv li yog nws yog 950, tom qab ntawd mus rau 952, tsis muaj dab tsi yuav tshwm sim, txawm li cas los xij yog tias nws mus los ntawm 950 txog 600 nws yuav rub daim ntaub thaiv thiab vise versa * Txhua kauj ruam tau hais los ntawm tsab ntawv nyob rau hauv pem hauv ntej ntawm cov kauj ruam los taug qab qhov twg nws yog nyob hauv lub voj los ntawm cov ntawv saib xyuas */

yog (lightlevel> = 900) {Serial.println ("A"); // Cov kauj ruam twg nws yog nyob rau hauv lub loopmyStepper.step (3*stepsPerRevolution); // Tus stepper ua rau 3 kev hloov pauv tom ntej. Yog tias nws tsis zoo, nws yuav rov qab mus ntev (30000); // Tawm nws mus rau 5 feeb qhov pom kev zoo = analogRead (LDR); // Txhais qhov hloov pauv tau "lub teeb" raws li qhov nyeem tshiab los ntawm LDRSerial.print ("Lub teeb theem:"); // Luam tawm cov ntawv nyob rau hauv pem hauv ntej ntawm qhov sib txawv Serial.println (lightlevel) // Luam tawm tus nqi ntawm lub teeb theem

yog (lightlevel> = 900) {Serial.println ("B"); myStepper.step (0); ncua (10000); intlightlevel = analogRead (LDR); Serial.print ("Lub teeb theem:"); Serial.println (qib siab);

yog (lightlevel> = 900) {Serial.println ("C"); myStepper.step (3*-stepsPerRevolution); ncua (500); intlightlevel = analogRead (LDR); Serial.print ("Theem Qib:"); Serial.println (qib siab);}

lwm {Serial.println ("D"); myStepper.step (3*-stepsPerRevolution); ncua (10000); intlightlevel = analogRead (LDR); Serial.print ("Lub Teeb:"); Serial.println (lub teeb);}}

lwm {Serial.println ("E"); myStepper.step (3*-stepsPerRevolution); ncua (10000); intlightlevel = analogRead (LDR); Serial.print ("Lub Teeb:"); Serial.println (lub teeb);

yog (lightlevel> = 900) {Serial.println ("F"); myStepper.step (0); ncua (500); intlightlevel = analogRead (LDR); Serial.print ("Lub teeb theem:"); Serial.println (qib siab);}

lwm {Serial.println ("G"); myStepper.step (0); ncua (10000); intlightlevel = analogRead (LDR); Serial.print ("Lub teeb theem:"); Serial.println (lub teeb);}}

}

lwm tus {Serial.println ("H"); myStepper.step (0); ncua (10000); intlightlevel = analogRead (LDR); Serial.print ("Lub teeb theem:"); Serial.println (lub teeb)

yog (lightlevel> = 900) {Serial.println ("Kuv"); myStepper.step (3*stepsPerRevolution); ncua (10000); intlightlevel = analogRead (LDR); Serial.print ("Lub Teeb:"); Serial.println (qib siab);

yog (lightlevel> = 900) {Serial.println ("J"); myStepper.step (3*-stepsPerRevolution); ncua (500); intlightlevel = analogRead (LDR); Serial.print ("Theem Qib:"); Serial.println (qib siab);}

lwm {Serial.println ("K"); myStepper.step (3*-stepsPerRevolution); ncua (10000); intlightlevel = analogRead (LDR); Serial.print ("Lub Teeb:"); Serial.println (lub teeb);

}}

lwm {Serial.println ("L"); myStepper.step (0); ncua (10000); intlightlevel = analogRead (LDR); Serial.print ("Lub teeb theem:"); Serial.println (lub teeb)

yog (lightlevel> = 900) {Serial.println ("M"); myStepper.step (0); ncua (500); intlightlevel = analogRead (LDR); Serial.print ("Lub teeb theem:"); Serial.println (qib siab);}

lwm {Serial.println ("N"); myStepper.step (0); ncua (10000); intlightlevel = analogRead (LDR); Serial.print ("Lub teeb theem:"); Serial.println (lub teeb)

}}

}

}

Kauj Ruam 4: Tsis teb los tau: LCD Screen

Qhov no yuav luam tawm lub teeb pom kev pom los ntawm LDR ntawm lub vijtsam LCD.

#suav nrog

  • // Ntxiv lub tsev qiv ntawv siv lead ua kua nrog cov lej ntxiv#txhais ldr A0 // Txhais qhov sib txawv "ldr" rau A0 tus pin

    LiquidCrystal lcd (8, 9, 4, 5, 6, 7); // pib lub tsev qiv ntawv nrog tus lej ntawm tus pin interface

    voidsetup () {// code uas khiav ib zaug ntawm startlcd.begin (16, 2); // teeb tsa LCD tus naj npawb ntawm kab thiab kab feem pinMode (ldr, INPUT); // Txhais lub ldr ua tus pinSerial.begin (9600); // Pib kev sib txuas lus nrog tus saib xyuas

    }

    voidloop () {// code uas yuav rov ua txuas ntxiv txuas ntxiv musSerial.println (analogRead (ldr))); // Luam tawm qhov nyeem ldr tuaj tos (tus lej nruab nrab ntawm 0-1023) ntawm tus lej saib xyuas lcd.setCursor (6, 0); // teeb tus cursor rau kab 6, kab 0lcd.print (analogRead (ldr)); // Luam tawm qhov kev nyeem no ntawm LCD screendelay (1000); // Ncua cov lus txib tom ntej no rau ib pliag

    }

    Kauj Ruam 5: Luam Tshooj

    Siv cov ntaub ntawv hauv qab no los luam tawm sawv ntsug thiab iav. Koj tuaj yeem hloov kho lub iav rau koj tus kheej lub hom phiaj thiab koj tuaj yeem siv lub bracket los txhim kho nws ntawm phab ntsa lossis ua cov zaub. Raws li 3D iav tsis muaj zog, lub iav tiag tiag tuaj yeem siv los hloov pauv rau nws tsuav nws phim cov kab hlau rhuav nws yuav tswj tau.

    Yog tias yuav siv daim iav 3D luam tawm, ib qho ntawm cov iav hniav tau raug tshem tawm kom cov ntsia hlau teeb tuaj yeem kho nws mus rau lub cav.

    Pem hauv ntej 2 ceg ntawm phab ntsa tuaj yeem raug tshem tawm yog tias nws yuav tsum tau teeb tsa rau ntawm phab ntsa. Lawv tsuas yog ntxiv yog li nws yuav sawv thaum peb tab tom sim nrog nws.

    Kauj Ruam 6: Kev Tso Npe

    Tam sim no tias txhua ntu tau npaj txhij, nws yog lub sijhawm los pib qhov kev tso zaum kawg.

    Ua ntej tshaj, tso lub stepper lub cev rau hauv lub thawv muab rau ntawm lub rooj muag khoom thiab muab lub iav rau ntawm lub qag Tom ntej no, txav cov xov hlau kom lawv mus tom qab sawv ntsug kawg, tso lub arduino thiab roj teeb tom qab sawv ntsug

    Tam sim no koj lub rooj tsavxwm yuav tsum zoo ib yam li daim duab saum toj no.

    Nrog koj zoo siab!

    Cov iav tuaj yeem siv rau cov ntaub thaiv tsis zoo lossis lwm yam uas koj xav tau tswj los ntawm LDR.

    Koj ua tiav. Txaus siab rau koj qhov kev tsim tshiab.

Pom zoo: