Cov txheej txheem:

Infrared Chaw Taws Teeb thiab IR Txais (TSOP1738) Nrog Arduino: 10 Kauj Ruam
Infrared Chaw Taws Teeb thiab IR Txais (TSOP1738) Nrog Arduino: 10 Kauj Ruam

Video: Infrared Chaw Taws Teeb thiab IR Txais (TSOP1738) Nrog Arduino: 10 Kauj Ruam

Video: Infrared Chaw Taws Teeb thiab IR Txais (TSOP1738) Nrog Arduino: 10 Kauj Ruam
Video: Sib Hawm Dhau (Time Passed) Music Video by: Deeda/Dib Xwb 2024, Kaum ib hlis
Anonim
Infrared Chaw Taws Teeb thiab IR Txais (TSOP1738) Nrog Arduino
Infrared Chaw Taws Teeb thiab IR Txais (TSOP1738) Nrog Arduino

Cov lus qhia no yog rau Arduino pib. Nov yog ib qho ntawm kuv cov phiaj xwm ua ntej nrog Arduino. Kuv nyiam heev thaum kuv ua nws thiab vam tias koj yuav nyiam nws ib yam. Qhov ntxim nyiam tshaj plaws ntawm txoj haujlwm no yog "Wireless control". Thiab qhov ntawd dhau los ntawm ib qho IR chaw taws teeb yooj yim muaj nyob hauv peb lub tsev. Tej zaum nws yuav yog TV chaw taws teeb lossis AC chaw taws teeb lossis lwm yam IR chaw taws teeb. Hauv txoj haujlwm no peb yuav pom txoj hauv kev ua haujlwm ntawm lub chaw taws teeb infrared thiab txiav txim siab nws lub teeb liab nrog kev pab los ntawm ARDUINO thiab TSOP 1738, nws yog lub tshuab txais hluav taws xob thoob ntiaj teb. Qhov TSOP 1738 no ua haujlwm nrog rau feem ntau ntawm cov duab infrared.

Koj tuaj yeem pom qhov project video hauv qhov txuas hauv qab no:

www.youtube.com/embed/0udePvGIIJ8

Kauj ruam 1:

Duab
Duab

Kauj Ruam 2: Cov Lus Cim

Sau ntawv Tech
Sau ntawv Tech

Hauv daim duab thaum kuv nias ib lub pob ntawm cov chaw taws teeb koj tuaj yeem pom lub teeb liab liab LED ntsais muag. txhais tau hais tias cov chaw taws teeb tso lub teeb liab infrared thaum twg kuv nias lub pob. Txawm li cas los peb tsis tuaj yeem pom lub teeb no nrog qhov muag liab qab.

Lub teeb liab no muaj pawg ON thiab OFF lossis koj tuaj yeem hais HIGH thiab LOW. Peb tuaj yeem hu pawg no ntawm ON thiab OFF raws li cov qauv teeb liab. Txhua lub khawm nws muaj nws tus qauv tshwj xeeb. Yog li thaum twg peb nias lub pob tshwj xeeb peb tau txais cov cim tshwj xeeb uas tau muab rau lub pob ntawd nkaus xwb. Yog li qhov no yog txhua yam hais txog IR chaw taws teeb.

Tam sim no nws yog lub sijhawm tau txais lub teeb liab. Peb lub hom phiaj yog txhawm rau txheeb xyuas cov cim siab thiab qis li 1 thiab 0. Hauv qhov no peb tuaj yeem hloov cov qauv teeb liab mus rau hauv cov ntaub ntawv. ARDUINO thiab TSOP 1738 yuav ua qhov ntawd rau peb.

Lub tshuab txais hluav taws xob yuav tau txais lub teeb liab los ntawm tej thaj chaw deb thiab muab rau arduino. Tom qab ntawd arduino yuav tshuaj xyuas lub teeb liab tau txais thiab hloov nws mus rau hauv cov ntaub ntawv hex. Thaum peb hloov lub teeb liab infrared rau hauv cov ntaub ntawv, peb tuaj yeem yooj yim txheej txheem cov ntaub ntawv ntawd thiab ua txhua txoj haujlwm raws li qhov peb xav tau.

