Cov txheej txheem:

Tsav Tsheb Stepper Tsav Tsis Muaj Microcontroller: 7 Kauj Ruam
Tsav Tsheb Stepper Tsav Tsis Muaj Microcontroller: 7 Kauj Ruam

Video: Tsav Tsheb Stepper Tsav Tsis Muaj Microcontroller: 7 Kauj Ruam

Video: Tsav Tsheb Stepper Tsav Tsis Muaj Microcontroller: 7 Kauj Ruam
Video: tsav tsheb kawv thiab tseb thauj av ua si-CR excavator playing with Rc drump 2024, Kaum ib hlis
Anonim
Image
Image

Hauv Cov Lus Qhia no, Kuv yuav tsav lub cav 28-BYJ-48, nrog UNL2003 darlington array board, qee zaum hu ua x113647, tsis muaj lub micro tswj.

Nws yuav muaj pib/nres, rau pem hauv ntej/rov qab, thiab tswj ceev.

Lub cev muaj zog yog lub cev muaj zog ib leeg-ncov qaum nrog 2048 cov kauj ruam ib kiv puag ncig hauv cov kauj ruam tag nrho. Cov ntawv rau lub cev muaj nyob ntawm

Ob lub cuab yeej tuaj yeem yuav ua ke los ntawm ntau tus neeg muag khoom. Kuv tau txais kuv los ntawm kjell.com

Bing nws lossis google nws kom pom tus muag khoom nyob ze koj.

Kuv yuav xub mus dhau qee cov kauj ruam thiab ntu uas xav tau kom nws ua haujlwm, thiab tom qab ntawd ntxiv qee cov kauj ruam thiab ntu rau qee qhov kev tswj hwm ntxiv.

Koj yuav tsum tau ceeb toom tias cov khoom uas kuv siv, yog cov uas kuv tau muaj hauv kuv lub hauv siab, thiab tsis tas yuav yog cov khoom zoo tshaj plaws rau lub hom phiaj.

Tsis tas li, koj yuav tsum tau ceeb toom, tias qhov no yog kuv thawj Phau Ntawv Qhia, thiab tias kuv yog tus tshiab rau hluav taws xob.

Thov ntxiv cov lus pom yog tias koj xav tias kuv tau ua qee yam uas kuv tsis tsim nyog, lossis yog tias koj muaj cov lus qhia rau kev txhim kho, lossis cov lus qhia rau cov khoom haum zoo dua.

Kauj Ruam 1: Tshooj Npe

Qhov Loj
Qhov Loj

Cov khoom siv rau txoj haujlwm no yog

  • Cov qhob cij
  • Stepper lub cev muaj zog 28byj-48
  • Darlington transistor array ULN2003 board (x113647)
  • 74HC595 hloov pauv npe
  • 74HC393 binary ripple txee
  • DS1809-100 Dallastat digital potentiometer
  • 74HC241 octal tsis
  • 3 × tactile nyees khawm
  • 3 × 10kΩ resistors
  • 2 × 0.1µF ceramic capacitors
  • 1 × 0.01 µF ceramic capacitor
  • Cov xov hlau txuas
  • 5V fais fab mov

Kauj Ruam 2: Qhov Tseem Ceeb

Qhov Loj
Qhov Loj

74HC595 hloov npe rau npe

Lub cav tau txav los ntawm kev rov muab plaub tus lej nkag ntawm UNL2003 pawg thawj coj no ua ntu zus:

1100-0110-0011-1001

Qhov no yuav tsav lub cav hauv qhov hu ua full step mode. Tus qauv 1100 tau rov hloov pauv txoj cai. Qhov no qhia txog kev hloov npe. Txoj hauv kev ua haujlwm rau npe hloov pauv yog, ntawm txhua lub voj voog moos, cov khoom hauv cov ntawv sau npe hloov chaw ib qho mus rau sab xis, hloov qhov sab laug me ntsis nrog tus nqi ntawm tus lej nkag thaum lub sijhawm. Yog li ntawd, nws yuav tsum tau pub nrog ob lub voj voog ntawm 1 thiab tom qab ntawd ob lub voj voog ntawm 0 los tsim cov qauv rau dhia dej lub cev.

Txhawm rau tsim lub cim qhia lub moos, xav tau oscillator, uas ua kom muaj kev ua haujlwm tsis tu ncua ntau dua li qhov huv huv ntawm cov yoj. Qhov no yuav tsim lub hauv paus ntawm kev hloov patten ntawm cov cim rau lub tshuab.

Txhawm rau tsim "ob lub voj voog ntawm ib qho thiab tom qab ntawd ob lub voj voog ntawm 0", flip-flops tau siv.

Kuv muaj daim ntawv teev npe ua haujlwm 74HC595. Nov yog cov nti nrov heev, uas tau piav qhia hauv ntau Cov Lus Qhia thiab Youtube cov vis dis aus.

Cov ntaub ntawv tuaj yeem nrhiav tau ntawm

Cov Lus Qhia Zoo yog 74HC595-Shift-Register-Demistified by bweaver6, 74HC595 hloov npe rau npe ua haujlwm yog li ntawm txhua lub voj voog moos, cov ntaub ntawv hauv nws 8 ntsis npe tau hloov pauv mus rau sab xis, thiab hloov pauv tus nqi ntawm tus lej nkag ntawm sab laug txoj haujlwm. Yog li ntawd, nws yuav tsum tau pub nrog ob lub voj voog ntawm 1 thiab tom qab ntawd ob lub voj voog ntawm 0.

Cov ntaub ntawv tau hloov pauv ntawm qhov nce ntawm ntug ntawm lub moos mem tes. Henc lub flip-flop yuav tsum toggle ntawm qhov poob ntawm lub moos, yog li 74HC595 yuav muaj cov ntaub ntawv ruaj khov nkag ntawm lub moos nce.

74HC595 nyob rau hauv tuaj yeem txuas tau zoo li no:

Pin 8 (GND) -> GND

Pin 16 (VCC) -> 5V Pin 14 (SER) -> Cov Ntaub Ntawv hauv Pin 12 (RCLK) -> Mloog cov lus nkag Pin 11 (SRCLK) -> Clock input Pin 13 (OE) -> GND Pin 10 (SRCRL) -> 5V Pins 15, thiab 1-3 yuav tso tus qauv los tsav lub cav.

Txuas RCLK thiab SRCLK ua kom ntseeg tau tias cov ntaub ntawv teev npe nti ib txwm nyob ua ke nrog cov npe tso tawm. Muab tus Pin 13 rau hauv av ua rau cov ntsiab lus ntawm cov npe tso tawm tam sim pom rau cov pins tso tawm (Q0 - Q7).

Lub sijhawm 555

Txhawm rau tsim lub moos mem tes, lub 555 timer nti tuaj yeem siv tau. Qhov no kuj tseem yog lub npe nrov heev, thiab tseem tau piav qhia ntau ntxiv thiab sib tham ntau dua li kev hloov npe. Wikipedia muaj kab lus zoo ntawm

Cov ntaub ntawv nyob ntawm no:

Cov nti no tuaj yeem, ntawm lwm yam, tsim cov square wave clock pulse. Cov sab nraud sab nraud thiab cov khoom siv hluav taws xob tau siv los tswj cov zaus thiab lub voj voog ua haujlwm (ntawm-feem).

Thaum teeb tsa kom rov tsim cov mem tes ntau dua, 555 nti tau hais tias yog nyob rau hauv hom astable. Qhov no yog ua los ntawm kev thaiv nws zoo li hauv daim duab saum toj no. (daim duab los ntawm jjbeard [Public domain], ntawm Wikimedia Commons):

Pin 1 -> GND

Pin 2 -> R1 (10kΩ) -> Pin 7 Pin 2 -> Pin 6 Pin 3 yog cov zis Pin 4 (rov pib dua) -> 5V Pin 5 -> 0.01µF -> GND Pin 6 -> 0.1µF -> GND Pin 7 -> R2 (10kΩ) -> 5V Pin 8 -> 5V

Cov zis ntawm Pin 3 yuav txuas nrog lub moos nkag lub koob (Pin 11 thiab Pin 12) ntawm 74HC595 hloov pauv npe.

Qhov zaus ntawm cov teeb liab tso tawm (thiab yog li qhov nrawm ntawm cov kauj ruam lub cev muaj zog) tau txiav txim siab los ntawm qhov tseem ceeb ntawm tus tiv thaiv R1 thiab R2, thiab tus nqi ntawm lub capacitor C.

Lub sijhawm voj voog T yuav yog ln (2) C (R1 + 2 R2) lossis kwv yees li 0.7 C (R1 + 2 R2). Qhov zaus yog 1/T.

Lub voj voog ua haujlwm, feem ntawm lub sijhawm voj voog uas lub teeb liab siab, yog (R1 + R2) / (R1 + 2R2). Qhov kev ua haujlwm tsis tseem ceeb heev rau txoj haujlwm no.

Kuv siv 10kΩ, rau R1 thiab R2, thiab C = 0.1µF.

Qhov no muab zaus txog 480Hz, thiab ze rau qhov ntau zaus kuv pom tias cov kauj ruam lub cev muaj peev xwm tuaj yeem ua haujlwm yam tsis muaj kev poob.

Txhawm rau tsim 1100 hloov pauv, rov ua dua tus qauv los ntawm 74HC595, tus pin 14 (SER) yuav tsum tau khaws cia siab rau ob teev mus, thiab tom qab ntawd qis rau ob teev mus ib zaug. Ntawd yog, tus pin yuav tsum oscillate nrog ib nrab zaus ntawm lub moos.

74HC393 dual binary ripple txee

74HC393 suav hauv binary, thiab qhov ntawd kuj txhais tau tias nws tuaj yeem siv los faib cov mem tes zaus los ntawm lub zog ntawm ob, Nws cov ntaub ntawv nyob ntawm no:

74HC393 yog ob qho, nws muaj ib qho 4 ntsis txee ntawm txhua sab.

Ntawm qhov ntog ntog ntawm lub moos mem tes, thawj tus lej pin tso rau thiab tawm. Li no, tus pin tso tawm ib qho yuav oscillate nrog ib nrab zaus ntawm lub moos nkag. Ntawm qhov poob ntawm qhov tso zis tus pin ib, tso tus pin ob lub toggles rau thiab tawm. Thiab ntxiv rau tag nrho plaub qhov pins tso tawm. Thaum twg tus pin n tig tawm, tus pin n+1 toggles.

Pin n+1 hloov ib nrab ntau npaum li tus pin n. Qhov no yog suav binary. Lub txee tuaj yeem suav txog 15 (tag nrho plaub qhov 1) ua ntej nws pib xoom dua. Yog tias tus lej kawg ntawm tus lej 1 tau txuas nrog lub moos rau lub txee 2, nws yuav suav rau 255 (8 khoom).

Txhawm rau tsim cov mem tes nrog ib nrab zaus ntawm lub moos nkag, tsuas yog xav tau tus lej pin 1. Ntawd yog, tsuas suav los ntawm xoom mus rau ib qho.

Yog li, yog tias suav ua tiav los ntawm lub moos mem tes los ntawm 555, tus pin ntawm 74HC393 txee uas sawv cev rau me ntsis 2, yuav oscillate nrog ib nrab zaus ntawm lub moos. Li no qhov no tuaj yeem txuas nrog SER tus pin ntawm 74HC595 hloov npe, kom ua qhov no tsim cov qauv xav tau.

Kev thaiv ntawm 74HC393 binary txee yuav tsum yog:

Pin 1 (1CLK) -> 74HC595 Pin 11, 12 thiab 555 Pin 3

Pin 2 (1CLR) -> GND Pin 4 (1QB) -> 74HC595 Pin 14 Pin 7 (GND) -> GND Pin 14 (VCC) -> 5V Pin 13 (2CLK) -> GND (tsis siv) Pin 12 (2CLR)) -> 5V (tsis siv)

Kauj Ruam 3: Ua Kom Nws Ua Haujlwm

Ua kom nws khiav
Ua kom nws khiav
Ua kom nws khiav
Ua kom nws khiav

Tam sim no peb tuaj yeem ua lub cav khiav, Yog Pins 0-3 ntawm 74HC595 txuas nrog Pins 1-4 ntawm ULN2003 pawg thawj coj saib feem.

Txog tam sim no, hloov 0.1µF capacitor ntawm Pin 6 ntawm 555 timer nrog 10µF. Qhov no yuav ua rau lub moos hloov pauv ib zaug ntev dua, thiab ib tus yuav tuaj yeem pom dab tsi tshwm sim.

Cov LEDs ntawm ULN2003 cov laug cam tuaj yeem siv rau qhov no. Tshem lub cav los ntawm ULN2003 pawg thawj coj saib. Txuas Pins 1 txog 4 ntawm pawg thawj coj mus rau QA-QD (pins 7, 9, 10 thiab 11) ntawm 74HC595. Txuas lub - thiab + ntawm ULN2003 pawg thawj coj saib rau hauv av thiab 5V. Yog tias lub zog qhib, koj yuav tsum pom cov qauv xav tau ntawm LEDs.

Yog tias koj xav pom dab tsi tshwm sim hauv 74HC393 binary txee, txuas rau tus pin 3-6 ntawm qhov ntawd ua ntu zus.

Yog tias tus qauv zoo li raug, txo hwj chim, hloov lub tshuab hluav taws xob nrog 0.1µF dua, txuas cov tswv yim txuas 1 - 4 ntawm ULN2003 pawg thawj coj mus rau cov pins tso zis QA - QD ntawm 74HC595, thiab ntsaws rau hauv lub cev muaj zog dua.

Nrog lub zog qhib, lub cav yuav tsum tam sim no khiav.

Kauj Ruam 4: Kev Tswj Ceev

Kev Tswj Ceev
Kev Tswj Ceev

Qhov nrawm ntawm cov kauj ruam lub cev muaj zog yog tswj hwm los ntawm qhov zaus ntawm qhov tso tawm ntawm 555 lub sijhawm. Qhov no dua, yog tswj hwm los ntawm qhov tseem ceeb ntawm cov resistors R1 thiab R2 thiab lub capacitor C1 txuas nrog nws. Los ntawm kev sib txuas 100kΩ potentiometer hauv koob nrog R2, zaus yuav nyob nruab nrab ntawm 480Hz thiab 63Hz. Cov kauj ruam pr. thib ob ntawm lub cev muaj zog, yuav yog ib nrab ntawm 555 lub sijhawm ua ntu zus.

Kuv siv DS1809-100 digital potentiometer, uas yog tsim rau kev siv lub pob nyem. Laub khawm txuas tus pin 2 (UC) thiab Pin 7 (DC) rau 5V ua rau kev tiv thaiv nce/txo qis ntawm RH (Pin 1) lossis RL (Pin 4) cov davhlau ya nyob twg, thiab wiper Pin 6 (RW). Tuav lub pob rau ntau dua li ib pliag, ua rau khawm pib rov ua dua.

Cov ntawv tuaj yeem pom ntawm no:

Kev thaiv kab mob zoo li no:

Pin 1 (RH) tsis siv

Pin 2 (UC) -> tactile khawm 1 Pin 3 (STR) -> GND Pin 4 (RL) -> 555 Pin 2 Pin 5 -> GND Pin 6 (RW) -> 10kΩ -> 555 pin 7 Pin 7 (DC) -> tactile khawm 2 Pin 8 -> 5V

Txoj hlua rau khawm tactile 1:

Pin 1/2 -> DS1809 Tus Pin 2

Pin 3/4 -> 5V

Txoj hlua rau khawm tactile 2:

Pin 1/2 -> DS1809 Tus Pin 7

Pin 3/4 -> 5V

Tam sim no, qhov nrawm tuaj yeem tswj tau.

Kauj ruam 5: Pib / Nres

Pib / Nres
Pib / Nres

Txhawm rau pib thiab nres lub stepper lub cev muaj zog, Tus Pin 4 (Tus pin rov pib dua) ntawm 555 lub sijhawm tuaj yeem siv tau. Yog tias qhov no rub qis, yuav tsis muaj cov pa tawm los ntawm tus Pin 3.

Lub ntsej muag khawm yuav siv los hloov pib thiab nres. Nias lub pob ib zaug, yuav tsum pib lub cav, snd nias nws dua, yuav tsum nres nws. Txhawm rau kom tau txais tus cwj pwm no, yuav tsum muaj flip-flop. Tab sis 74HC393 uas twb muaj lawm, kuj tseem tuaj yeem siv tau. 74HC393 muaj ob ntu, thiab tsuas yog ib nrab tau siv ua qhov faib ua zaus rau lub moos mem tes.

Txij li lub rooj sib tham binary yog qhov tseeb tsuas yog teeb tsa toggling flip-flops hauv koob, thawj zaug flip-flop ntawm lwm qhov tuaj yeem siv tau. Los ntawm kev txuas lub khawm tsis sib xws xws li Pin 13 (2CLK) qis thaum lub pob nyem, thiab siab yog tias nws tsis yog, Tus Pin 12 yuav hloov pauv ntawm txhua qhov qis. Txuas tus Pin 12 rau Tus Pin 4 ntawm 555, yuav pib thiab nres nws cov zis, thiab yog li lub cev muaj zog.

Tactile nyees khawm yog qhov nyuaj me ntsis, vim tias lawv yog cov neeg kho tshuab. Lawv tuaj yeem "thaws", uas yog lawv tuaj yeem xa ntau lub cim ntawm txhua qhov thawb. Txuas lub 0.1 µF capacitor hla lub pob, pab zam qhov no.

Yog li lub khawm tactile (khawm 3 tau ntxiv, thiab kev txuas mus rau Pin 4 ntawm 555 tau hloov pauv.

Qhov thaiv ntawm khawm:

Pin 1/2 -> 10kΩ -> 5V

Pin 1/2 -> 0.1µF -> Pin Pin 3/4 -> 74HC393 Pin 13 (2CLK)

Cov kev hloov hauv qab no tau ua rau 555:

Pin 4 (Pib dua) -> 74HC393 Pin 11 (2QA)

Khawm 3 yuav tsum tam sim no ua haujlwm li pib/nres toggle.

Nco ntsoov tias lub cav nres txoj hauv kev no, tseem yuav siv lub zog.

Kauj Ruam 6: Kev Tswj

Kev Tswj Xyuas
Kev Tswj Xyuas

Txhawm rau tswj cov kev taw qhia ntawm lub cav, xav tau lwm lub laub khawm, thiab tom qab ntawd lwm lub flip-flop. Txawm li cas los xij, Kuv yuav dag, los ntawm kev siv lub flip-flop tom ntej ntawm 74HC393, tom qab qhib/tawm flip-flop, thiab khawm rau/tawm.

Thaum tus taw qhia tus pin (Pin 2QA) mus qis, tus pin tom ntej (Pin 2QB) yog toggled. Yog li rov thawb lub laub khawm yuav ua rau OFF - ON FORWARDS - OFF - ON BACKWARDS - OFF - ON FORWARDS thiab lwm yam.

Txhawm rau ua kom lub cav khiav rov qab, tus qauv pub rau ULN2003 yuav tsum tau thim rov qab. Qhov ntawd tuaj yeem ua tiav nrog rau npe ob-txoj haujlwm hloov pauv, tab sis kuv tsis muaj. 74HC595 tsis yog ob txoj kev.

Txawm li cas los xij, Kuv pom tias kuv tuaj yeem siv kuv 74HC241 octal buffer. Qhov tsis zoo no muaj ob 4 ntu me me, nrog cais OE (tso zis tso zis) pins. Thawj tus lej OE tswj hwm plaub tus pin thawj tso tawm, thiab qhov thib ob zaum kawg plaub tus pin tso tawm. Thaum OE nyob ntawm cov pins tso tawm muaj tus nqi zoo ib yam li tus lej nkag nkag, thiab thaum nws tawm, cov pins tso tawm yuav nyob hauv lub xeev tsis muaj kev cuam tshuam, zoo li yog lawv tsis txuas nrog. Ntxiv mus, ib qho ntawm tus lej OE tau ua haujlwm qis, thiab lwm qhov ua haujlwm siab, yog li thaum txuas lawv ua ke, tsuas yog ib nrab ntawm qhov tsis tuaj yeem ua haujlwm nyob rau lub sijhawm.

Yog li, rau tib cov tswv yim, ib nrab ntawm qhov tsis tuaj yeem tsav lub cav mus rau tom ntej, thiab lwm qhov ib nrab rov qab. Ib nrab twg yog qhov ua haujlwm, nyob ntawm tus nqi ntawm OE pins.

Cov ntawv xov xwm rau 74HC241 muaj nyob ntawm

Kev thaiv yuav zoo li no:

Pin 1 (1OE) -> 74HC293 Pin 10 (2QB)

Pin 2 (1A1) -> 74HC595 Pin 15 Pin 3 (1Y4) -> ULN2003 Pin 1 Pin 4 (1A2) -> 74HC595 Pin 1 Pin 5 (1Y3) -> ULN2003 Pin 2 Pin 6 (1A3) -> 74HC595 Pin 2 Pin 7 (1Y2) -> ULN2003 Pin 3 Pin 8 (1A4) -> 74HC595 Pin 3 Pin 9 (1Y1) -> ULN2003 Pin 4 Pin 10 (GND) -> Pin Pin 11 (2A1) -> Pin 2 (1A1) Pin 12 (1Y4) -> Pin 9 (2Y1) Pin 13 (2A2) -> Pin 4 (1A2) Pin 14 (1Y3) -> Pin 7 (2Y2) Pin 15 (2A3) -> Pin 6 (1A3) Pin 16 (1Y2) -> Pin 5 (2Y3) Pin 17 (2A3) -> Pin 8 (1A4) Pin 18 (1Y2) -> Pin 3 (2Y4) Pin 19 (2OE) -> Pin 1 (1OE) Pin 20 (VCC)) -> 5V

Tam sim no, cov xov hluav taws xob yuav tsum tau ua tiav tsuas yog siv lub zog nrog 5V. Muaj kom ntseeg tau tias lub zog siv hluav taws xob tuaj yeem xa hluav taws xob txaus tam sim no los tsav ob lub cav thiab cov hluav taws xob.

Kauj Ruam 7: Cov lus xaus

Cov lus xaus
Cov lus xaus

Cov kauj tsheb kauj vab tuaj yeem tswj tau yam tsis muaj microcontroller.

ICs siv ntawm no, yog qee qhov uas kuv muaj los ntawm ua ntej. Feem ntau ntawm lawv tsis pom zoo rau qhov no, thiab ntau txoj kev xaiv tuaj yeem siv tau.

  • Txhawm rau tsim cov mem tes, 555 lub sijhawm teev nti yog qhov zoo, tab sis muaj ntau txoj hauv kev xaiv, piv txwv li ib qho tau piav qhia hauv Phau Ntawv Qhia no.
  • Txog kev tswj nrawm, ib qho siv lub zog loj tuaj yeem siv tau, tsis yog siv digital nkaus xwb. Yog tias koj muaj 10kΩ potentiometer, ntau dua li 100kΩ, 10kΩ resistors tuaj yeem hloov los ntawm 1KΩ, thiab 0.1 µF capacitor nrog 1µF capacitor (faib tag nrho cov resistors thiab muab cov capacitor nrog tib tus lej kom ua raws sijhawm).
  • Siv daim ntawv teev npe ua haujlwm ob txoj haujlwm, xws li 74HC194 yuav ua rau kev tswj hwm yooj yim dua.
  • Txog kev tswj khawm, 74HC393 tuaj yeem hloov pauv los ntawm flip-flop, piv txwv li 74 HC73 ib. 555 kuj tseem tuaj yeem xaim los ua qhov hloov pauv.

Pom zoo: