Cov txheej txheem:
- Khoom siv
- Kauj Ruam 1: Tsim Circuit Court:
- Kauj ruam 2: Code:
- Kauj Ruam 3: Txoj Cai Hauv Qhov tob: Xa IR Cov Cim
- Kauj Ruam 4: Txoj Cai Hauv Qhov tob: Txais IR Cov Cim
- Kauj Ruam 5: Xaus
Video: Universal TV Remote - Ardiuino, Infrared: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:26
Nyob zoo! Hauv cov lus qhia no, kuv yuav qhia koj li cas tsim thiab teeb tsa koj tus kheej thaj chaw deb uas yuav ua haujlwm nrog ntau yam uas siv lub chaw taws teeb infrared, thiab qhov ntawd tseem yuav "mloog" thiab txiav txim siab lub teeb liab infrared xa los ntawm ntau lwm qhov chaw nyob.
Me ntsis keeb kwm yav dhau los ntawm qhov kev tshoov siab kuv los tsim qhov chaw deb no - Kuv, zoo li feem ntau ntawm koj, plam kuv qhov kev hais tawm tas li, thiab qhov xwm txheej no yog kev ntxhov siab heev, yog li kuv xav kom daws nws! Kuv tau tsim cov chaw taws teeb no thiab ua tib zoo nkag nws mus rau hauv kuv lub txaj tsim kev cai (Kuv kuj yog tus ua haujlwm ntoo) - Kuv tsis tuaj yeem plam cov chaw taws teeb yog nws yog ib feem ntawm kuv lub txaj txaj!
Khoom siv
Yam koj yuav xav tau: -Arduino UNO lossis Nano - mais yuav txawv nrog lwm cov laug cam
-Saib tsis tau daim ntawv qhia zaub mov (lossis cov kab laug sab muag tau yog tias koj xav ua kom nws ruaj khov dua)
-Jumperwires ntawm ntau xim thiab ntev
-Momentary laub khawm (5) (koj tuaj yeem ntxiv cov nyees khawm ntxiv, tab sis koj yuav tsum tau siv cov koob digital, zoo li txhua yam tab sis 1 ntawm cov pins sib piv tau siv - koj yuav tsum tau saib xyuas kom ntseeg tau tias koj siv tau zoo rub tawm cov khoom tiv thaiv, los yog rub cov neeg tawm tsam, thiab debounce cov laub khawm)
-10K Ohm resistor (5) (yog tias koj xav tau ntau cov nyees khawm, koj yuav xav tau ntau ntxiv ntawm cov no)
-470 Ohm resistor (2)
-Infrared LED
-LED liab
-Infrared Sensor (Kuv siv tus lej VS1838B, koj tuaj yeem siv lwm tus, tsuas yog txheeb tus pin-out)
(Tsis teb los tau) Soldering Iron, Solder, Solder Flux.
Kauj Ruam 1: Tsim Circuit Court:
1). Kuv ib txwm nyiam pib nrog tso kuv cov khoom, vim qhov no ib txwm tsav cov txheej txheem ntawm lub khob cij.
-Tus khawm
-LEDS: Liab LED thiab IR LED tau txuas ua ke, yog li koj tuaj yeem pom tias IR LED ua dab tsi.
-Sensor
2). Resistors
- Tsib tsib 10K tus tiv thaiv peb tau txuas rau lub laub khawm hu ua "rub tawm" tus tiv thaiv. Rub cov neeg tawm tsam kom ntseeg tau tias thaum lub laub khawm tsis raug nias, tus lej sib txuas Arduino tau txais 0 Volts (lossis tsawg kawg ze rau nws). Yog xav paub ntau ntxiv txog rub qis (lossis rub tawm) resistors ntawm no yog cov lus qhia tob:
www.electronics-tutorials.ws/logic/pull-up…
Cov resistors no yuav tsis yog qhov tsim nyog kiag li, tab sis yog tias koj tau txais "dab" thawb, nws ntau dua qhov tshwm sim los ntawm kev sib txuas ua haujlwm thiab rub cov neeg tawm tsam tiv thaiv qhov no.
3). Cov xov hluav taws xob
4). 5V thiab Av Hlau
Siv daim duab muab rau siv! tsis txhob ntshai hloov nws rau koj cov kev xav tau txawm tias!
Kauj ruam 2: Code:
#include const int RECV_PIN = 7; // IR sensor nyeem tus pin int Button1 = A4; // Nyob deb tshaj plaws Int int Button2 = A3; // 2nd los ntawm sab laug int Button3 = A2; // Nruab nrab int Button4 = A1; // 2nd rau sab xis int Button5 = A0; // Qhov deb tshaj rau sab xis int LED = 3; // IR LED & Liab LED int val = 0; // Hloov tus nqi IRsend xa rov qab; IRrecv irrecv (RECV_PIN); decode_results cov txiaj ntsig;
teeb tsa tsis muaj dab tsi () {pinMode (Button1, INPUT); pinMode (Khawm 2, INPUT); pinMode (Khawm 3, INPUT); pinMode (Button4, INPUT); pinMode (Button5, INPUT); pinMode (LED, NTAWV); Serial.begin (9600); irrecv.enableIRIn (); irrecv.blink13 (tseeb);} void loop () {{{yog (analogRead (Button1)> 900) irsend.sendNEC (0xFF02FD, 32); // siv analog nyeem tsis txhob nyeem digital kom tsis txhob muaj teeb meem kev muaj peev xwm. kuj, pab debounce cov nyees khawm. // Muaj qhov sib piv nyeem ntawm 900 tso cai rau qee qhov wiggle chav hauv qhov muaj txiaj ntsig, lub ntsiab lus, lub teeb liab infra yuav raug xa txawm tias tag nrho 5V tsis siv rau tus pin. // tab sis 900 siab txaus los nyeem tsis tau yuam kev vim muaj peev xwm txuas txuas qeeb (100);} // RGB Sawb On & off {yog (analogRead (Button5)> 900) {rau (int i = 0; i <3; i ++) // hloov tus nqi hauv "i <3" yuav hloov tus lej ntawm lub sijhawm teeb liab rov ua dua tam sim. yog li "i <2" yuav rov ua lub teeb liab ob zaug. // koj yuav xav tau ua si ib puag ncig nrog tus lej no yog tias koj lub TV tsis teb, feem ntau, 1 lossis 3 ua haujlwm feem ntau, yog tias tsis ua, sim cov lej sib txawv. // koj kuj tseem yuav tsum tau ua si nrog lub teeb liab ncua sijhawm ncua sijhawm, piv txwv li, rau kuv TV 10 ua haujlwm, tab sis 30 tsis ua. {irsend.sendSony (0xa90, 12); // Sony TV lub zog fais fab, rau kuv lub TV, tus lej yuav tsum tau xa 3x3, yog li 3 lub mem tes, peb cais lub sijhawm ncua (10); // "intra teeb liab ncua" rau (int i = 0; i <3; i ++) {irsend.sendSony (0xa90, 12); // "12" yog tus lej me me, cov txheej txheem sib txawv hu rau tus lej sib txawv. NEC yog 32, Sony yog 12, koj tuaj yeem saib lwm tus ncua (10); rau (int i = 0; i 900) {rau (int i = 0; i 900) {rau (int i = 0; i 900) {rau (int i = 0; i <3; i ++) {irsend.sendSony (0xc90, 12); // Sony TV lub hwj chim Volume Down qeeb (100);}}} ncua (100);} yog (irrecv.decode (& cov txiaj ntsig)) // ntu hauv qab ntawm cov cai tso cai rau koj txhais Infra liab teeb liab los ntawm ntau yam kev nyob deb. {Serial.println (results.value, HEX); // nws yuav tsim cov txheej txheem "NEC, Sony, Etc.." thiab TV code "c90, a90, FF02FD" koj yuav tsum tau ntxiv 0x rau pem hauv ntej ntawm TV Code hloov (results.decode_type) {case DENON: Serial.println ("DENON"); tawg; case NEC: Serial.println ("NEC"); tawg; case PANASONIC: Serial.println ("PANASONIC"); tawg; rooj plaub SONY: Serial.println ("SONY"); tawg; rooj plaub RC5: Serial.println ("RC5"); tawg; rooj plaub JVC: Serial.println ("JVC"); tawg; rooj plaub SANYO: Serial.println ("SANYO"); tawg; rooj MITSUBISHI: Serial.println ("MITSUBISHI"); tawg; case SAMSUNG: Serial.println ("SAMSUNG"); tawg; rooj plaub LG: Serial.println ("LG"); tawg; rooj plaub RC6: Serial.println ("RC6"); tawg; rooj DISH: Serial.println ("DISH"); tawg; rooj plaub SHARP: Serial.println ("SHARP"); tawg; rooj WHYNTER: Serial.println ("WHYNTER"); tawg; case AIWA_RC_T501: Serial.println ("AIWA_RC_T501"); tawg; default: case UNKNOWN: Serial.println ("UNKNOWN"); tawg;} irrecv.resume ();}}
Kauj Ruam 3: Txoj Cai Hauv Qhov tob: Xa IR Cov Cim
Kuv yuav hais txog kab ntawm cov lej los ntawm lawv tus lej kab - ua raws, siv qhov txuas no:
pastebin.com/AQr0fBLg
Ua ntej, peb yuav tsum suav nrog IR Cov Tsev Qiv Ntawv Los ntawm z3t0.
Nov yog qhov txuas rau lub tsev qiv ntawv:
github.com/z3t0/Arduino-IRremote
Yog tias koj xav tau phau ntawv qhia yuav ua li cas rub tawm lub tsev qiv ntawv kom raug thiab teeb nws hauv IDE:
www.arduino.cc/en/guide/libraries
Kab 1 suav nrog lub tsev qiv ntawv.
Tom ntej no, peb yuav tsum tshaj tawm ob peb qhov hloov pauv, kab 2-12 ua qhov no.
Peb siv "tus nqi int" txhawm rau txheeb xyuas cov kev hloov pauv uas yuav tsis hloov pauv, txhua qhov tab sis ib qho poob hauv pawg no.
Peb siv "int" txhawm rau txheeb xyuas qhov sib txawv uas yuav hloov pauv.
Peb yuav tsum siv tus pin nrog mem tes nrog kev hloov pauv (PWM) rau peb tus pin LED - txhua tus pin uas muaj "~" ib sab ntawm nws yuav txaus, hauv kuv tus lej - peb siv tus lej digital 3.
Tom ntej no, peb yuav tsum ua qee qhov teeb tsa - cov cai no yuav ua haujlwm ib zaug thaum Arduino tau qhib lossis rov pib dua.
Daim ntawv ceeb toom tias peb tab tom txiav txim siab peb cov tswv yim thiab cov txiaj ntsig (15-20), tua lub tshuab saib ua ntu zus (21), ua rau IR sensor (22), thiab qhia rau Arduino kom ntsais lub onboard LED txhua lub sijhawm peb tau txais lub teeb liab hauv lub sensor (23).
Tom ntej no, peb yuav tsim tawm peb lub voj - cov cai no yuav rov ua dua, mus los ntawm sab saum toj mus rau hauv qab ob peb zaug me ntsis.
Ntawm kab 25, peb siv cov lus hais, qhov no qhia rau Arduino "saib rau cov txheej txheem tshwj xeeb no, yog tias ua tau raws cov qauv no, ua qhov tshwj xeeb no". Hauv qhov no, cov txheej txheem yog analogRead (Button1)> 900, lossis hauv lwm lo lus - "Arduino, Saib ntawm button1, uas peb tau hais tseg raws li tus pin A4 ua ntej, yog tias cov teeb liab analog tau txais ntau dua 900, thov mus rau peb cov lus qhia tom ntej, yog tias tsis yog, thov txav mus rau ". Muaj me ntsis los ntim rau ntawm no, yog li cia dhia dej hauv: qhov sib piv ntawm Arduino yog tus nqi sib npaug lossis tsawg dua 5V, nrog 5V sib npaug 1023, thiab 0V sib npaug 0. Txhua qhov muab hluav taws xob ntawm 0 thiab 5V tuaj yeem txhais los ntawm tus lej, thiab nrog lej me ntsis, peb tuaj yeem xam tus lej ntawd, lossis hloov pauv, qhov hluav taws xob. Faib 1024 (peb suav nrog 0 ua ib chav) los ntawm 5, uas muab rau peb 204.8. Piv txwv li, peb siv tus lej 900, los txhais qhov ntawd rau hauv qhov hluav taws xob, peb tsuas faib 900 los ntawm 204.8, muab rau peb ~ 4.4V. Peb tab tom qhia rau Arduino kom nrhiav qhov hluav taws xob ntau dua ~ 4.4 volts, thiab yog tias nws yog, ua peb cov lus qhia tom ntej.
Hais txog cov lus qhia tom ntej (kab 25), peb pom irsend.sendNEC (0xFF02FD, 32). Qhov no hais tias "Arduino, xa tus qauv mem tes uas ua raws NEC raws tu qauv, tshwj xeeb yog FF02FD teeb liab, thiab xyuas kom tseeb tias nws 32 ntsis ntev". Qhov no yuav ua rau peb IR LED flicker nyob rau hauv txoj kev uas lwm yam khoom siv tuaj yeem nkag siab. Xav txog nws me ntsis zoo li Morse Code, tab sis tsuas yog nrog lub teeb pom kev! Muaj ntau qhov kev cai sib txawv nyob rau ntawd, txhua qhov nrog ntau pua yog tias tsis ntau txhiab ntawm cov cim tus kheej, thiab txhua tus nrog lawv tus lej tshwj xeeb - peb lub cuab yeej yuav tuaj yeem paub ntau npaum li cas ntawm cov cim no, tab sis peb yuav dhia mus rau tom qab ntawd!
Ntawm kab 28, peb muaj peb thawj zaug ncua - qhov no nyob ntawm no txhawm rau tiv thaiv qhov tsis xav tau rov ua dua cov cim, ib zaug khawm raug thawb thiab IR teeb liab xa mus, peb muaj 100 milliseconds kom tshem peb cov ntiv tes tawm ntawm lub pob. qhov no tsis zoo li lub sijhawm ntau, tab sis hauv kev coj ua, nws zoo li ua haujlwm tau zoo. qhov ua haujlwm qeeb qhia rau Arduino "tsis ua dab tsi rau X milliseconds" thiab rau kev siv, lawv yog 1000 milliseconds hauv ib pliag.
Tsiv mus rau peb lub pob tom ntej ntawm kab 29, khawm 5 (Kuv xub muaj 4 lub nyees khawm ntawm cov chaw taws teeb no, ntxiv ib feem tsib, yog li ntawd yog vim li cas peb thiaj li tsis xaj). Qhov no, hauv siab, yog tib yam li khawm 1, tab sis nrog qee qhov sib txawv tseem ceeb. Thawj qhov sib txawv koj yuav pom yog cov lus tshaj tawm - qhov no yog qhov tseem ceeb lwm lub voj - lub voj nrog nyob hauv lwm lub voj loj, kev nkag siab. Tshwj xeeb peb muaj "rau (int i = 0; i <3; i ++)", nyeem qhov no ua "Arduino, cia pib ntawm 0, rov ua cov lus qhia hauv qab no kom txog thaum peb mus txog 3 zaug". Qhov ua haujlwm tau siv vim tias ntau cov cuab yeej tau teeb tsa los nrhiav lub teeb liab rov ua haujlwm, thiab hauv peb qhov xwm txheej no, 3 zaug. Koj tuaj yeem yooj yim hloov tus lej 3 mus rau tus lej sib txawv yog tias koj lub cuab yeej hu rau lub sijhawm rov ua dua. Lwm qhov sib txawv tseem ceeb nrog khawm 5 yog tias nws tau rov ua dua, 3 zaug, lossis 3x3. Hauv lwm lo lus, peb xa lub teeb liab 3 zaug, tos 10 milliseconds, xa dua 3 zaug, tos lwm 10 milliseconds, thiab tom qab ntawd xa nws 3 zaug ntxiv. Hom kev sib txuas lus no ib txwm muaj rau kev siv lub tshuab ua haujlwm tawm thiab tawm thiab tsuas yog qhov koj lub TV lossis ntaus ntawv hu rau - tus yuam sij rau qhov no yog ua si nrog txhua qhov kev hloov pauv kom txog thaum koj tau txais cov txiaj ntsig xav tau. Hloov tus nqi ncua sijhawm luv, hloov tus nqi rov ua dua, xa 6 pawg hloov ntawm 3, thiab lwm yam. Cov khoom siv tau teeb tsa nrog cov kev cai teeb tsa ncaj ncees txhob txwm ua, xav txog yog tias koj lub TV nyob deb tau xa tib lub teeb liab ib yam li koj lub suab bar; txhua lub sijhawm koj hloov pauv cov channel hauv koj lub TV, koj lub suab kaw kaw - yog vim li cas thiaj muaj cov cai sib txawv.
Peb lub khawm tom ntej no tau teeb tsa nrog tib tus thawj xibfwb, tsawg kawg hauv ib feem, tau piav qhia saum toj no - yog li peb tuaj yeem hla txhua txoj hauv kev mus rau kab 55.
Kauj Ruam 4: Txoj Cai Hauv Qhov tob: Txais IR Cov Cim
Ntawm kab 55, peb pib ua haujlwm Arduino los txhais IR cov cim xa los ntawm lwm qhov chaw nyob - qhov no yog qhov tsim nyog kom koj tuaj yeem txheeb xyuas cov kev cai thiab cov cim qhia tias koj qhov chaw nyob siv. Thawj kab ntawm kab ntawm kab 55 yog tias (irrecv.decode (& cov txiaj ntsig) nyeem qhov no raws li "Arduino, saib rau tus lej IR, yog tias koj pom ib tus, xa tus nqi tseeb, yog tias tsis pom dab tsi, rov qab tsis tseeb. Thaum muaj tseeb, sau tseg cov ntaub ntawv rau hauv "cov txiaj ntsig" ".
Tsiv mus rau kab 56, peb muaj Serial.println (cov txiaj ntsig tus nqi, HEX) qhov no hais tias "Ardunio, luam tawm cov txiaj ntsig hauv kev saib ua ntu zus hauv HEX hom". Hex, lub ntsiab lus hexadecimal, yog txoj hauv kev uas peb tuaj yeem luv txoj hlua binary (tsuas yog 0's thiab 1's) rau qee yam yooj yim me ntsis rau ntaus. Piv txwv li 101010010000 yog "a90", cov cai siv los tso kuv lub TV tawm thiab qhib, thiab 111111110000001011111101 yog 0xFF02FD, uas tswj kuv lub RGB strip. Koj tuaj yeem siv daim duab saum toj no los hloov binary rau hauv hex, thiab hloov pauv, lossis koj tuaj yeem siv qhov txuas hauv qab no:
www.rapidtables.com/convert/number/hex-to-…
Nqes mus rau kab 57, peb muaj txoj haujlwm tshiab, hu ua hloov rooj.
Qhov tseem ceeb, cov ntaub ntawv hloov pauv tso cai rau peb kom qhia cov lus qhia sib txawv raws li cov txiaj ntsig ntawm qhov muab sib txawv (rooj plaub). qhov tawg tawm ntawm cov lus hloov pauv, thiab tau siv qhov kawg ntawm txhua nqe lus.
Peb siv cov ntaub ntawv hloov pauv ntawm no los hloov peb luam tawm li cas hauv kev saib xyuas raws li cov txheej txheem peb Arduino hnov los ntawm ntau yam kev nyob deb.
Kauj Ruam 5: Xaus
Yog tias koj muaj lus nug - thov hu rau kuv ntawm no! Kuv zoo siab sim pab koj zoo tshaj qhov kuv ua tau.
Kuv vam tias koj tau kawm qee yam uas koj tuaj yeem siv los ua kom koj lub neej tsuas yog zoo dua!
-RAB
Pom zoo:
Raspberry Pi - TMD26721 Infrared Digital Proximity Detector Java Qhia: 4 Kauj Ruam
Raspberry Pi-TMD26721 Infrared Digital Proximity Detector Java Tutorial: TMD26721 yog lub tshuab ntsuas hluav taws xob infrared digital uas nyob ze uas muab qhov ua tiav kev txheeb ze sib xws thiab digital interface logic hauv ib qho 8-pin nto mount module.Qhov kev txheeb ze sib xws suav nrog txhim kho teeb liab-rau-suab nrov thiab qhov tseeb Ib pro
Gesture Controlled Universal Remote With Node-MCU: 12 Cov Kauj Ruam
Gesture Controlled Universal Remote With Node-MCU: Nyob zoo txhua tus thiab zoo siab txais tos rau txoj haujlwm no! Kuv yog ib tus neeg tub nkeeg thiab tus neeg tub nkeeg npau suav phem yog saib TV thaum koj paub tias lub chaw taws teeb nyob deb dhau! Kuv paub tias kuv cov chaw taws teeb yuav tsis nyob deb dhau yog tias kuv muaj nws ntawm tes
Infrared Remote Control Tester Siv TSOP4838: 5 Cov Kauj Ruam
Infrared Remote Control Tester Siv TSOP4838: Nov yog yuav ua li cas thiaj tsim tau yooj yim kev tswj chaw taws teeb tester. Tsuas yog ua raws cov theem hauv qab no thiab koj yuav ua nws qis dua 5 feeb. Yog tias nws ua haujlwm ces thov tawm qhov nyiam ntawm peb cov vis dis aus thiab qhia peb hauv cov lus
Universal Remote Control: 3 Kauj Ruam
Universal Remote Control: Universal Infrared (IR) Remote Controller tuaj yeem tswj hwm txhua yam khoom siv uas siv IR kev sib txuas lus rau kev ua haujlwm nyob deb. Cov chaw taws teeb tswj hwm no siv cov gen4-uLCD-35DCT ua lub hauv paus loj rau xa IR cov lus txib. Qhov project no yog customizab heev
Tswj Koj Cov Khoom Siv Hluav Taws Xob Nrog Koj Lub Tv Remote (ir Remote) Nrog Kub thiab Vaum Zaub: 9 Kauj Ruam
Tswj Koj Cov Khoom Siv Hluav Taws Xob Nrog Koj Lub Tv Chaw Taws Teeb (ir Chaw Taws Teeb) Nrog Kub thiab Vaum Zaub: nyob zoo Kuv yog Abhay thiab nws yog kuv thawj blog ntawm Kev Qhia thiab hnub no kuv yuav qhia koj li cas tswj koj cov khoom siv hluav taws xob nrog koj lub TV tej thaj chaw deb los ntawm kev tsim qhov no txoj haujlwm yooj yim. ua tsaug rau atl lab rau kev txhawb nqa thiab muab cov khoom siv