Cov txheej txheem:

Web IR Chaw Taws Teeb Nrog Esp8266 (NodeMCU): 4 Cov Kauj Ruam
Web IR Chaw Taws Teeb Nrog Esp8266 (NodeMCU): 4 Cov Kauj Ruam

Video: Web IR Chaw Taws Teeb Nrog Esp8266 (NodeMCU): 4 Cov Kauj Ruam

Video: Web IR Chaw Taws Teeb Nrog Esp8266 (NodeMCU): 4 Cov Kauj Ruam
Video: Data Science with Python! Extracting Metadata from Images 2024, Kaum ib hlis
Anonim
Web IR Chaw Taws Teeb Nrog Esp8266 (NodeMCU)
Web IR Chaw Taws Teeb Nrog Esp8266 (NodeMCU)

Teeb meem

Muaj peb qhov chaw nyob ntawm lub rooj ntawm chav nyob. Txhawm rau saib koj cov yeeb yam uas koj nyiam koj yuav tsum ua raws cov ntu tshwj xeeb ntawm khawm thawb ntawm tsawg kawg ob ntawm lawv. Thiab koj tus phooj ywg nyob hauv tsev, niam, tus hluas nkauj yeej tsis nco qab qhov ntawd..

Tshuaj

Koj yuav Logitech Harmony;-)

Tab sis yog tias koj tsis xav siv cov nyiaj no koj tuaj yeem tsim qee yam zoo sib xws rau qis dua 10 $. Los ntawm kev txuas lub infrared LED mus rau ESP8266 (zoo ib yam li Arduino tab sis nrog WiFi onboard) peb tuaj yeem yooj yim tsim cov cuab yeej uas peb tuaj yeem tswj cov cuab yeej nrog lub vev xaib me me los ntawm ib lub computer lossis xov tooj ntawm tes hauv koj li WiFi.

Koj xav tau dab tsi

  • NodeMCU pawg thawj coj loj (lawv xa los ntawm Asia rau <5 €)
  • IR sensor (OS-1838B or TSOP38238)
  • IR LED
  • 100 Ω Resistor
  • NPN Transistor (piv txwv li 2N2222)
  • me me ntawm tsab PCB
  • plaub tus pin txuas uas haum rau ntawm NodeMCU (piv txwv li lub floppy disk fais fab adapter)

Yog tias koj muaj lub qub chaw nyob tej zaum koj tuaj yeem siv IR LED thiab transistor los ntawm nws.

Kauj Ruam 1: Sib dhos Cov Khoos Phis Tawj

Sib dhos Cov Khoos Phis Tawj
Sib dhos Cov Khoos Phis Tawj
Sib dhos kho vajtse
Sib dhos kho vajtse
Sib dhos Cov Khoos Phis Tawj
Sib dhos Cov Khoos Phis Tawj
Sib dhos Cov Khoos Phis Tawj
Sib dhos Cov Khoos Phis Tawj

Sib sau ua ke cov khoom ntawm ib qho me me ntawm ib qho me me ntawm cov qauv ntawm pawg thawj coj saib thiab txuas cov khoom siv raws li qhia hauv daim duab.

Nyob ntawm LED qhov kev tiv thaiv tiv thaiv kuj yuav tsis muaj qhov xav tau. Yog tias koj pom tias koj yuav tsum muaj lub hom phiaj zoo tiag tiag lossis yuav tsum nyob ze rau lub cuab yeej koj tuaj yeem tshem nws tau.

Kuv txuas txhua yam rau lub ntsaws Kuv tshem tawm ntawm lub PC tawg lub zog hloov pauv (ib qho rau lub floppy disk).

Kauj Ruam 2: Txhim Kho Daim Ntawv Thov ntawm NodeMCU

Teeb tsa koj ib puag ncig los sau cov haujlwm rau esp8266 nrog Arduino IDE: [https://github.com/espressif/arduino-esp32

Clone lossis rub tawm qhov chaws ntawm daim ntawv thov los ntawm github chaw cia khoom

Hauv Arduino IDE, teeb tsa lub tsev qiv ntawv IRremoteESP8266 (Ntawv qhia zaub mov: Sketch -> Tswj Cov Tsev Qiv Ntawv). Luam cov ntaub ntawv config.h.example thiab lub npe no luam config.h. Koj yuav tsum tsawg kawg qhia SSID thiab Password ntawm koj li WiFi hauv config.h kom tuaj yeem txuas mus rau lub vev xaib. Arduino Sketch yuav tsum tam sim no tuaj yeem muab tso ua ke thiab tso tawm. Txuas lub rooj tsav xwm tawg uas koj tau tsim rau 3V, Hauv av, D5, D6.

Yog tias txhua yam ua haujlwm thiab koj tau ua lub nti txuas nrog Arduino IDE koj yuav tsum tau muab tso tawm IP-chaw nyob uas tus neeg rau zaub mov tau ua haujlwm nyob hauv kab ntawv saib.

Kauj Ruam 3: Customizing HTML-nplooj ntawv los tswj NodeMCU

Cov txheej txheem hauv cov kauj ruam no tseem tau qhia hauv video.

Hauv cov npe kab ntawv tseem muaj 'ir.html'. Yog teeb tsa kom raug qhov no yuav 'tham' rau NodeMCU.

Yog li thawj kauj ruam yog qhia cov ntaub ntawv hauv qab qhov chaw nyob nws tuaj yeem pom NodeMCU. Open ir.html cov ntawv hauv kab ntawv sau thiab tshawb nrhiav kab zoo li no:

var tus tswv = '192.168.2.121';

Hloov tus nqi nruab nrab ntawm cov zuam kom phim qhov chaw nyob web server luam tawm ntawm tus saib xyuas tom qab pib.

Kev Sau Npe Nyeem Cov Ntaub Ntawv ButtonPoint cov chaw taws teeb tswj ntawm lub sensor thiab nias lub khawm xav tau ntawm cov chaw taws teeb Cov ntawd yog lub sijhawm ntawm lub teeb liab rau lub pob ntawd koj nias ntawm lub chaw taws teeb.

Teeb tsa Cov Lus txib

Tam sim no peb xav tau ib txoj hauv kev xa cov teeb liab nrog cov sijhawm los ntawm cov nti nws tus kheej. Txog qhov ntawd peb yuav tsum ntxiv cov sijhawm peb nyuam qhuav sau rau hauv cov npe ntawm cov cim paub. Luam qhov tseem ceeb (suav nrog cov kab zauv square) uas cov txheej txheem kaw tseg muab rau koj thiab ntxig kab tshiab nrog lub npe thiab qhov tseem ceeb hauv ir.html cov ntawv tom qab kab zoo li no:

var cov = {

"pgr1 btn": [1, 2, 3], Hloov 1, 2, 3 nrog cov txiaj ntsig sau tseg thiab tsis txhob hnov qab tus lej tom qab cov kab zauv nyob ib puag ncig. Txhawm rau ntxiv lub pob peb kuj yuav tsum tau hais kom ua ntxiv. Cov lus txib tuaj yeem suav nrog ntau lub cim txij li peb yuav tau 'nias' ntau lub nyees khawm ntawm cov chaw taws teeb, piv txwv li 1 thiab 2 kom ncav cuag channel 12 hauv TV. Qhov no tseem tso cai tswj ntau lub cuab yeej nrog ib qho lus txib. Nrhiav kab ntawv zoo li no

"Suab rau/tawm": ["hais tsis tau"], Luam kab ntawd thiab hloov cov ntawv "Suab rau/tawm" kom phim qhov koj xav pom ntawm lub pob tshiab. Hloov lub npe "ntsiag to" rau lub npe ntawm cov cim koj tau ntxiv. Yog li qhov tshwm sim tuaj yeem yog:

"HBO": ["prg 1 btn"], Yog tias koj xav ua kom muaj ntau lub cim ntxiv rau lawv zoo li no:

"HBO": ["prg 1 btn", "prg 2 btn"],

Kauj ruam 4: Siv

Tom qab koj tso koj cov kab ke xav tau hauv kab ntawv HTML koj tuaj yeem luam nws mus rau txhua lub khoos phis tawj lossis lub xov tooj ntawm tes uas muaj browser thiab txuas nrog tib lub WiFi zoo li NodeMCU.

Pom zoo: