Ngliien cuu va thiet ke he thong loT ung dung trong viec dien khien va thu thap du lieu Ur moi truong.... STT San pham dang ky San pham da dat dirge 1 01 He thong loT tich hop giai thua
Trang 1NAM 2023 - 2024
Ten de tai: Thiet ke, die tao gateway va thu ngliiem Socket.IO trong dien khien, thu thap du lieu moi truang
Sd hop dong: SPUD.2023.01.55/HD-KHCN
Chu nhiem de tai: Vi Le The Anh
Don vi cong tac: Vien ung dung Cong nghe & Phat trien Ben vung
TP Ho Chi Minh, iigay thdng nam 202
Trang 2BQ GIAO DUC VA DAO TAO
NAM 2023 - 2024
Ten de tai: Thiet ke, che tao gateway va thu nghiem Socket.IO trong dien khien thu thap du lieu moi truang
Sd hop ddng: SPUD.2023.01.55/HD-KHCN
Chu nhiem de tai: Vi Le The Anh
Don vi cong tac: Vien ung dung Cong nghe & Phat trien Ben vting
Cac thanh vien phoi hap va cong tac:
STT Ho va ten Chuven nganh Co quan cong tac Ky ten
Trang 3MUC LUC
MO DAU 7
CHVONG 1 TONG QUAN TAI LIEU S 1.1 Tini hieu tong quan tinh liinli nghien cun luan giai muc tieu va noi dung nghien cuu ve van de ung dung loT va bao mat RSA trong dien kliien va thu thap du lieu moi truong 8
1.1.1 Ngoai nucrc 8
1.1.2 Tro rig nucrc 9
CHUANG 2 NQI DUNG VA PHUONG PHAP NGHIEN CUU 10
2.1 Ngliien cuu va tim hieu ve loT, deep learning va bao mat RSA trong van de moi truong 10
2.1.1 Tim hieu ve deep learning va ung dung trong van de o nhiem nidi truong 10
2.1.2 Tini hieu ve bao mat RSA img dung trong bao mat thong tin tic gateway len servei- 11
2.2 Ngliien cuu va thiet ke he thong loT ung dung trong viec dien khien va thu thap du lieu Ur moi truong 12
2.2.1 Nghien cuu, duet ke loT node thu thap du lieu tic moi truong 12
2.2.2 Nghien cuu, thiet ke gateway- 16
CHUONG 3 KET QUA VA THAO LUAN 27
3.1 Ket qua nghien cuu va thiet ke he thong loT ung dung trong vice dien khien va thu thap du Heu hr moi truong 27
3.2 Ket qua ngliien cuu, thiet ke va tich hop bao mat RSA vao gateway va su dung Socket.IO 31
3.3 Ket qua nghien cihi thiet ke server va webclient cho phep theo doi va luu tru du lieu moi truong 33
CHUONG 4 KET LUAN VA KIEN NGHI 41
TAI LIEU THAM KHAO 42
PHU LUC 1: MINH CHUNG DI KEM 43
1 SAN PHAM DANG 1 (hinh anh cac san pham dat duoc ) 43
2 SAN PHAM DANG 2: (quy trinh so do bang ve co so du lieu ) 48
PHU LUC 2: THUYET MINH DE CUONG VA HOP DONG THUC HIEN DE TAI NGHIEN CUU KHOA HOC 61
Trang 4DANH MUC CAC BANG BIEI', SO DO, HINH ANH
Hinh 2.2.1 Sa do khoi loT node thu thqp du lieu nidi trirang 12
Hinh 2.2.2 Mach nguyen ly ngudn loT node 13
Hinh 2.2.3 Mach nap CH340IoTnode 13
Hinh 2.2.4 Mach nguyen ly ATmega2560 14
Hinh 2.2.5 Mach nguyen ly ciia LoRa, UART, ADC va I2C 15
Hinh 2.2.6 Mach PCB loT node thu thqp du lieu moi trucmg 15
Hinh 2.2.7 Sa do khdi giao hep giua gateway la loT node 16
Hinh 2.2.S Mach nguyen ly ngudn cho gateway 16
Hinh 2.2.9 Mach nguyen ly mqch nap cho ESP32 17
Hinh 2.2.10 Mqch nguyen lyESP32 17
Hinh 2.2.11 Mqch nguyen ly LoRa cho gateway 18
Hinh 2.2.12 Mqch nguyen ly mqch dem 18
Hinh 2.2.13 Nut nhan reset, nap boot va cac led hien thi ngudn 19
Hinh 2.2.14 Mqch PCB gateway' 19
Hinh 2.5.1.Mire do phan bo du lieu trong tap du lieu 22
Hinh 2.5.2 Hinh anh ve sa do ANN trong he thong loT 24
Hinh 2.5 3 Chuang trinh xdy dung mo hinh 24
Hinh 2.5.4 Sado khdi cac lop trong mo hinh ANN 25
Hinh 3.1 Mqch dieu khien loT node 17
Hinh 3.2 Mqch loT node hoan chinh 28
Hinh 3.3 loTnode thu thqp du lieu moi trucmg 28
Hinh 3.4 Mqch PCB 3D cho gateway 29
Hinh 3.5 Thiet ke hoan chinh mqch dieu khien gateway 30
Hinh 3.6 Gateway 31
Hinh 3.7 Ma hda du lieu tic gateway bang gidi thuqt bao mat RSA 32
Hinh 3.8 Gidi ma du lieu gateway truyen len 32
Hinh 3.9 Trang gioi thieu ciia website 33
Hinh 3.10 Trang tai khoan ciia website 34
Hinh 3.11 Dang nhdp tai khoan nguai dimg trang web 34
Trang 5Hinh 3.12 Trang quail sat thong so moi trircmg 35
Hinh 3.13 Trang lich sir ciia website 35
Hinh 3.14 Thong tin lich sir dir lieu moi mrdiig 36
Hinh 3.15 Thong tin lich sic di'r lieu moi mrong 36
Hinh 3.16 Tim kiem dir lieu moi trirdng 37
Hinh 3.17 Confusion Matrix 38
Hinh 3 IS Bien do training vd validation ciia Accuracy' 39
Hinh 3.19 Bieu do training va validation ciia Loss Function 39
Hinh 3.20 Ket qua danh gid mo hinh dira tren metrics 40
Trang 6TOM TAT KtT QUA NGHIEN CUT?
1
Nghien cun tich hap giai thuat
bao mat RSA va sir dung
Socket.IO vao Gateway
De xuat mot so cam bien moi truong Hieu rd ve thuat toan RSA va Socket.IO
5
Ung dung deep learning trong
viec du doan mire do d nhiem
moi truong
Md hinh deep learning du doan muc
do d nhiem moi truong
STT San pham dang ky San pham da dat dirge
1
01 He thong loT tich hop giai
thuat bao mat RSA ung dung
trong thu thap du Heu moi truong
(01 gateway va 01 node loT)
01 He thong loT tich hop giai thuat bao mat RSA ung dung trong thu thap du lieu nidi truong (01 gateway
va 01 node loT)
doan muc do d nhiem moi truong
01 Md hinh deep learning du doan muc do d nhiem moi truong
Thai gian nop cudn bao cao :
Trang 7MO DAU
Muc tieu de tai
- Nghien cuu, thiet ke he thong loT phuc w thu nghiem dieu khien va giam sat cac thong
so moi truomg
2 Muc tieu cu the:
- Nghien cun ve Socket.IO
- Nghien cuu va thiet ke gateway tich hup giai thuat bao mat RSA
- Nghien cuu thiet ke node loT thu nghiem trong dieu khien va giam sat thong so moi truung
- Thiet ke ung dung webserver gom giam sat, dieu khien va report
- Ung dung deep learning trong viec du doan muc do d nhiem moi truung
Trang 8CHEONG 1 TONG QUAN TAI LIEU
0 uliiem moi truong dat ra nhung thach thuc dang ke doi vai sue khde cong dong
va can bang sinh thai doi hoi phai phat then cac giai phap giam sat tinh vi de daub gia va quan ly chinh xac muc do d nhiem Nghien cuu nay de xuat mot he thong dirge dien khien boi cong nghe Internet of Things (loT) de thu thap va phan tich du lieu moi truang mot each cd he thong, cho phep danh gia d nhiem chinh xac Cac nut cam bien dugc then khai de thu thap cac so lieu ve ndng do klii carbon monoxide (CO), nhiet do moi truang,
do am, do min hat bui (PM10), hat min (PM2.5) va hat cue min (PM1.0) Du lieu thu thap dugc ma hda bang thuat toan RSA, dam bao truyen an toan den gateway va sau do dugc chuyen tiep den server de giai ma va luu tru du lieu vao database Dir lieu dugc dan nhan thanh ba mire do d nhiem: klidng d nhiem (cap 0), d nhiem nhe (cap 1) va d nhiem nang (cap 2) Md hinh mang than kinh nhan tao (ANN) dugc dao tao tren tap du lieu dugc gan nhan nay va dugc tich hgp vao ban do Geographic Information System (GIS), hien thi muc do d nhiem bang each sir dung so do ma man xanh luc, vang va do, tuang ung vdi muc do d nhiem lan lugt 0, 1 va 2 Pham vi nghien cuu va dir lieu dugc lay tai dia diem Truang Dai hoc Nguyen Tat Thanh, Thanh Pho Thu Duc, Viet Nam (vi tri nghien cuu 10°50T9"N 106°48’46"E) vdi 31261 du lieu, trong vdng 12 thang
1.1 Tim hien tong quan tinh hinh nghien cuu luan giai muc tieu va noi dung nghien
cuu ve van de ling dung loT va bao mat RSA trong dieu khien va thu thap du lieu
moi truong
1.1.1 Ngoai ntr&c
Mot vai nam tra lai day, viec sir dung loT ung dung vao cac linh we ^c dang phat trien manh, ben canh do viec truyen du hen cd dp bao mat cao cang quan trong han Vi the ma sir dung cac ma hda bao mat nhu RSA, ECC, la mot su lua chon phu hgp vdi he thong loT Mot so de tai tren the gidi da dugc ung dung trong loT nhu sir dung cac bd ma hda dua tren RSA va ECC cho cac thiet bi dien toan suang mu va hieu qua nang lugng bao mat loT cao [1] Ngoai ra con sir dung RSA trong loT bang vice dam bao bao mat cho viec luu ti-u du lieu tren cloud an toan [2] Ben canh do dien toan suang mu la mot trong nhung cong nghe ndi bat khi thu hep cac nut loT va Cloud Severs, do do viec sir dung giao thuc trao doi khda an toan (LKSE) dugc thuc nghiem nhung phan tich cho thay viec sir dung LKSE bi han che do mat ma LKSE de bi gia mao va tan cong tiling gian vi the dua tren giao thuc bao mat ECC de dam bao an toan han cho thiet bi loT va cloud severs
Trang 9[3] Tren day la mot so trich dan bai bao tren the gioi ve de tai loT ket hop voi giai thuat bao mat, cho thay rang sir phat trien cua loT irng dung nhieu trong moi linh Aire va di doi voi do la sir bao mat can thiet dir lieu cua chung.
1.1.2 Trong n tare
quan tarn tai Viet Nam va tren the gioi loT ngay cang phat trien va dirge ung dung rong rai tir cac san pham nha thong minh cho den cac giai phap cong nghiep 4.0 [4] RSA (Rivest-Shamir-Adleman) la mot trong nhung thuat toan ma boa khda cong khai lau doi nhat va pho bien nhat Voi tinh bao mat cao RSA duoc ung dung rong rai trong cac he thong ma hoa thong tin nliam dam bao tinh bao mat va toan ven cua thong tin Viec ung dung RSA trong loT cho phep cac thiet bi ket noi Internet ma hoa thong tin va truyen di
an toan lion, dong thbi co the kiem chung tinh dung dan va chinh xac ciia thong tin dugc truyen di Tuy nhien, viec ung dung RSA trong loT doi hoi nhieu yeu can ky thuat cao, dac biet la ve toe do xir ly va bao mat khda dieu nay cung doi hoi phai cd mot he thong phan cung du manh va phan mem tdi iru moi cd the thuc hien dugc Cac nghien ciru gan day cho thay -viec ung dung RSA trong loT dang dugc quan tarn va phat trien nham tang tinh bao mat cho cac ung dung loT Tuy nhien viec trien khai can cd sir ho trg tir cac san pham phan cung va phan mem thong minh moi nhat, dong thbi cung can doi ngu ky su va nha nghien ciru cd kien thuc ve thuat toan bao mat va loT Tom lai, viec nghien ciru va danh gia cac ung dung loT voi thuat toan bao mat RSA cho thay tiem nang va trien vong ciia viec ung dung RSA de dam bao tinh bao mat va toan ven thong tin trong cac irng dung loT tuy nhien 1'iec trien khai can phai dugc thuc hien de dam bao tinh kha thi va hieu qua ciia he thong
Thuc te hien nay nliu can ve bao mat thong tin trong viec truyen du lieu rat quan trong dac biet la cac phuong thirc truyen nlian tin hieu tir xa Viec ung dung cac giai thuat bao mat nliu ECC, RSA vao trong cac he thong loT o Viet Nam dang con kha la moi me Ngliien ciru va phat trien he thong loT sir dung giai thuat RSA de bao mat thong tin: Day la mot trong nhung de tai nghien ciru dugc quan tarn va dan tir bdi cac cong ty Cong nghe thong tin va cac truong dai hoc Ion tai Viet Nam He thong se sir dung giai thuat RSA de ma hoa va giai ma thong tin truyen tai qua mang, giup dam bao tinh bao mat va toan ven ciia thong tin Vi the nhdm nghien ciru de xuat mot he thong loT cd tich hgp giai thuat bao mat RSA de dam bao tinh bao mat ciia thong tin dong thbi ket hgp irng dung vao mbi trubng trong viec thu thap thong tin du lieu cac miii hbi tir cac node loT.Ben canh do viec irng dung socket.IO loT cung la mot de tai moi voi kha nang xay dung irng dung Web real-time thong qua Socket.io viec irng dung vao gateway de trao doi thong tin giira gateway va sever thbi gian thuc giiip trao doi thong tin mot each nhanh chdng va tien Igi
Trang 10CHUONG 2 NOI DUNG VA PHUONG PHAP NGHIEN CU*U
2.1. Nghien cuu va tim hieu ve loT, deep learning va bao mat RSA trong van de moi
trirbng
2.1.1 Tint hieu ve deep learning va trng dung trong van de d nhiem moi triivng.
Hoc sau la mot nhanh cua tri me nhan tao (AI) su dung cac mang no-ron nhan tao (mang no-ron) duoc mo phbng theo can time cua nao bo con ngubi de hoc hoi tu du lieu Mang no-ron duoc cau tao bbi nhieu lop moi lop bao gbm nhieu no-ron nhan tao duoc ket noi vbi nhau bbi cac trong so Qua qua trinh hoc tap, cac trong so nay duoc dieu chinh de mang no-ron co the hoc hoi cac mo hinh phuc tap tu du lieu va dua ra du doan chinh xac
4 - Hue sau cd nhieu iru diem so voi cac phu-oug phap hoc may truyen thong, bao
gom:
• Kha nang hoc hoi tu du lieu phuc tap: Hoc sau co the hoc hoi tu du lieu co nhieu chieu phi tuyen tinh va nhieu dieu ma cac phuong phap hoc may truyen thong kho co the lam duoc
trung quan trong tu du lieu ma khbng can su can thiep cua con ngubi, giup don gian hoa qua trinh hoc tap va cai thien do chinh xac cua mo hinh
• Hieu suit cao: Hoc sau co the xu ly du lieu voi toe do cao nhb vao su phat then cua phan cung may tinh va cac thuat toan tbi uu hoa
4- Ung dung cua Iwo sau trong van de 6 nhiem moi trirbng
Hoc sau co the duoc ung dung trong nhieu linh \mc kliac nhau de giai quyet van de 6 nhiem moi trubng, bao gom:
• Giam sat moi trirbng: Hoc sau co the duoc su dung de phan tich du lieu tu cac cam bien mbi trubng de theo dbi chat luong khbng khi, nubc va dat Vi du hoc sau co the duoc su dung de phat hien cac ngubn b nhiem, du bao chat luong khbng khi va theo dbi su di chuyen cua cac chat b nhiem
• Lap ke hoach va quan ly moi trirbng: Hoc sau co the duoc su dung de phat trien cac mb hinh mb phbng cac he thong mbi trubng va du doan tac dong cua cac boat dong cua con ngubi den mbi trubng Vi du, hoc sau co the duoc su dung de mb phbng su lan truyen cua b nhiem khbng khi, du doan tac dong cua bien dbi khi hau
va phat trien cac chien luge quan ly mbi trubng hieu qua
Trang 11• Phat trien cong nghe xanh: Hoc san co tlie dirge sir dung de phat trien cac cong nghe moi giup giam thieu d nhiem moi tnrdug Vi du hoc sau co the dirge sir dung
de phat trien cac pin nang hrgng mat troi hieu qua han, thiet ke cac tda nha tiet kiem nang hrgng va phat trien cac phirong tien giao thong than thien vai moi truang
2.1.2. Tini hieu ve bao tn nt RS A irng dung trong bdo nt nt thong tin tie gateway len
server
RSA (viet tat tu Rivest, Shamir va Adleman) la mot thuat toan ma hda bat doi ximg dirge phat trien vao nam 1977 boi Ron Rivest Adi Shamir va Leonard Adleman RSA su dung hai loai khda:
• Khda cong khai: Cd the dirge chia se vdri moi ngirdi
• Khda bi mat: Can dirge giir bi mat
De ma hda mot tin nhan, ngirdi giri sir dung khda cong khai ciia ngirdi nhan Tin nhan dirge ma hda se klidng the giai ma dirge bang khda cong khai ma chi cd the giai ma dirge bang khda bi mat cua ngirdi nhan Tircmg tu, de ky mot tin nhan, ngirdi giri sir dung klida
bi mat ciia minh Chu ky cd the dirge xac minh bang khda cong khai cua ngirdi gui
4- RSA dirge sir dung rong rai trong nhieu irng dung bao mat, bao gom:
• Thiroug mai dien tir: RSA dirge sir dung de bao mat cac giao dich true tuyen, chang han nhu thanh toan bang the tin dung va mua sam true tuyen
• Giao tiep email: RSA dirge sir dung de ma hda email va tao chu ky so giup dam bao rang email klidng bi gia mao hoac thay ddi
• Mang rieng ao (VPN): RSA dirge sir dung de bao mat ket ndi \TN, giup bao ve
du lieu klii dirge truyen qua mang cong cong
4- Ung dung bao mat RSA trong viec bao mat thong tin tir gateway len server.
RSA cd the dirge sir dung de bao mat thong tin tir gateway leu server theo hai each:
• Ma hda (Iirdug truyen: Gateway cd the sir dung khda cong khai ciia server de ma hda dir lieu tnrac khi giri den server Dir Heu dirge ma hda se klidng the giai ma dirge bang bat ky ai khac ngoai server, cd khda bi mat de giai ma
• Xac thwc server: Gateway cd the sir dung chu ky so ciia server de xac minh tinh xac thuc ciia server truac khi giri du lieu Chu ky so cd the dirge xac minh bang khda cong kliai ciia server, giiip dam bao rang gateway dang ket ndi voi dung server va klidng phai la may gia mao
Trang 12Viec su dung RSA de bao mat thong tin tu gateway leu server co the giup bao ve du lieu khdi bi danh cap hoac thay doi boi nliung ke xam nhap.
2.2 Nghien cuu va thiet ke he thong loT ung dung trong viec dieu khien va thu thap
du lieu tu moi truong.
2 2.1 Nghien ctru, thief ke loT node thu thap dir lieu tir moi trirdng
Trong de tai nay, chung toi thiet ke mot node loT cho phep thu thap du lieu tu cac cam bien moi truong, bao gom: cam bien nhiet do - do am moi truong (SHT20), cam bien khi CO (MQ7), cam bUn hat bui PM1.0, PM2.5 va PM10 (PMS7003)
So* do khoi loT node thu thap du lieu moi truong:
Hinh 2.2.1 Sa do khdi loT node thu thap di'r lieu moi truong
loT node su dung vi dieu khien Atemega 2560 lam vi dieu khien chinh, thu thap du
thong qua giao thuc I2C, cam bien klii CO giao tiep qua tin hieu analog va cam bien nong
do bui PMS7003 giao tiep thong qua giao thuc UART
a Thiet ke mach nguyen ly loT node cho phep thu thap du lieu moi truong.
Mach nguyen ly node loT bao gom: mach nguon mach nap mach vi dieu khien chinh Atmega2560, mach LoRa giao tiep voi LoRa gateway va mach cac giao thuc giao tiep voi cam bien
Trang 13Hinh 2.2.2 Mqch nguyen ly ngudn loT node
1 GND VCC TXD R232 RXD RTSs V3 DTR#
Trang 14GM) GM) GM) GM) GM)
PI 16 UK 211)
PH? (T4)
PKOlADCKRLMlb) PKH MX M IX IM 17)
PK2(A1X HHX IM lh) PK)(ADCII PCIM19)
PK4(ADC11KLNT2O)
PM UM H IX IM2II
PKMAIX 14 IX INTO) PK?IADeiS/HLM23)
1*115 (OCIAH'IN'TS)
PIIMCK IHIXTM6) PH7(OCOAtXlC KIM 7) PL0HCP4)
Pl I (K PM
PL2|T5)
PL3(OC5A) PL4 HX5B)
Pl.5 «K % ) Pl.6 PL7 PDOlSCLWrO)
PDI (SDAINTI)
Pl)2(RXDI INT2)
PDMTXDi 1M3)
PIM(ICPI) PDS(XCXI) PDMTI)
PD?(TO) KIS << M XHI)
PCM(TUSCI)
PG) <TOSC2)
PG2 (ALE) K>l (UM
PJI (TXDJ/PC1NTI0) PJO(KXD3 KIND)
PC? (AIS)
IX MAH)
PCS(AIJ) PC4IA12)
PCJ(AII) PC2<AIO) KKA9) PIO (AM
vet vel
vet vet
Hiah 2.2.4 Mach nguyen ly ATmega2560
Trang 152 3
— _1_ , _
GND — (iND 5V KM
SDA 12C
GND KF4
b Thiet ke mach PCB node loT cho phep thu thap dir lieu moi trird’ ng.
Hinh 2.2.5 Mach nguyen ly ctia LoRa, UART, ADC va I2C
Hinh 2.2.6 Mach PCB loT node thu thap dir hen moi mrang
Trang 162 2.2 Nghien cicu, thiet ke gateway
Sa do khdi giao tiep giua gateway la loT node
Hinh 2.2.7 Sa fid khdi giao hep giira gateway la loT node
Cac du lieu tu cam bien se dugc gui den gateway thong qua LoRa
a Thiet ke mach nguyen ly gateway cho phep thu thap du lieu tu loT node
Thiet ke mot gateway bao gom:
• Mach nguon
• Mach vi dieu khien chinh co WiFi su dung ESP32
• Mach LoRa de giao tiep voi loT node
• Mach nap, mach dem cho vi dieu khien
Hinh 2.2.S Mach nguy en ly nguon cho gateway
Trang 17Hinh 2.2.9 Mach nguyen ly mqch nap cho ESP32
Hinh 2.2J 0 Mach nguyen ly ESP32
Trang 19Hinh 2.2.13 Nut nhan reset, nap boot va cac led hien tin nguon
a Thiet ke mach PCB gateway cho phep thu thap dir lieu tir node loT
Hinh 2.2.14 Mach PCB gateway
Trang 202.3. Nghien cun, thiet ke va rich hop bao mat RSA vao gateway va sir dung
Hinh 2.3.1 Sa do khdi sir dimg Socket.IO va bao mat RSA trong viec truyen dir lieu gn'ra
gate-w ay va server
Hai doi tuong truven thong tin nhau la gatewav va server Gatewav ma hoa dir lieu
cd duuc bang bao mat RSA va giri len cho server.
Bude 1: Tao khoa
Ban dau gateway se tao ra cho no 2 cap khoa: khoa cong khai va khoa bi mat
• TinhN = p.q
• Tinh gia tri ham so Euler n = (q-l)(p-l)
• Tim mot so d sao cho d.e = 1 mod n (hay d la nghich dao ciia e trong phep modulo n)
Bude 2: Ma hoa va giai ma
Goi M la gia tri dir lieu can ma hoa
Co 2 phuong an de ma hoa va giai ma
Phuong an 1:
Phuong an 2:
Trang 21• Giai ma: M = D(C Ku) = Ce mod N
Sau do (hire hien chiroug trinh tren ma hoa tren gateway.
2.4 Nghien ciru, thiet ke server va webclient cho phep theo doi va hru trir dir lieu moi trirougCT
Su dung Socket.IO lam moi truong truyen tai du lieu thai gian thuc giua server voi webclient, nham nang cao toe do phan hoi
Thiet ke webclient bao gom cac tinh nang:
• Home: gioi thieu va chuc nang cua web
• Tai khoan: Dang nhap va tao tai khoan
• Quan sat: Theo doi cac thong so moi truong
2.5 Nghien ciru, thiet ke mo hinh deep learning du doan muc do 6 nhiem moi truong
2.5.1 Ch it an bi dir lien
Sau khi thu thap du du lieu tir cam bien voi 31061 du Heu voi muc do phan bo ve
do 6 nhiem dong deu de tranh tinh trang khi huan luyen mo hinh bi overfit Thuc hien lay
du lieu Ion nhat PM1.0 PM2.5, PM10 va CO de dat nguong mire do 6 nhiem moi truong Dudi day la bang phan bo du Heu dugc danh nhan vc 3 muc do 6 nhiem 0,1.2 tuong ung voi muc do an toan nhe va nang
Trang 222.5.2 Tien xt'r ly dir lien
Du lieu bi thieu trong co so du lieu da duoc xoa de ngan chung anh huong den qua trinh dao tao
Du lieu nliiet do va do am khong nam trong thang do cua AQI nen do do cung bi loai bo
Vice chia ty le tinh nang duoc thuc bien tren du lieu de tang cubng kha nang hoi tii cua qua trinh hoc mo hinh MinMaxScaler trong scikit-leam da duoc su dung de chia
ty le tinh nang voi cac pham vi chia ty le tu 0 den 1 va -1 den 1
Cong thuc scaling du lieu:
Trang 23Xminmax = Xstd • (max ~ min) + min,
Trong do:
• X la gia tri hien tai
2.5.3 Chia dir lieu de train va test
Su dung doan ma (ngon ngu python) sau de chia tap du hen ra lam 2 phan: 70% dung de huan luyen mo hinh va 30% dung de kiem tra muc do hoc chinh xac cua mo hinh sau khi huan luyen
x train, x test, y train,y test = train_test_split(x,y,testsize=o.3,random state=7)Sau do tap huan luyen bao gom 21743 du lieu dung huan luyen mo hinh va 9318 dung
de kiem tra tap du lieu duac huan luyen
So* do khdi mo hinh:
Trang 24Hinh 2.5.2 Hinh dnh ve sa do ANN trong he thong loT
Trong so do tren dau vao du lieu la cac gia tri cua PM 1.0, PM2.5 PM10 va CO Duoc dira cac lop hidden de tang kha nang hoc bang each chia nhd, chon dac diem du lieu Viec lua chon so hrgng lop hidden va so hrgng parameter cung anh huong den qua trinh huan luyen So hrgng lop hidden qua it co the khien mo hinh hoc thieu hoac lop hidden qua nhieu dan toi overfit
Duoi day la chuong trinh dugc thuc hien bang ngon ngu python de xay dung mo hinh va
so do khoi mo hinh
firstlayersize » 512 numclasses = 3 » level phan loai 3 lop
model = Sequential () model.add(Dcnse(first layer size, activation ='sigmoid', input shape='6,))
model add(Dense(256, act ivat ion='sigmoid * ) )
model add(Dense(256, activation= ' sigmoid * ) )
model add(Dense(256, act ivation= 'sigmoid ’ ) )
model add(Dense(128, activation- ’ sigmoid ’ )
model add(Dense(128, activation=‘ sigmoid * ) )
model.add(Dense (32, activation=‘ sigmoid' ))
model.add(Dense(num_classes, activation* ‘softmax' ))
model sunmiary( )
Hinh 2.5 3 Chicomg trinh xay dimg mo hinh
Trang 25dense_input input: [(None, 6)]
Hinh 2.5.4 Ser do khdi cue lop trong mo hinh ANN
Trang 262.5.5 Danh gia hieu suat nio hinh
Hieu suat mo hinh duoc de suat dua tren danh gia bang cac metrics khac nhau nhu tinh toan phan tram ve do chinh xac accuracy (AC), precision, recall Fl-score
Accuracy (AC) = -
TN + FP + TP + FN
TP Precision = -
TP + FP
TP Recall = -
TP + FN
F1 -Score = 2 Precision Recall
Trong do:
• True positives (TP): Cac diem Positive thuc duoc nhan Dung la Positive
• False positives (FP): Cac diem Negative thuc duoc nhan Sai la Positive
• True negatives (TN): Cac diem Negative thuc duoc nhan Dung la Negative
• False negatives (FN): Cac diem Positive thuc duoc nhan Sai la Negative
Accuracy: The hien ti le du doan dung cua mo hinh
Recall: The hien kha nang phat hien tat ca cac Postivie, ty le nay cang cao thi cho thay kha nang bo sot cac diem Positive la thap
Precision: The hien su chuan xac cua viec phat hien cac diem Positive So nay cang cao thi model nhan cac diem Positive cang chuan
Fl score: La so dung hoa Recall va Precision giiip ta co can cu de lua chon model Ti le cang cao model cang chinh xac cao
Trang 27CHU*ONG 3 KET QUA VA THAO LUAN 3.1 Kef qua nghien cun va thief ke he thong loT ung dung trong nee dieu khien va thu thap dir lieu fir moi triremg.
Thief ke mach dieu khien loT node.
3.1.1 Ket qua nghien cicu, thiet ke loT node thu thqp dir lieu tir moi triromg
Hhih 3.1 Mqch dieu khien loTnode
Trang 28Hinh 3.2 Mach loT node hodn chinh
Thiet ke loT node vol cac cam bien.
Hinh 3.3 loT node thu thap dir lieu nidi trirovg
3.1.2 Nghien ciru, thiet ke gateway
Thiet ke mach dieu khien cho gateway
Trang 30Hinh 3.5 Thiet ke hoan chinh mqch dien khien gateway
Thiet ke hoan chinh Gateway
Trang 31Hinh 3.6 Gatew ay'
3.2 Ket qua nghien ciru, thiet ke va rich hop bao mat RSA vao gateway va str dung
Socket.IO.
Duai day la chuang trinh duac viet de ma hoa chudi du lieu truyen tu gateway len server bang giai thuat bao mat RSA
Trang 32U» _
OuW Md kkv.U M
HSOObMl
Hi uh 3.7 Afa hoa dir lieu tic gateway bang giai thuat bao mat RSA
Tren seiner giai ma de lay lai dir lieu hr chuoi ki hr duuc ma hoa bang RSA
a Mtmrnn reMtSMI ■ I - I
content: '557342940857286248148548178844150857286265686929881884025857286265066929885728621788441508572862246323688857 286278653768'
Redis client is connected to server!
Data source has been initialized!
Subscribe to topic 'ewQx/esp32.sensor.values'
Connected Iron ESP32 client
Connected frow E5P32 client
<
content: '557342940857286246148548218143790857286265886929650869298857286255734294588384148857286288188482885728625573 4294246323688857286221014379'
1-26-77-15 9-13-6
##W®*S38S«CS»3SB=S-===X3Sa
Hl, looks like you are running Tensorflow.js in Node.js To speed things up dramatically, install our node backend, visi
t https://github.cow/tensorflow/tfjs-node for wore details.
Hinh 3.S Giai ma dir lieu gateway truyen len
Chuoi du Heu dirge gui tu gateway la 1-26-77-15-9-13-6 dugc giai ma gui vao database voi thong so:
• 1 - la ID, cho phep truyen dir Heu khi ma bat dau bang 1
• 26 - gia tri nhiet do
Trang 3383141 90 65 84 06 9f b4 80 7d 3a d5 2a 4c 08 00 45 00 e - ) : -L -E
00 de 00 15 00 00 40 06 Od e6 ac 14 0a 03 ac 14 0
0030 14 34 6e 4c 00 00 |5b 22 65 73 70 33 32 22 2c 4nL* IB esp32",{ 0040
Frame (222 bytes) Reassembled TCP (178 bytes) Unmasked data (170 bytes)
Nhung ket qua thong tin nguoi thu 3 thay la chudi ki tir duoc ma hoa bang RSA 6 day
du lieu la “M" trong cong thuc RSA duoc ma hoa va gui len server, chudi ki tu ma hoa la mot so nguyen voi so hrgng dua vao so bit ma giri
3.3 Ket qua nghien cira, thiet ke server va webclient cho phep theo doi va lira trir
dir lieu moi trircmg
a Trang gioi thieu
He thong giam sat moi truc/ng
Q Manu
Gidlthfu
Hinh 3.9 Trang giai thieu ciia website
Trang 34b Trang tai khoan
He thong giam sat moi truing
Tai khoan ngddi dung
Ban chtfa dang nhap Hay dang nhap de sU dung he thong.
Ding nh^p
CD Lich su
Hinh 3.10 Trang tai khoan ciia website
Hinh 3.11 Dang nhap tai khoan ngiroi dung n ang web
b Trang quan sat
Theo doi cac thong so moi trirong: nhiet do, do am, PM1.0, PM2.5, PM10 va CO
Trang 35<- C A'Kv." WHIIM/ % MP —
9
II • Quan Ml
Hinh 3.12 Trang quan sat thong so moi mrang
c Trang lich
Trang 36Hien thi dir lieu diroi dang bang hoac bieu do
Hinh 3.14 Thong tin lich sic die lieu nidi trirdng
Trang 37Tim kiem dir lieu
Hinh 3.16 Tini kiem die lien moi nicdng
3.4 Ket qua nghien cuu, thiet ke mo hinh deep learning dw doan mire do 6 nhiem moi tnrorng
a Ket qua huan luyen mo hinh.