Kauj Ruam 3: Txiav Txim Koj Txoj Haujlwm Tswj

Txiav txim siab koj txoj haujlwm tswj hwm
Txiav txim siab koj txoj haujlwm tswj hwm

Hauv qhov xwm txheej no lub hom phiaj yog tswj hwm digital digital output ntawm Arduino nrog lub TV nyob deb. Los sawv cev digital HIGH/LOW Kuv tau siv 3 LEDs - Liab, Daj thiab Ntsuab. Cov kev ua raws cai muaj raws li hauv qab no:

Qhib 'ON' LEDs hauv ib ntu tshwj xeeb (RED, GREEN, BLUE) thaum khawm "Volume up" khawm txhua lub sijhawm.

Qhib 'OFF' LEDs hauv ib ntu tshwj xeeb (XEEB, GREEN, RED) thaum lub pob "Volume down" raug nias txhua lub sijhawm.

Tab sis cov nyees khawm saum toj no yuav ua haujlwm tsuas yog thaum lub kaw lus qhib los ntawm nias ON/OFF khawm. Yog tias koj nias lub ON/OFF khawm thaum lub kaw lus twb ON lawm ces tag nrho lub kaw lus yuav kaw thiab tua tag nrho cov LEDs.

Thov saib Algorithm kom nkag siab zoo dua.

Kauj Ruam 4: Cov Khoom Npe

Cov Khoom Siv
Cov Khoom Siv
Cov Khoom Siv
Cov Khoom Siv
Cov Khoom Siv
Cov Khoom Siv
Cov Khoom Siv
Cov Khoom Siv

IR chaw taws teeb tswj: Koj tuaj yeem siv ib qho IR chaw taws teeb muaj nyob hauv koj lub tsev. Lossis koj tuaj yeem yuav nws.

IR receiver: 1 tsis. TSOP 1738 sensor uas yooj yim muaj nyob hauv khw muag khoom online.

Resistor: tsis muaj. 330 ohm resistor thiab 3 nos. 220 ohm resistor

Arduino maub los: 1 tsis muaj. Arduino UAS. Lwm lub Rooj Tswjhwm Saib Arduino yuav ua haujlwm zoo rau txoj haujlwm no.

LEDs: 3 nos. 5mm LEDs ntawm cov xim sib txawv (Liab, Daj, Ntsuab)

Jumper hlau: qee lub xov hlau jumper (txiv neej-txiv neej).

Breadboard: Tsis muaj. puv lossis ib nrab me me breadboard.

Thiab tau kawg lub hwj chim cable ntawm arduino xav tau. Tsis xav tau cov cuab yeej tshwj xeeb lossis cov cuab yeej tshwj xeeb rau txoj haujlwm no.

Txog software koj yuav xav tau Arduino IDE teeb tsa hauv koj lub PC lossis laptop.

Kauj Ruam 5: Txhim Kho Software

Kev Txhim Kho Software
Kev Txhim Kho Software
  • Yog tias koj tsis muaj Arduino IDE ces koj tuaj yeem tshawb xyuas lub vev xaib raug cai ntawm Arduino. Koj yuav pom qhov txuas nyob ntawd.
  • Tsis tas li koj yuav tsum rub tawm "IRremote" lub tsev qiv ntawv los ntawm github thiab luam rau lub tsev qiv ntawv tais ceev tseg ntawm arduino IDE.
  • Upload cov duab "IRrecvDemo.ino" los ntawm qhov piv txwv ntawm IRremote lub tsev qiv ntawv.
  • Txheeb xyuas lub rooj tsavxwm lub npe thiab chaw nres nkoj COM ua ntej rub tawm.

Kauj Ruam 6: TSOP1738 Circuit

