1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Hệ thống điều khiển thiết bị từ xa và cảnh báo nguy cơ cháy nổ qua sms

53 3 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 53
Dung lượng 4,62 MB

Nội dung

23:30 06/06/2023 Documents Downloader   !"#$%& ()* +,- /-+ 0+12 +3 %4* !"#$ &"#$ '( ) !"*$ '+,$- !" $% !"! $%&'() *+' &,-  !" $%&' !" $!%&' ()*+ ,!)-& $!).$ /0 $1 23 45 67&! /89 &'+: 6; 6!8: &< =+3 >?> 5678 96:7 ;87? @+)A !+B +#C%& DE DFG -%H(6>7 ;I JK L 0MJ A55N? OJKPMJKK &6Q7R 96:7 8SF7R TU7? !85V (678 !8W %8X7R "# $%&' ()(*(( https://documents-downloader.pages.dev/document 1/53 23:30 06/06/2023 https://documents-downloader.pages.dev/document Documents Downloader 2/53 23:30 06/06/2023 Documents Downloader   !"#$%& ()* +,- /-+ 0+12 +3 %4* !"#$ &"#$ '( ) !"*$ '+,$- !" $% !"! $%&'() *+' &,-  !" $%&' !" $!%&' ()*+ ,!)-& $!).$ /0 $1 23 45 67&! /89 &'+: 6; 6!8: &< =+3 >?> 5678 96:7 ;87? @+)A !+B +#C%& DE DFG -%H(6>7 ;I JK L 0MJ A55N? OJKPMJKK &6Q7R 96:7 8SF7R TU7? !85V (678 !8W %8X7R "#$ %& '() *+,-  +,- % /01- &2-3 44444444444444444 "#$ %& '() "./.  "# $%&' ()(*(( https://documents-downloader.pages.dev/document 3/53 23:30 06/06/2023 Documents Downloader   &.$+ -" /012$ &3 $ '4' $-+"#5 YZ[7R =8\ R6Q7R 96:7 8SF7R TU7] &6Q7R 96:7 ^_78 R6_? !85V (678 !8W %8X7R +` 9a ;:7 b678 96:7? @8cd !8W +Se7R Df A55N? OJKPMJKK !:7 ^g _7? h+> ;8i7R ^6jX k86l7 ;86m; nW ;o pq 9a =Q78 n_\ 7RXf =e =8_f 7r sXq 5A5tV "#$% &'& ()& *+,( -# #/- � 1+%# 2+3% 456%# 789 4#:0 &'& 4+3; &#< =>?+ *@9A "u; kvd YK]w 0vd YO]w (c; Yx]w &6y6 Yz]w {Xu; b|= YP] !" $% &'( )*+ ,-./ 01 ()23'( 45 ()%6 )57) 89:;  #$% &' ()*+ ,- (+/0( 12 3%4* (&5*6 ,74 89 (2/: ,;, 1-* 89 12 ,;, 6/< (+%=0( ! >?4@ 6AB BC, 8),+ 12 ()*+ +D +E.F ,G*6 *+H +IB 1/ J*6 KC*6 ,74 8A ! ;* L PQ *+Q( R0( 3%< *6+/$* ,J% 6S* 8T= *+-( >(&@*6 *HU,V3%W, (0F M #$% &' 12 ,+/ (/0( +HX*6 +; *6+/$* ,J%V6/*0% ,YF 6/k4 R0( 3%< 8I( g 8HE, 12 BC, (/$% ?4* 8S% 89 &4 8A*6 (+l/ ,%*6 ,- _Q _%Q* 8e 89 m%-( +HU*6 6/= ;86m; km dc=8 ^6>7 ;I ;€:7 G87 djd q”;6Xd T„b6R7„€ =Š ;8l ^S‡= ;Šd ;|; Rgd =_= nSF= 78S bqX? H (ª; €q =_= f:X =X na6 ;\_7V H D7V H !86m; km dc=8 7RXf:7 ”•V H D7 ^l =8Xfl7 bq7R dc=8 67 £GTq;„ dc=8 7RXf:7 ”• bq7R dc=8 67V H D7 78S ^6>7 ; ;ơ ^6>7 *-VVV H (ê; k=8 ;8SF= =_= \c6 T“f 7i6V H (6 T“f ;€:7 dc=8V H 06ld ;€q ;\a7 dc=8V Oz https://documents-downloader.pages.dev/document 39/53 23:30 06/06/2023 Documents Downloader     P8S8:8:8 J^1& (, !"#$ D'V( P^H$ /# 7Y $6 0$.#2 !"#$ D'Z( P^H$ /# DY $6 0$.#2 _S]S K#+p4 qp -#z% (•( OP https://documents-downloader.pages.dev/document 40/53 23:30 06/06/2023 Documents Downloader     Q5Z545 Am? 9: (#?$( (G*% no =212 (#F+# Lm? 9: (#?$( (G*% !"#$ D'[( Sn4 +, 0$4o0 0;5# &6Q6 ;8™=8 ”SX ^g ;8X†; ;\_7? SF= K? (`= R6_ ;€W T˜ ”6>X ;o d\TX”„ b6d 9a =_= =Qd n6m7 SF= O? {I ”• T˜ ”6>X 78†7 ^S‡=V 06ld ;€q ;8Ž7R ;67 =Qd n6m7 78†7 9j =Š 7RXf =e pQf €q =8_f 8qf k8Ž7Rƒ 7mX k8Ž7R ^Œ ^6jX k6>7 ”S‡7R Rqb ;€\7R k8Ž7R k8™ 8\ª= 786>; ^‘ ;€:7 PJ$-ƒ k8i6 ^6jX k86l7 k8Ž7R n_\ ;67 78|7 9j 7RS6 T[7RV  %RS‡= ”c6ƒ 7mX ^Œ ^6jX k6>7 pQf €q ^_d =8_fƒ k8i6 ^6jX k86l7 ^6jX k86l7 =²6ƒ ^7 8\c; ^‘7Rƒ ^g7R ;86 RI6 ;8Ž7R n_\ =Q78 n_\ 9j =8\ 7RS6 T[7R sXq 5A5V SF= x? 06ld ;€q ;™7 86>X ^6jX k86l7 n†;~;|; ;86m; nWV %mX k8Ž7R =Š ;™7 86>X ^6jX k86l7 n†;~;|; ;86m; nWƒ k8i6 ^6jX k86l7 k8Ž7R ;87 n†;~;|; ;86m; nWV %RS‡= ”c6ƒ 7mX =Š ;™7 86>X ^6jX k86l7ƒ ;87 n†;~;|; ;86m; nWƒ bqX ^Š 86l7 ;8W ;€c7R ;8_6 ;86m; nW ”:7 D-Zƒ ^g7R ;86 RI6 ;8Ž7R n_\ ;€c7R ;8_6 ^… n†;~;|; ;86m; nW =8\ 7RS6 T[7R sXq 5A5V OM https://documents-downloader.pages.dev/document 41/53 23:30 06/06/2023 Documents Downloader     Q5Z5@5 p2q2 (#23? 0#r% SaS HIJ?2%G NTs !"#$ D'E( I/=; :/6# H$p#$ 89:4/#; KYq &6q\ T6>7 =Œq G87 djd 2€TX67\ *Z’ =Š 786jX G87ƒ ;Xf 786:7 =8ˆ7R ;q =8ˆ • ^m7 78˜7R G87 sXq7 ;€`7R 78S ^S‡= 7:X €q ;€\7R 8‚78 ;€:7V -8—= 7³7R =Œq ;o7R  G87 78S bqX? P8l8:878 Gx% T(E/ %@3 1&Hi,B %@n,& Z[7R ^l k6ld ;€q p„d =8Se7R ;€‚78 ^S‡= 96m; =Š ”¼6 k8Ž7RV %mX =8Se7R ;€‚78  nW ”¼6 ;8‚ G87 djd 2€TX67\ *Z’ b· 86l7 ;8W ;8Ž7R ;67 ”¼6 š 9[7R ;8Ž7R n_\ ;8Ž7R ;67V P8l8:8:8 Gx% ,^b 1&Hi,B %@n,& =A= =8`7 n\ ;8‚ d‘; G87 sXq7 ;€`7R 7˜q ”a =8`7 =r7R -1AV +‚78  n:7 TSF6 d678 8`q =8\ 96>= =8`7 =r7R -1AV 086 ”7 ^X R|7 dc=8 2€TX67\ 9a\ d_f ;™78ƒ 7RS6 bI T¬7R =7 78u7 =8`7 =r7R -1A n»7R =_=8 9a\ K00`1 € f:5+H` I054 Yd‘; bi G86:7 nQ7 T[7R ;o @\€;] bqX ^Š 78u7 =8`7 =r7R -1Aƒ 9™ T¬ 78S -1APV  %8˜7R ”7 bqX k86 ^Sq =8™78 n\q€T 2€TX67\ ^Š 9a\ d_f ;™78 ;8‚ k8Ž7R =7 =8`7 =r7R -1Aƒ 7mX ^Sq n\ 2€TX67\ k8_= 9a\ d_f ;8‚ =7 G8Q6 =8`7 ”c6 =r7R -1Aƒ sXf ;€‚78 ;87 =¹7R ;Se7R ; ;8i7R ^6jX k86l7 ;86m; nW ;o pq 9a =Q78 n_\ =8_f 7r =8\ R6q ^‚78 ”XŽ7 ”a d‘; ^j ;a6 =uG ;86m; 9a =7 €u; 786jX b< =Q6 ;6m7 9j ^‘ ;67 =†f 9a 86>X sXQ =Œq 8> ;8i7RV 5qX ;86 R6q7 8`= ;†G ;‚d 86lX TSF6 b< 8SF7R TU7 =Œq !85V (678 !8W %8X7R l ^g _7 =Œq „d ^… 8\a7 ;8a78 ^ˆ7R ;86 R6q7 sXf ^W78 9a ^… R6Q6 sXfm; ^S‡= 78˜7R f:X =X ^ª; €q nq7 ^XV (g _7 ^… km ;8oq 8q6 k8™q =c78 ;€\7R 8> ;8i7R 96 ^6jX k86l7ƒ ^Š ”a bI T¬7R 96 ^6jX k86l7 2€TX67\ ;€\7R dc=8 n_\ =8_f 9a dc=8 ^6jX k86l7V !Xf =8Sq G8_; 8Xf ^S‡= =_= ;™78 7³7R SX 96>; =Œq 2€TX67\ 78S7R =¹7R G87 7a\ —7R T¬7R 9a R6Q6 sXfm; =Ž7R 96>= ;87 8e7 ^l ^c; ^S‡= 78˜7R km; sXQ ;i; 8e7ƒ ;™78 7³7R bI T¬7R €‘7R €…6 8e7V %8S =Š ;8l ;8qf ^r6 =8Se7R ;€‚78 ^l —7R T¬7R ;€\7R dc=8 ;™78 =SF= G8™ ^6>7 ;8\c6ƒ 9V9} Na ^“f =¹7R ”a 8SF7R G8_; ;€6l7 =8\ =_= ^j ;a6 k8Šq bqXV Aª= T[ =Š b< R6ˆG ^‰ 786>; ;‚78 ;o sX• ;8f =Ž 9a =_= nc7 78S7R b< 86lX n6m; 9a ”S‡7R k6m7 ;8—= =Œq nQ7 ;8“7 „d 9j ”¸78 97 ;I 9U7 =²7 R6F6 8c7 7:7 ^g _7 k8Š ;€_78 k8y6 78˜7R bq6 bŠ;V "u; d\7R ^Š7 78†7 78˜7R • k6m7 ^Š7R RŠG =Œq ;8f =Ž =[7R =_= nc7 ^l G8_; ;€6l7 ^j ;a6 7Raf =a7R 8\a7 ;86>7 8e7V xK https://documents-downloader.pages.dev/document 46/53 23:30 06/06/2023 Documents Downloader     'S" 6"#0 '+; %qd !-N% Px°?OJJJ 9j E:X =X k¸ ;8X†; =Œq 8> ;8i7R n_\ =8_f ;< ^‘7RV ÐxÑ 8;;G?~~ÄÄÄVq€TX67\V97 ÐzÑ 8;;G?~~ÄÄÄVq€TX67\V==  ÐPÑ ÄÄÄVT6„7;X96„;7qdV=\d~ ÐMÑ 8;;Gb?~~ÄÄÄVq”;6XdV=\d~  xO https://documents-downloader.pages.dev/document 47/53 23:30 06/06/2023 Documents Downloader     5+> 6>8 A… 7RXg7 =8Se7R ;€‚78 #include #include #include #include "DHT.h" LiquidCrystal_I2C lcd(0x27, 16, 2); SoftwareSerial sim(10, 11); int led1 = 7; int led2 = 8; int led3 = 9; int gas = A0; int coi = 12; const int DHTPIN = 4; Arduino // !"c d# li$u t% DHT11 & chân m'ch const int DHTTYPE = DHT11; DHT11 DHT22 //Khai báo lo'i c(m bi)n, có lo'i DHT dht(DHTPIN, DHTTYPE); String val; int _timeout; String _buffer; String number = "+84852880426"; void setup() { delay(7000); //delay for seconds to make sure the modules get the signal Serial.begin(9600); _buffer.reserve(50); Serial.println("Sistem Started "); pinMode(led1, OUTPUT); pinMode(led2, OUTPUT); pinMode(led3, OUTPUT); xx https://documents-downloader.pages.dev/document 48/53 23:30 06/06/2023 Documents Downloader     pinMode(coi, OUTPUT); pinMode(gas, INPUT); dht.begin(); sim.begin(9600); delay(1000); delay(100); sim.println("AT"); sim.println("AT+CMGF=1"); sim.println("AT+CNMI=1,2,0,0,0"); lcd.init(); lcd.backlight(); } void nhietgas() { lcd.clear(); int t = dht.readTemperature(); int data = analogRead(gas); lcd.setCursor(0, 0); lcd.print("KHI GAS: "); lcd.setCursor(11, 0); int data2 = map(data, 270, 1024, 0, 100); if (data2 < 0) { data2 = 0; } lcd.print(data2); lcd.setCursor(14, 0); lcd.print("%"); lcd.setCursor(0, 1); lcd.print("NHIET DO: "); lcd.setCursor(11, 1); lcd.print(t); lcd.setCursor(14, 1); lcd.print("*C"); delay(100); if (t > 50 || data2 > 50) { xz https://documents-downloader.pages.dev/document 49/53 23:30 06/06/2023 Documents Downloader     lcd.clear(); lcd.setCursor(0, 1); lcd.print("CANH BAO CHAY"); digitalWrite(coi, HIGH); SendMessage(); delay(10000); digitalWrite(coi, LOW); } } void SendMessage() { //Serial.println ("Sending Message"); sim.println("AT+CMGF=1"); //Sets the GSM Module in Text Mode delay(1000); //Serial.println ("Set SMS Number"); sim.println("AT+CMGS=\"" number to send message + number + "\"\r"); //Mobile phone delay(1000); String SMS = "canh bao chay"; sim.println(SMS); delay(100); sim.println((char)26);// ASCII code of CTRL+Z delay(1000); _buffer = _readSerial(); } String _readSerial() { _timeout = 0; while (!sim.available() && _timeout < 12000 ) { delay(13); _timeout++; } if (sim.available()) { return sim.readString(); xP https://documents-downloader.pages.dev/document 50/53 23:30 06/06/2023 Documents Downloader     } } void loop() { nhietgas(); if (Serial.available()) { sim.write(Serial.read()); } if (sim.available() > 0) { val = sim.readStringUntil('\n'); Serial.println(val); if (val == "On1\r") { digitalWrite(led1, HIGH); phanhoi(1); Serial.println("LED1 ON"); lcd.clear(); lcd.setCursor(0, 1); lcd.print("thiet bi bat"); delay(3000); lcd.clear(); } if (val == "Off1\r") { digitalWrite(led1, LOW); phanhoi(0); Serial.println("LED1 OFF"); lcd.clear(); lcd.setCursor(0, 1); lcd.print("thiet bi tat"); delay(3000); lcd.clear(); } if (val == "On2\r") { digitalWrite(led2, HIGH); xM https://documents-downloader.pages.dev/document 51/53 23:30 06/06/2023 Documents Downloader     phanhoi(1); Serial.println("LED2 ON"); lcd.clear(); lcd.setCursor(0, 1); lcd.print("thiet bi bat"); delay(3000); lcd.clear(); } if (val == "Off2\r") { digitalWrite(led2, LOW); phanhoi(0); Serial.println("LED2 OFF"); lcd.clear(); lcd.setCursor(0, 1); lcd.print("thiet bi tat"); delay(3000); lcd.clear(); } if (val == "On3\r") { digitalWrite(led3, HIGH); phanhoi(1); Serial.println("LED3 ON"); lcd.clear(); lcd.setCursor(0, 1); lcd.print("thiet bi bat"); delay(3000); lcd.clear(); } if (val == "Off3\r") { digitalWrite(led3, LOW); phanhoi(0); Serial.println("LED3 OFF"); lcd.clear(); x https://documents-downloader.pages.dev/document 52/53 23:30 06/06/2023 Documents Downloader     lcd.setCursor(0, 1); lcd.print("thiet bi tat"); delay(3000); lcd.clear(); } } } void phanhoi(bool tipe) { sim.println("AT+CMGF=1"); delay(1000); sim.println("AT+CMGS=\"+84853773338\"\r"); // s* c+a m'ch b,t t-t delay(1000); if (tipe == 1) { sim.println("LED ON"); } else { sim.println("LED OFF"); } delay(100); sim.println((char)26); delay(1000); } x° https://documents-downloader.pages.dev/document 53/53

Ngày đăng: 06/06/2023, 23:31

TỪ KHÓA LIÊN QUAN

TÀI LIỆU CÙNG NGƯỜI DÙNG

TÀI LIỆU LIÊN QUAN

w