Cov txheej txheem:
- Kauj ruam 1: Kho vajtse
- Kauj ruam 2: Kev sib txuas
- Kauj ruam 3: Telegram Bot
- Kauj ruam 4: Software
- Kauj ruam 5: Yees duab (hauv Ukrainian)
Video: Telegram Nplaim Tswb Bot: 5 Kauj Ruam
2024 Tus sau: John Day | [email protected]. Kawg hloov kho: 2024-01-30 09:24
Hauv kab lus no kuv yuav nthuav qhia IoT txoj haujlwm uas tso cai rau nplaim taws thiab xa ntawv ceeb toom rau tus siv Telegram.
Yam Koj Yuav Tsum Tau:
- Nplaim sensor module
- Microcontroller NodeMCU ESP8266
- Lub hwj chim
- WiFi
- Cov cuab yeej tso tawm nrog xov tooj
Kauj ruam 1: Kho vajtse
Nplaim Sensor ModuleTus qauv no muaj cov phototransistor thiab teeb liab kho hluav taws xob. Tus phototransistor ua hluav taws xob ntau dua thaum raug lub teeb. Physics qhia peb tias (pom) lub teeb suav nrog txhua xim, los ntawm liab mus rau violet. Los ntawm txheej txheej phototransistor nrog dub epoxy, nws dhau los ua xim liab lossis txawm pom tsis pom hauv qab liab lossis duab liab qab. Qhov zoo siab, nplaim taws tawm hluav taws xob hluav taws xob. Yog li, thaum lub ntsuas hluav taws xob no pom nplaim taws, nws ua haujlwm ntau dua tam sim no. NodeMCU yog pawg thawj coj saib xyuas Arduino uas muaj ESP8266 ntawm nws qhov tseem ceeb. Nws tau nrov vim tias nws yog WiFi -npaj microcontroller los ntawm nws tus kheej - tsis xav tau Arduino. Lub hom phiaj ntawm kab lus no yog los qhia tag nrho NodeMCU pinout thiab cov laug cam uas muaj tam sim no. Nco ntsoov tias thaum tsim cov phiaj xwm no siv ESP core hauv Arduino IDE, tus lej GPIO raug siv tsis yog dab tsi ntawm pawg thawj coj.
Kauj ruam 2: Kev sib txuas
Sensor txuas nrog GPIO0 rau kev cuam tshuam.
Kev cuam tshuam cuam tshuam muaj txiaj ntsig zoo rau kev ua tej yam tshwm sim tau txais hauv cov khoos kas microcontroller thiab tuaj yeem pab daws teeb meem sijhawm. Nrog cuam tshuam koj tsis tas yuav tshuaj xyuas tus lej tus lej tam sim no tas li. Thaum pom qhov hloov pauv, ib qho xwm txheej tau tshwm sim - muaj nuj nqi hu ua. Txoj haujlwm no hu ua cuam tshuam kev pabcuam niaj hnub (ISR). Thaum muaj kev cuam tshuam tshwm sim, tus txheej txheem tso tseg qhov ua tiav ntawm txoj haujlwm tseem ceeb kom ua tiav txoj haujlwm, thiab tom qab ntawd rov qab mus rau txoj haujlwm tseem ceeb
Kauj ruam 3: Telegram Bot
Bots yog daim ntawv thov thib peb uas khiav hauv Telegram. Cov neeg siv tuaj yeem cuam tshuam nrog bots los ntawm kev xa xov, lus txib thiab thov hauv kab. Peb tuaj yeem tswj hwm peb cov bots los ntawm HTTP APIs muab los ntawm Telegram.
Telegram bot yog daim ntawv thov tuav ntawm tus neeg rau zaub mov (ntawm no nws yog ESP8266) uas siv Telegram bot API los txuas rau Telegram Messenger cov neeg siv khoom. Qhov txiaj ntsig zoo ntawm Telegram bots yog tias lawv muaj xoom teeb tsa kev xav tau thiab ua haujlwm tsis sib xws ntawm txhua lub khoos phis tawj lossis mobile platforms uas Telegram Messenger khiav. Configure Telegram Bot Nruab Telegram ntawm koj lub Laptop lossis Xov Tooj thiab tshawb rau BotFather. Los ntawm BotFather peb tuaj yeem tsim tus bot tshiab. Tom qab tsim tus bot tshiab, peb yuav tsum tau sau cia tus cim cim uas yog qhov cuam tshuam tseem ceeb ntawm cov cuab yeej thiab Telegram bot API.
Kauj ruam 4: Software
Rub tawm Telegram Bot lub tsev qiv ntawv
Qhib Arduino IDE, Mus rau "Sketch", Xaiv "suav nrog Lub Tsev Qiv Ntawv" thiab Nyem rau "Ntxiv. ZIP Library".
#suav nrog
#include #include // Pib Wifi txuas rau lub router char ssid = "wifi"; // SSID (name) char password = "12345678"; // koj lub network tseem ceeb int xwm txheej = 0; // Initialize Telegram BOT #define BOTtoken "1234567890: AAEsdxDfSL57kpfZz1bduD9j4fddsiyfg" // token from @BotFather #define BOTname "ESP8266 FireBot" // bot name #define BOTusername "BOT, username int Bot_mtbs = 1000; // rov ua lub sijhawm ntev Bot_lasttime; bool Pib = cuav; bool isfire = tsis tseeb; bool haveid = tsis tseeb; int var = 0; Txoj hlua id; void Bot_EchoMessages () {rau (int i = 1; i Bot_lasttime + Bot_mtbs) {bot.getUpdates (bot.message [0] [1]); Bot_EchoMessages (); // teb lus nrog Echo Bot_lasttime = millis (); } tswb_if_fire (); } tsis muaj nuj nqis handleInterrupt () {Serial.println ("Tshawb xyuas cuam tshuam"); isfire = muaj tseeb; }
Pom zoo:
Tswb Tswb Tswb Tswb Los Ntawm Dej Sawv Cev: 7 Kauj Ruam (nrog Duab)
Twin Bell Alarm Clock From Soda Cans: Phau ntawv qhia no qhia koj yuav ua li cas thiaj ua tau lub tswb nrov tswb tswb moos los ntawm cov kaus poom dej qab.Qhov haujlwm no siv cov kaus poom dej qab zib uas tshem tus number case tawm (Txuas: Tshem Tawm Dej Los ntawm Dej Sawv Daws). Txhawm rau ua lub tswb moos no ua haujlwm tau zoo DIY Quartz moos module tau sib koom ua ke
Tswb Tswb Tswb Tswb Tswb: 3 Kauj Ruam
Lub Tswb Tswb Tswb Tswb: Kuv yog menyuam kawm ntawv 13 xyoos hauv Taiwan.Kuv ua yam nrog Arduino thawj zaug yog tias koj tuaj yeem qhia kuv yuav ua li cas txhim kho txoj haujlwm no, thov tawm lus rau kuv kom kuv tuaj yeem ua qhov zoo dua. (Ua tsaug ) Lub moos no tuaj yeem tsa koj thaum koj tsaug zog, tab sis kuv
Tswb Tswb Tswb Tswb Tswb Ntse Teeb: 8 Kauj Ruam (nrog Duab)
Tswb Tswb Tswb Tswb Tswb Lub Teeb: Hauv qhov haujlwm no kuv tau siv lub tshuab cua-tsoo lub tswb tawg tag. Lub ntsej muag ntawm lub moos tau hloov pauv los ntawm 12 LEDs, teeb pom kev los ntawm LED kab ib ncig ntawm ntug ntawm lub moos. 12 LEDs qhia lub sijhawm thiab cov hlua LED tau teeb tsa los ua lub tswb, tig
Arduino Push Alerts rau Lub Tswb, Tswb Tswb, Tswb Tswb Tswb Thiab Lwm Yam: 8 Kauj Ruam
Arduino Push Alerts rau Tswb, Tswb Tswb, Tswb Tswb Tswb thiab lwm yam: IoT Cov Ntawv Ceeb Toom los ntawm koj lub Tswb, Tswb Tswb, Tswb Tswb thiab lwm yam siv Arduino Uno thiab Ethernet Shield. Cov ncauj lus kom ntxaws ntawm kuv lub vev xaib ntawm no Hais txog Arduino Push Alert Box Siv Arduino Uno thiab Ethernet Shield raws li Wiznet W5100 nti rau
LED Tswb Tswb Tswb Tswb Tswb Tswb Tsa Tswm Tsa: 7 Kauj Ruam (nrog Duab)
LED Tswb Tswb Tswb Tswb Tswb Tswb Tsa Tswm Tsa Tswm Tswm: Tsa Kuv Lub Caij Ntuj No Lub caij ntuj no kuv tus hluas nkauj muaj teeb meem sawv thaum sawv ntxov thiab zoo li raug kev txom nyem los ntawm SAD (Lub Caij Caij Nyoog Muaj Teeb Meem). Kuv txawm pom tias nyuaj npaum li cas kom sawv thaum lub caij ntuj no vim lub hnub tsis tuaj