TSOP 1738 Circuit
TSOP 1738 Circuit
TSOP 1738 Circuit
TSOP 1738 Circuit

Tuav lub ntsej muag oval ntawm TSOP1738 tig mus rau koj. Tam sim no sab laug feem ntau tus pin yog Ground pin. Tus pin tom ntej yog Vcc (5V DC) thiab txoj cai feem ntau tus pin yog cov ntaub ntawv tus pin. Thov saib tus pin tawm daim duab kom nkag siab zoo.

Txuas GND tus pin rau ib qho ntawm GND tus pin ntawm Arduino UNO.

Txuas Vcc tus pin nrog 5V tus pin ntawm Arduino UNO.

Txuas 330 Ωresistor rau cov ntaub ntawv tus pin ntawm TSOP 1738. Tom qab ntawd txuas lwm ceg ntawm tus tiv thaiv rau Arduino tus pin 2.

Kauj Ruam 7: Nco HEX Code ntawm Nyees khawm

Nco tseg HEX Code ntawm Nyees khawm
Nco tseg HEX Code ntawm Nyees khawm

Tam sim no qhib lub ntsuas saib thiab nias cov nyees khawm los ntawm tej thaj chaw deb. Koj yuav pom HEX cov cai ntawm txhua lub khawm ntawm tus saib xyuas.

Nco tseg qhov HEX code ntawm cov nyees khawm uas koj xaiv.

Kauj Ruam 8: Tso Tawm LED Circuit

Tawm LED Circuit
Tawm LED Circuit
Tawm LED Circuit
Tawm LED Circuit

Ntxiv cov hluav taws xob LED tso tawm nrog TSOP Circuit uas twb muaj lawm.

Txuas cov npav hauv av mus rau Arduino UNO GND. Nws yog cov kauj ruam yooj yim thiab me me tab sis tseem ceeb.

Tam sim no, Muab tag nrho 3 LEDs hauv RED - GREEN - BLUE ua ntu zus. Txuas 220 Ω resistors nruab nrab ntawm –VE ceg ntawm txhua LED thiab Av tsheb npav.

Txuas +VE ceg liab, ntsuab thiab xiav LED rau tus pin 7, 6 thiab 5 ntawm arduino feem.

Kauj Ruam 9: Sketch thiab Algorithm

Thov saib cov txheej txheem hauv Kauj Ruam 2 kom nkag siab cov duab kos hauv txoj hauv kev yooj yim. Txawm li cas los xij, tag nrho cov duab kos muaj kab ntawm kab lus piav qhia hauv daim duab nws tus kheej.

Thov rub daim duab los ntawm qhov link hauv qab no. Koj yuav tsum hloov HEX cov lej hauv daim duab nrog koj tus lej HEX uas koj twb tau sau tseg hauv KAUJ RUAM 6.

Rub cov duab kos "IR_Test.ino" rau Arduino.

Txheeb xyuas lub rooj tsavxwm lub npe thiab com chaw nres nkoj ua ntej rub tawm.

Kauj ruam 10: Kev ua tiav

Tiav
Tiav

Tam sim no siv cov nyees khawm nyob deb kom ua haujlwm LEDs raws li koj xav tau.

Ntxiv:

  • Koj tuaj yeem siv 5V DC txuas mus rau lwm lub cuab yeej siv hauv tsev nrog lub TV nyob deb.
  • Thov qhia koj cov kev xav thiab tswv yim hauv kab lus.
  • Nws raug nquahu kom txheeb xyuas cov ntaub ntawv thiab tus pin tawm muaj los ntawm tus muag khoom ntawm koj lub TSOP sensor. Muaj ntau hom TSOP sensors muaj nyob hauv khw. Pin tawm yog qhov sib txawv hauv txhua kis. Ib txhia ntawm lawv tuaj nrog txhuas npog. Qee qhov yuav zoo sib xws tab sis tus pin sib txawv. Yog li ua tib zoo saib ua ntej lub hwj chim.

Pom zoo: