Cov txheej txheem:

Interfacing Keypad Nrog Arduino. [Txoj hauv kev tshwj xeeb]: 7 Kauj Ruam (nrog Duab)
Interfacing Keypad Nrog Arduino. [Txoj hauv kev tshwj xeeb]: 7 Kauj Ruam (nrog Duab)

Video: Interfacing Keypad Nrog Arduino. [Txoj hauv kev tshwj xeeb]: 7 Kauj Ruam (nrog Duab)

Video: Interfacing Keypad Nrog Arduino. [Txoj hauv kev tshwj xeeb]: 7 Kauj Ruam (nrog Duab)
Video: Xav Nrog Koj Mus - YAKA | Drum Cover 2024, Hlis ntuj nqeg
Anonim
Interfacing Keypad Nrog Arduino. [Txoj Kev Cim]
Interfacing Keypad Nrog Arduino. [Txoj Kev Cim]
Interfacing Keypad Nrog Arduino. [Txoj kev tshwj xeeb]
Interfacing Keypad Nrog Arduino. [Txoj kev tshwj xeeb]

Nyob zoo, thiab txais tos rau kuv thawj qhov kev qhia!:)

Hauv cov lus qhia no kuv xav qhia lub tsev qiv ntawv txaus rau cuam tshuam keyboard nrog arduino - 'Lub tsev qiv ntawv lo lus zais' suav nrog 'Keypad Library'. Lub tsev qiv ntawv no suav nrog cov yam ntxwv zoo tshaj plaws uas peb yuav tham txog hauv cov kauj ruam ntxiv. lub tsev qiv ntawv no yuav zoo tshaj plaws rau cov uas xav teeb tsa qee cov keyboard raws li tus lej nkag mus thiab tawm ntawm lub qhov rooj, lub tub rau khoom, lossis txawm tias yog lub hom phiaj sim kuj. Siv Lub Tsev Qiv Ntawv no peb tseem tuaj yeem suav qhov ('nyem qhov tseem ceeb thiab tuav lub xeev' thiab txawm hloov kho lub sijhawm!). tsis yog qhov txias.. Kuv paub koj tau tawm mus … Cia dhia dej hauv.

Nov yog qhov txheej txheem tshwj xeeb vim tias: qhov no txuag ntau txoj kab kab, yog li txo qhov nyuaj. Ob qho teeb tsa tus password thiab nyeem cov keyboard lub tswv yim yuav dhau los ua qhov yooj yim los ntawm kev siv txoj hauv kev no, thiab lwm yam Hauv ib lo lus: Nws Tsis Zoo Li Cas.

Kuv vam tias qhov haujlwm no yuav qhib qhov rooj rau ntau tus neeg muaj tswv yim nrog rau koj. Tsis txhob txhawj xeeb yog tias koj tsuas yog tus pib lossis tsis paub txog Arduino. Kuv muaj kev daws teeb meem rau koj- thaum kawg.

Kauj Ruam 1: Qhov Yuav Tsum Tau

Yam Yuav Tsum Tau
Yam Yuav Tsum Tau
Yam Yuav Tsum Tau
Yam Yuav Tsum Tau
Yam Yuav Tsum Tau
Yam Yuav Tsum Tau

Cheebtsam thiab Cov Qauv:

  1. Arduino UAS.
  2. 4*4 matrix Keypad.
  3. RGB LED.
  4. ob 330 ohm resistor
  5. Jumper xov hlau.
  6. Pawg mov ci.
  7. USB cable (A-B) hom.

Yuav tsum tau Software:

  1. Arduino IDE Cov.
  2. Lo lus zais & Keypad tsev qiv ntawv rau Arduino.

(koj tuaj yeem rub tawm cov software hauv qib-3.)

Kuv yuav qhia koj yuav ntawm www.banggood.com | cov nqi sib piv tsawg dua ntawm no.

Kauj Ruam 2: Cov ncauj lus ntxaws ntxaws thiab Cov Lus Cim Siv

Arduino UNO: Peb

Nws yog micro-maub los raws li qhib qhov chaw muab los ntawm Arduino. CC. Nws muaj ATMEGA328 micro-xws li nws CPU, 32kB flash, 1kB EEPROM & 2kB SRAM, 14 digital thiab 6 analog I/O. Arduino yuav tsum tau programmed hauv nws tus kheej IDE ua los ntawm Arduino.cc. Cov phiaj xwm yog qhov yooj yim heev thiab yooj yim, qhov no ua rau lwm yam khoom siv thiab cov cuab yeej tso tawm tau yooj yim rau kev cuam tshuam. Nws yog lub platform nrov heev rau lub ntiaj teb kev siv tshuab niaj hnub no. nrhiav cov ntaub ntawv ntxiv txog Arduino los ntawm no: https://www.arduino.cc/en/Guide/Introduction Hauv qhov haujlwm no arduino tau siv los tswj RGB LED kom ci thaum lub password nkag mus muaj tseeb (Lub teeb ntsuab), yog tias tus lej nkag nkag yog qhov cuav ces RGB LED yuav ci liab (Lub teeb liab). Yog li cov arduino tseem tab tom nyeem cov yuam sij nkag los ntawm cov keyboard kom tau tus password.

4x4 Matrix keypad:

Matrix Keypad yog ib lub cuab yeej nrov tshaj plaws uas siv los nkag tus lej lossis lej-tus lej. Lub sij hawm matrix tuaj vim tias cov keypad cov hloov pauv sab hauv tau txuas nrog rau ib leeg hauv cov lej ntawm 'Kab thiab Kab'. 4x4 qhia tus lej ntawm Kab thiab Kab hauv cov keyboard. Ntawm no cov keyboard yog cov khoom siv uas txuas ncaj qha rau arduino. Qhov no ua haujlwm qhov tseem ceeb nias. Pab nkag mus rau cov ntaub ntawv rau micro-maub los. Ntawm no peb tab tom siv 4x4 kab thiab kab ntawv sib txuas uas muaj 16 tus yuam sij feem.

RGB coj:

RGB sawv rau (Liab, Ntsuab, Xiav). Nws yog 4-pin tso tawm ntaus ntawv. RGB LED zoo ib yam li ib txwm LED, tab sis xim tuaj yeem sib txawv raws qhov peb xav tau. Nws muaj 4-pins, txhua tus rau Liab, Ntsuab & Xiav, lwm qhov dhau los ua ib qho rau peb xim no. Muaj ob hom: Common anode thiab common cathode. Ntawm no peb tab tom siv cov duab anode ntau, Yog li tus pin sib xws yuav mus rau qhov muab khoom zoo lossis 3.3-5V cov tswv yim los ntawm Arduino board. Peb yuav siv ob xim (Liab thiab Ntsuab), yog li RED thiab GREEN tus pin txuas nrog Arduino ntawm qhov txwv tam sim no tiv thaiv, tshwj tsis yog BLUE pin.

Resistor:

Resistor yog ob tus pin passive tivthaiv siv los txwv qhov ntws ntawm hluav taws xob tam sim no. Chav tsev ntawm Resistor yog Kuj thiab nws ntsuas hauv (ohms). Hauv qhov haujlwm no ob 330ohm resistor tau siv hla Ntsuab Red tus pin ntawm RGB LED daim ntawv arduino D10 & D11 feem. Qhov laj thawj uas kuv tau siv tus tiv thaiv vim tias los tiv thaiv LED los ntawm qhov siab tam sim no. qee zaum txuas nrog LED yam tsis muaj kev txwv tam sim no yuav ua kom sov lub LED lossis txawm tias hlawv yog tias nws nkag siab.

Ntau 'meter':

Ntau lub ntsuas siv los ntsuas qhov ntsuas hluav taws xob ntawm cov khoom siv xws li resistors, capacitors, inductors, diode, zaus, lub voj voog ua haujlwm, thiab lwm yam. Kuv tau siv cov cuab yeej no txhua lub sijhawm kuv ua haujlwm. Kuv muaj DMM (Digital Multi Meter) ob qho tib si. Cov cuab yeej no muaj lwm qhov ua tau zoo lub npe 'Continuity mode' hauv hom no peb tuaj yeem sim cov hlau txuas txuas mus, ntsuas luv Circuit Court, thiab lwm yam.. (qhov ntsuas no tsis yog qhov tseem ceeb yuav tsum tau ua hauv txoj haujlwm no, kuv tsuas yog qhia rau koj paub txog Multi meter.)

Cov Cim:

  • LED - Lub teeb Emitting Diode.
  • RGB - Liab Ntsuab Ntsuab LED.
  • USB - Universal Serial Bus.
  • IDE - Ib puag ncig kev txhim kho ib puag ncig,
  • CPU - Chaw Ua Haujlwm Hauv Nruab Nrab.
  • EEPROM - Electrically Erasable Programmable Read -only Memory.
  • SRAM - Static Random Access Memory.
  • I/O - Cov tswv yim thiab cov zis.
  • DMM - Digital Multi -Meter.
  • VCC - qhov hluav taws xob qhov hluav taws xob ntawm koj pawg thawj coj. eg: VCC = 5V.
  • GND - Hauv av lossis tseem ceeb.
  • LCD - Kua Crystal Zaub.

Kauj Ruam 3: Nruab Arduino IDE thiab Ntxiv 'Keypad' Library

Nruab Arduino IDE thiab Ntxiv 'Keypad' Library
Nruab Arduino IDE thiab Ntxiv 'Keypad' Library
Nruab Arduino IDE thiab Ntxiv 'Keypad' Library
Nruab Arduino IDE thiab Ntxiv 'Keypad' Library

Nco tseg: Hla cov theem no yog tias koj twb tau teeb tsa Arduino IDE thiab ntxiv 'Password Library' & 'Keypad library' hauv koj lub computer.

Yog tias koj tsis muaj Arduino software, password library thiab Keypad library, ces koj tuaj yeem rub tawm nws hauv theem no. Kuv tau ua tej yam yooj yim rau koj. Txhawm rau rub tawm tsuas yog nyem rau ntawm Hyper-txuas lo lus "HERE". Rub tawm Arduino IDE raws li koj qhov kev xav tau.

  • Koj tuaj yeem rub tawm Qhov Tseeb Arduino IDE los ntawm HERE.
  • Koj tuaj yeem rub tawm 'Keypad' Lub Tsev Qiv Ntawv ntawm no.
  • Koj tuaj yeem rub tawm 'Lo lus zais' Lub Tsev Qiv Ntawv ntawm no.

Cov kauj ruam ntxiv rau 'Keypad' lub tsev qiv ntawv:

Qhib arduino IDE >> hauv kab ntawv qhia zaub mov nyem rau 'Sketch' >> suav nrog Lub Tsev Qiv Ntawv >> ntxiv.zip tsev qiv ntawv >> tam sim no xaiv cov ntawv 'keypad.zip' uas koj tau rub tawm yav dhau los >> Tom qab ntawd nyem rau 'qhib'.

Nrog koj zoo siab! koj nyuam qhuav ntxiv lub tsev qiv ntawv rau hauv koj Arduino IDE.

Yog tias koj tseem muaj teeb meem tom qab ntawv xa email tuaj, koj tuaj yeem xa tuaj ncaj qha los ntawm NO

Yog tias koj tau ua tiav nrog txhua cov kauj ruam no ces cia txav mus ntxiv ….

Kauj Ruam 4: Txuas Cov Qauv & Npaj Khoom Kho Vajtse

Txuas Cov Qauv & Npaj Khoom Kho Vajtse
Txuas Cov Qauv & Npaj Khoom Kho Vajtse
Txuas Cov Qauv & Npaj Khoom Kho Vajtse
Txuas Cov Qauv & Npaj Khoom Kho Vajtse
Txuas Cov Qauv & Npaj Khoom Kho Vajtse
Txuas Cov Qauv & Npaj Khoom Kho Vajtse

Cia peb pib tsim cov Circuit …

TSWV YIM: Siv cov xim sib txawv rau cov xov hlau kom txo qis qhov tsis meej pem. Txheeb xyuas qhov txuas ntawm cov xaim uas koj siv, qhov no ua rau kev daws teeb meem yooj yim dua. Koj tuaj yeem tshawb xyuas qhov txuas ntxiv los ntawm kev siv Multi meter.:)

Hauv Circuit no, kev sib txuas yog raws li hauv qab no;

LED thiab ARDUINO

  • Liab LED tus pin -----> D11 ntawm 330ohm resistor.
  • Ntsuab LED tus pin-> D10 ntawm 330ohm resistor.
  • LED's +Ve ----------> 3.3v.

KEYPAD thiab ARDUINO

  • Tus kab thib 1 -------> D2.
  • Tus kab thib 2 -------> D3.
  • Tus kab thib 3 --------> D4.
  • Tus kab thib 4 --------> D5.
  • 1st Column pin ----> D6.
  • 2nd Column pin ---> D7.
  • Kab 3 tus pin ----> D8.
  • 4 Kab tus pin ----> D9.

Ua tib zoo saib cov Circuit thiab txuas lub Circuit Court raws li daim duab qhia hauv Circuit.

TSWV YIM: Ua ntej txuas koj lub xov tooj mus rau lub zog siv, txheeb xyuas qhov txuas ntawm VCC/+V thiab GND hauv koj qhov Circuit. Yog tias lub suab nrov nrov tau hnov los ntawm ntau lub 'meter' ces muaj qhov luv hauv koj lub Circuit Court (kev pheej hmoo). Yog tias tsis muaj lub suab beep ces tsis muaj hluav taws xob luv.:)

Tom qab tsim lub Circuit Court, peb muaj txhua yam npaj rau kev ua haujlwm. Ua ntej mus rau ntu ntu kev qhia, Yog tias koj xav tau khoom noj txom ncauj lossis kas fes so tom ntej …, tom qab ntawv cia nkag mus rau ntu ntu nrog lub siab tshiab.

Kauj ruam 5: Programming Arduino thiab Xeem

Programming Arduino thiab Xeem
Programming Arduino thiab Xeem
Programming Arduino thiab Xeem
Programming Arduino thiab Xeem
Programming Arduino thiab Xeem
Programming Arduino thiab Xeem
Programming Arduino thiab Xeem
Programming Arduino thiab Xeem

Txais tos rov qab!….

Cia peb pib Program Arduino.

Nco tseg: Txhawm rau nkag siab qhov program zoo dua, Kuv tau braked tus lej rau hauv ib qho me me thiab piav qhia nws txoj haujlwm. Kuv tau txuas daim ntawv thov program hauv qib no. Koj tuaj yeem rub nws thiab qhib ncaj qha tus lej hauv koj lub computer.

txoj cai no muaj plaub ntu tseem ceeb sib txawv,

  • Teeb lub voj: tshaj tawm cov tswv yim, cov txiaj ntsig thiab lwm yam zoo li Serial.begin, thiab lwm yam.. (tseem ceeb)
  • Void loop: rau cov haujlwm uas yuav tsum tau khiav/ua mus ib txhis. (tseem ceeb)
  • Cov keypad tshwm sim: txhawm rau nyeem cov yuam sij nias thiab khaws tus yuam sij nias rau lub hom phiaj siv tau ntxiv.
  • Txheeb xyuas tus password () kev tshwm sim: Nov yog lub qhov ntawm tus password rau kev txheeb xyuas lub hom phiaj. Txoj cai yuav nthuav tawm ntxiv yog tias tus lej nkag nkag nkag yog qhov tseeb lossis tsis raug.

Kuv tau siv LED los tso saib huab cua tus password nkag mus yog qhov tseeb lossis tsis raug. Lub Teeb Ntsuab los thaum lo lus zais muaj tseeb lwm tus liab LED yuav tsa los hais lo lus zais tsis raug. Koj tuaj yeem siv txawm tias txuas lossis lub cev siv qhov chaw ntawm LED. Yog li koj tuaj yeem tswj lub qhov rooj lossis cov khoom siv nrog tus password.

uas yog txhua yam hais txog qhov program ntawm arduino… upload cov cai.

Kauj Ruam 6: Lub Sijhawm Lom Zem

Lub Sijhawm Lom Zem
Lub Sijhawm Lom Zem
Lub Sijhawm Lom Zem
Lub Sijhawm Lom Zem
Lub Sijhawm Lom Zem
Lub Sijhawm Lom Zem

Yepiee … peb tau ua nws.. Nrog koj zoo siab!

Cia peb txaus siab rau txoj haujlwm no, nkag mus rau tus lej zais tsis raug paub, siv qee yam khoom siv tso tawm dua li LED. Tshawb xyuas lub tsev qiv ntawv uas peb tau rub tawm yav dhau los, muaj ntau cov ntsiab lus nthuav hauv cov tsev qiv ntawv, cuam tshuam rau lawv kom tau txais qee qhov kev xav tshiab thiab txaus siab rov ua nws. Nws yog qhov lom zem heev hauv kev ua txhua yam ntawd thiab hais tias EUREKA !!. Bombastic …… nyeem ntxiv

Kuv tab tom cuam tshuam nrog LCD raws li kuv tau nce qib rau txoj haujlwm no thiab tau qhia rau koj paub dua.um.. Qhia rau kuv, dab tsi ntxiv nrog LCD rau qhov txuas ntxiv ntawm qhov haujlwm no. Koj tuaj yeem tawm tswv yim hauv qab no.

Thiab yog, yog tias koj hais mav tau ntsib ib qho teeb meem yooj yim ces dhia dej mus rau theem tom ntej ib yam nkaus. Kuv tau suav nrog Troubleshooting cov kauj ruam, thiab raws li kuv tau hais thaum pib, Muaj ib txoj hauv kev rau cov pib tshiab….

Ua tsaug txhua tus…..:

Kauj Ruam 7: Troubleshooting thiab Qhia

Thov tsis txhob yig nug kuv ua xyem xyav ntawm phau ntawv qhia rau kev daws teeb meem. Koj tuaj yeem xa ntawv ncaj qha rau kuv ntawm no. Koj tuaj yeem hais tawm hauv qab no, kuv nrog cov ntawv qhia yuav sim daws koj cov teeb meem kev daws teeb meem.

  • Kev suav sau yuam kev: rov qhib lub qhov rais, thiab sim dua. Yog tseem ua ntxiv ces cov cai yuav yuam kev.
  • Kev xa tawm yuam kev: txheeb xyuas cov laug cam muaj los ntawm cov ntawv qhia bar Cov cuab yeej >> laug cam. & Chaw nres nkoj.
  • Chaw nres nkoj tsis kuaj pom: dua qhov no yuav yog qhov teeb meem qub xyuas rau cov laug cam thiab chaw nres nkoj, sim rov pib dua qhov system.
  • board tsis pom: txheeb xyuas cov laug cam muaj los ntawm cov ntawv qhia zaub mov Cov cuab yeej >> laug cam. & Chaw nres nkoj. dua.

yog tias qhov program tau ua tiav xa mus rau arduino ces;

Pom Qhov Tsis raug yuam sij nias hauv Serial monitor: Txheeb xyuas cov keyboard txuas thiab xoob kev sib txuas, tom qab ntawd txheeb xyuas txoj cai nyob hauv huab cua matrix zaub koj tau nkag tus lej lej tsis raug

Phau ntawv qhia rau Beginners:

Cov neeg, ua ntej 3 xyoos kuv zoo ib yam li koj tam sim no, tsis paub dab tsi yog tus tiv thaiv, arduino IDE, tsev qiv ntawv thiab lwm yam. Tam sim no kuv yog Mechatronics Engineer. Raws li tus kheej tau kawm txog arduino. Kuv tuaj yeem nkag siab cov teeb meem uas pib muaj …

Kuv tau txuas daim PDF rau koj nyeem. Koj tuaj yeem pib los ntawm phau ntawv ntawd thiab. Kuv ua qhov haujlwm no kom nkag siab yooj yim rau koj ib yam, suav nrog qhov program. tawm tswv yim hauv qab no yog tias koj muaj kev ua xyem xyav Ua qhov haujlwm no. Qhov Zoo Tshaj Plaws.

Pom zoo: