Cov txheej txheem:
- Kauj Ruam 1: Sau cov Khoom
- Kauj Ruam 2: Sib dhos Circuit
- Kauj Ruam 3: Teeb PWM ntawm MCU
- Kauj Ruam 4: Program Microcontroller
- Kauj ruam 5: Serial Port Communications
Video: Servo Squirter - USB Dej Phom: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:31
Ib rab phom USB dej servo tswj. Zoo rau kev tua ntawm cov neeg hla dhau uas tsis xav txog, lossis ua rau tib neeg muaj lus nug tsis txaus ntseeg ntawm qhov chaw. Tag nrho txhua yam yog tsav los ntawm lub microcontroller, thiab tswj los ntawm koj cov keyboard hla USB. To saib ntau ntawm peb cov haujlwm thiab kev qhia video dawb xyuas peb lub vev xaib
Kauj Ruam 1: Sau cov Khoom
Qhov haujlwm no yog microcontroller raws. Lwm yam tshaj li ATmega168 microcontroller suav nrog hauv USB NerdKit. Rau qhov haujlwm no peb siv cov hauv qab no: 1 Hobby Servo, Hitec HS-501 Tsawg hluav taws xob piston dej twj tso kua mis me me n-channel MOSFET, 2N7000
Kauj Ruam 2: Sib dhos Circuit
Thawj ntu ntawm peb qhov kev sib txuas tsuas yog txuas rau servo. Nov yog qhov yooj yim ntawm no: ib qho xaim los ntawm microcontroller mus rau servo. Muaj ob peb daim ntawv lo xim sib txawv nyob ntawm tus tsim khoom, yog li kos ua ntej sim qhov no. Schematic Photo ntawm ServoSquirter Circuit ntawm NerdKits breadboard Qhov thib ob ntawm Circuit Court tso cai rau microcontroller hloov lub twj tso kua mis rau thiab tawm. ATmega168 nti nws tus kheej tsuas yog tso cai 40mA max rau hauv lossis tawm ntawm tus pin, tab sis peb lub twj tso kua mis xav tau ze dua rau 1000mA! Yog li txhawm rau tswj hwm lub nra hnyav no, peb tau xaiv los siv lub transistor loj dua, 2N7000. Ua ntej peb piav qhia qhov tseem ceeb ntawm kev siv MOSFETs (Hlau Oxide Semiconductor Field Effect Transistors) ua qhov hloov pauv: nqa lub rooj vag qhov hluav taws xob siab dua Qhov Chaw, peb tuaj yeem tso cai tam sim no ntws los ntawm Dej mus rau Qhov Chaw. Los ntawm 2N7000 cov ntawv teev tseg, peb tau rho tawm Daim Duab 1, uas qhia txog kev sib raug zoo ntawm cov dej ntws tam sim no thiab cov dej ntws tawm qhov hluav taws xob rau qhov sib txawv qhov rooj-qhov hluav taws xob teeb tsa. Muaj ob peb yam tseem ceeb uas koj tuaj yeem kawm tau los ntawm kab ntawv no: 1. Rau VGS hauv qab no txog 3.0 volts, tsis pub tso dej tam sim no. Qhov no yog lub xeev tawm, tseem hu ua "txiav tawm". 2. Rau VDS me me, txoj kab nkhaus zoo li ntxhib los ntawm keeb kwm - uas txhais tau tias nws hluav taws xob "zoo li" zoo li tus tiv thaiv. Qhov sib npaug tsis kam yog qhov rov qab nqes hav ntawm txoj kab nkhaus. Thaj tsam ntawm MOSFET kev ua haujlwm no hu ua "triode". 3. Rau VDS loj dua, qee qhov siab tshaj plaws ntawm tam sim no tau mus txog. Qhov no hu ua "saturation". 4. Raws li peb nce VGS, ntau qhov tam sim no tau tso cai ntws hauv ob qho tib si triode thiab saturation modes. Thiab tam sim no koj tau kawm tiag txog txhua peb hom kev ua haujlwm ntawm MOSFET: txiav tawm, triode, thiab saturation. Because peb lub rooj vag tswj yog digital (+5 lossis 0), peb tsuas yog txhawj xeeb txog qhov nkhaus tau hais ua daj, rau VGS = 5V. Feem ntau, siv MOSFET raws li kev hloov pauv feem ntau cuam tshuam nrog triode hom kev ua haujlwm, vim tias MOSFET tshem tawm lub zog PD = ID*VDS, thiab qhov hloov pauv zoo yuav tsum tso lub zog me me hauv qhov hloov nws tus kheej. Tab sis qhov xwm txheej no, peb tab tom cuam tshuam nrog lub cev muaj zog, thiab lub cev muaj zog yuav xav tau ntau qhov tam sim no (nrog qhov poob qis me ntsis) thaum lawv tau pib ua ntej. Yog li rau thawj ob lossis ob, MOSFET yuav ua haujlwm nrog VDS siab, thiab yuav raug txwv los ntawm nws qhov siab tshaj tam sim no - txog 800mA los ntawm kab liab liab uas peb tau kos rau ntawm cov ntawv teev tseg. Peb pom tias qhov no tsis txaus kom pib lub twj tso kua mis, yog li peb tau siv me ntsis dag thiab muab ob qho MOSFETs sib dhos. Txoj kev no, lawv qhia txog tam sim no, thiab tuaj yeem ua haujlwm zoo txog 1600mA ua ke. Lwm li vim yog lub zog loj xav tau ntawm lub twj tso kua mis, peb tau siv cov phab ntsa hloov pauv nrog cov zis tam sim no ntau dua. Yog tias koj muaj phab ntsa hloov pauv nrog ntau dua 5V tso zis - tej zaum 9V lossis 12V - ces koj ca
Kauj Ruam 3: Teeb PWM ntawm MCU
PWM Kev Sau Npe thiab Xeem Hauv cov vis dis aus, peb tham txog ob qib siv los ntawm lub sijhawm ntsuas/ntsuas qhov ntsuas: tus nqi siab tshaj, thiab tus nqi sib piv. Ob qho ntawm no yog qhov tseem ceeb hauv kev tsim PWM lub cim koj xav tau, tab sis txhawm rau qhib koj li ATmega168's PWM tso tawm thawj zaug, peb yuav tsum teeb tsa ob peb lub npe. Ua ntej, peb xaiv Hom PWM Ceev nrog OCR1A ua tus nqi siab tshaj, uas tso cai rau peb txiav txim siab ntau npaum li cas pib ua haujlwm tshiab. los ntawm 1 txhua 8/(14745600 Hz) = 542 nanoseconds Txij li thaum peb muaj 16-ntsis rau npe rau lub sijhawm no, qhov no txhais tau tias peb tuaj yeem teeb tsa peb lub sijhawm teeb liab tag nrho kom siab li 65536*542ns = 36 milliseconds. Yog tias peb siv tus lej sib faib loj dua, peb tuaj yeem ua rau peb lub plab sib nrug deb dua (uas tsis pab hauv qhov xwm txheej no), thiab peb yuav plam kev daws teeb meem. Yog tias peb siv tus lej me me (xws li 1), peb yuav tsis tuaj yeem ua rau peb qhov sib txawv tsawg kawg 16 milliseconds sib nrug, raws li peb cov kev xav tau xav tau. tso tawm, uas tau piav qhia hauv peb cov vis dis aus. Peb kuj teeb tus pin PB2 los ua tus pin tso tawm-tsis pom ntawm no, tab sis nws nyob hauv txoj cai. Nyem kom nthuav dav cov kev txhaj tshuaj no los ntawm nplooj ntawv 132-134 ntawm ATmega168 cov ntawv, nrog rau peb cov npe sau npe xaiv tau hais txog:
Kauj Ruam 4: Program Microcontroller
Tam sim no nws yog lub sijhawm los ua qhov program MCU. Cov peev txheej ua tiav tau muab rau ntawm peb lub vev xaib https://www.nerdkits.com/videos/servosquirterCov cai xub teeb tsa PWM los tsav lub servo. Txoj cai ntawd tsuas yog zaum hauv lub sijhawm tos tos rau cov neeg siv nkag mus. Cov cim 1 thiab 0 tig tus MCU tus pin uas txuas nrog lossis tso tawm lub twj tso kua mis. Qhov no yuav tig lub twj tso kua mis tawm thiab ua rau peb muaj peev xwm tua hluav taws. Qhov chaws tseem teb rau '[' thiab ']' cov yuam sij no cov lej yuav nce lossis txo tus nqi sib piv ntawm PWM tus pin, uas yuav ua rau servo lub cev muaj zog los hloov txoj haujlwm. Qhov no ua rau koj muaj peev xwm npaj ua ntej yuav tua.
Kauj ruam 5: Serial Port Communications
Kauj ruam kawg yog teeb tsa lub computer kom koj tuaj yeem xa cov lus txib mus rau Microcontroller. Hauv NerdKit, peb siv cov kab txuas txuas xa cov lus txib, thiab cov ntaub ntawv mus rau lub khoos phis tawj. Nws muaj peev xwm los sau cov haujlwm yooj yim hauv ntau hom lus uas tuaj yeem sib txuas lus hla qhov chaw nres nkoj mus rau NerdKit. Txawm li cas los nws yog qhov yooj yim dua los siv lub davhlau ya nyob twg los ua cov lus sib txuas rau peb. Txoj kev no koj tsuas tuaj yeem ntaus ntawm cov keyboard, thiab pom cov lus teb los ntawm NerdKit. Windows Yog tias koj siv Windows XP lossis ua ntej, HyperTerminal tau suav nrog, thiab yuav tsum nyob hauv koj li Start Menu hauv "Start -> Programs -> Accessories -> Kev sib txuas lus ". Thaum koj xub qhib HyperTerminal, nws nug koj kom teeb tsa kev sib txuas. Tshem tawm ntawm cov ntawd, txog thaum koj nyob ntawm lub ntsiab HyperTerminal sceen. Koj yuav tsum teeb tsa HyperTerminal, xaiv qhov chaw nres nkoj COM raug, thiab teeb tsa chaw nres nkoj kom tsim nyog los ua haujlwm nrog NerdKit. Ua raws cov duab hauv qab no kom tau txais HyperTerm teeb tsa raug yog tias koj nyob ntawm Windows Vista, HyperTerminal tsis suav nrog. Hauv qhov no, mus rub PuTTY (Windows installer). Siv qhov txuas txuas hauv qab no teeb tsa Putty, siv qhov chaw nres nkoj COM kom raug. Mac OS X Tom qab nkag mus rau daim ntawv thov Terminal, ntaus "screen /dev/tty. PL* 115200" los pib sib txuas lus hla lub serial port. LinuxOn Linux, peb siv " minicom "tham nrog lub chaw nres nkoj. Txhawm rau pib, khiav "minicom -s" ntawm lub console kom nkag mus rau minicom teeb tsa cov ntawv qhia zaub mov. Mus rau "Serial Port Setup". Teeb cov kev ntsuas raws li hauv qab no: Minicom teeb tsa ntawm LinuxThen, ntaus kev khiav thiab siv "Txuag teeb tsa ua dfl" kom txuag chaw raws li lub neej ntawd. Tam sim no koj yuav tsum tuaj yeem ntaus "Tawm" thiab siv minicom rau tham nrog NerdKit.
Pom zoo:
Kev Tswj Dej Hauv Dej Hauv Dej Hauv Dej: 10 Kauj Ruam (nrog Duab)
Underwater Remote Control Drone: Kuv txiav txim siab los tsim ROV no rau lub hom phiaj ntawm kev tshawb fawb thiab kev qhuas ntawm lub ntiaj teb hauv qab dej vim tias tsis muaj ntau tus nqi tsim txiaj hauv cov drones hauv qab. Txawm hais tias nws siv sijhawm ntau, tshawb fawb, thiab autodidacticism, nws yog qhov kev lom zem
Dej Nco Dej Dej Lub Raj Dej: 16 Cov Kauj Ruam
Nco Ntug Dej Cov Dej Lub Raj Dej: Koj puas tau hnov qab haus koj cov dej? Kuv paub kuv ua! Tias yog vim li cas kuv thiaj los nrog lub tswv yim tsim lub raj mis dej uas ceeb toom koj kom haus koj cov dej. Tus tuav lub raj mis dej muaj qhov tshwj xeeb uas lub suab nrov yuav nrov txhua teev kom nco koj
Dej Tswb Tswb Dej /Saib Xyuas Dej Dej: 6 Kauj Ruam
Dej Tswb Tswb Dej /Saib Xyuas Dej Dej: Peb Yuav Tsum Haus Dej Kom Muaj Dej Txhua Hnub kom txaus noj qab nyob zoo rau peb tus kheej. Tsis tas li muaj ntau tus neeg mob uas tau hais kom haus qee qhov tshwj xeeb ntawm cov dej txhua hnub. Tab sis hmoov tsis peb plam lub sijhawm yuav luag txhua hnub. Yog li kuv tsim
Tsim kom muaj DIY Tus Kheej Dej Dej Nrog WiFi - Dej Tsob Ntoo Tuaj thiab Xa Kev Ceeb Toom Thaum Dej Tsawg: 19 Kauj Ruam
Ua DIY Tus Kheej Tus Kheej Dej Nrog WiFi - Dej Tsob Ntoo Tuaj thiab Xa Kev Ceeb Toom Thaum Dej Tsis Tshua: Cov ntawv qhia no qhia koj yuav tsim kho li cas Wi -nkaus txuas nrog tus kheej cog cog dej siv lub qub vaj cog, cov thoob khib nyiab, qee cov nplaum thiab tus kheej Watering Pot Subassembly Kit los ntawm Adosia
Txuag Dej & Nyiaj Nrog Tus Dej Dej Saib Dej: 15 Kauj Ruam (nrog Duab)
Txuag Dej & Nyiaj Nrog Tus Dej Dej Saib Xyuas: Qhov twg siv dej ntau dua - da dej lossis da dej? Kuv paub thaum kuv da dej qee zaum kuv lub siab ploj mus, xav txog qhov txias txias