Hệ thống giám sát điện năng gia đình, có điều khiển và cảnh báo quá dòng

124 0 0
Hệ thống giám sát điện năng gia đình, có điều khiển và cảnh báo quá dòng

Đ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

ĐỒ ÁN TỐT NGHIỆP ĐỀ TÀI: HỆ THỐNG GIÁM SÁT ĐIỆN NĂNG GIA ĐÌNH, CĨ ĐIỀU KHIỂN VÀ CẢNH BÁO QUÁ DÒNG NGÀNH: KỸ THUẬT ĐIỆN – ĐIỆN TỬ Giảng viên hướng dẫn: PGS.TS Nguyễn Hùng Sinh viên thực hiện: MSSV: Lớp: Lê Gia Huy 1811021079 18DDCA2 Nguyễn Tấn Long 1811021066 18DDCA2 TP Hồ Chí Minh, 2022 BỘ GIÁO DỤC VÀO ĐÀO TẠO TRƯỜNG ĐẠI HỌC CÔNG NGHỆ TP HỒ CHÍ MINH ĐỒ ÁN TỐT NGHIỆP ĐỀ TÀI: HỆ THỐNG GIÁM SÁT ĐIỆN NĂNG GIA ĐÌNH, CĨ ĐIỀU KHIỂN VÀ CẢNH BÁO QUÁ DÒNG NGÀNH: KỸ THUẬT ĐIỆN – ĐIỆN TỬ Giảng viên hướng dẫn: PGS.TS Nguyễn Hùng Sinh viên thực hiện: MSSV: Lớp: Lê Gia Huy 1811021079 18DDCA2 Nguyễn Tấn Long 1811021066 18DDCA2 TP Hồ Chí Minh, 2022 i i ii LỜI CAM ĐOAN Những nội dung trình bày luận văn kiến thức cá nhân em tích lũy q trình học tập, nghiên cứu, khơng chép lại cơng trình nghiên cứu hay luận văn tác giả khác Trong nội dung luận văn, phần em nghiên cứu, trích dẫn nêu phần tài liệu tham khảo, có nguồn gốc, xuất xứ, tên tuổi tác giả, nhà xuất rõ ràng Những điều em cam kết hoàn toàn thật, sai, em xin chịu hình thức xử lý kỷ luật theo quy định Người thực đề tài Lê Gia Huy Nguyễn Tấn Long iii LỜI CẢM ƠN Quá trình thực khóa luận đồ án tốt nghiệp giai đoạn vô quan trọng quãng đường học tập sing viên Nó tiền đề củng hành trang đề có kĩ cần thiết để bước sống Trước tiên, tụi em xin chân thành gửi đến lời cảm ơn đến Ban Giám hiệu Trường Đại học Cơng nghệ Thành phố Hồ Chí Minh Viện Kỹ Thuật HUTECH tạo điều kiện cho chúng em hồn thành khóa luận với giúp đỡ, tư vấn mặt chuyên môn thầy PGS.TS Nguyễn Hùng để giúp chúng em hoàn thành thời hạn Cùng với giảng dạy năm học thầy , cô Viện góp ý tận tình đả làm nên khóa luận tốt nghiệp Mặc dù khoảng thời gian đủ dài nỗ lực thân số hạn chế nên cách trình bày khơng thể tránh thiếu sót, sai phạm,… mong quý Thầy, thơng cảm để chúng em hồn thành cách tốt đẹp Nhóm tác giả xin chân thành cảm ơn ! Lê Gia Huy Nguyễn Tấn Long iv TÓM TẮT Nhu cầu quản lý, giám sát kiểm sốt việc đo điện năng, thơng số: điện áp, dòng điện, tiêu chất lượng điện từ xa cần thiết cho nhà quản lý, công ty điện lực cá nhân Mặc dù đạt đến mức độ thành công định, nhiên hệ thống quản lý giám sát điện chi phí cao hạn chế việc truy cập từ xa Ngoài ra, xu hướng sử dụng thiết bị thơng minh: điện thoại smart phone, máy tính bảng …để truy cập giám sát từ xa Trong xu này, hệ thống hỗ trợ việc quản lý, giám sát việc đo điện thông số hệ thống điện từ xa Internet, điện thoại cần thiết để tìm hướng tiện nghi kinh tế phục vụ nhà quản lý, công ty điện lực cá nhân Với mong muốn giải phần khó khăn tìm hướng cho ngành điện Việt Nam, nhóm em bắt tay vào nghiên cứu thực đề tài “Hệ thống giám sát điện gia đình, có điều khiển cảnh báo q dịng” Trên sở tìm hiểu IoT nhằm giám sát điện thông số khác hệ thống điện từ xa qua internet điện thoại, qua việc truy cập vào trang web ứng dụng Blynk, người dùng giám sát từ xa nơi lúc Điểm bật đề tài giám sát điện đồng thời hai hay nhiều thiết bi ̣điện thơng qua internet ứng dụng Blynk , kiểm sốt thông qua việc đo, lưu trữ thông số điện liên tục thời điểm ngày v ABSTRACT The need to manage, monitor as well as control the measurement of electricity, parameters: voltage, current, and power quality indicators remotely is very necessary for managers and power companies and personal Although there has been a certain degree of success, current power monitoring and management systems are very expensive and have limited remote access In addition, the current trend is to use smart devices: smart phones, tablets for remote access and monitoring In this new trend, a system that supports the management and monitoring of electricity metering and electrical system parameters remotely by Internet and telephone is necessary to find a convenient and economic direction to serve home owners management, power companies and individuals With the desire to partially solve the difficulties and find a new direction for Vietnam's electricity industry, my group embarked on the research and implementation of the project "Home electricity monitoring system, with remote control" and overcurrent warning" On the basis of learning about IoT to monitor electricity and other parameters of the power system remotely via internet and phone, by accessing Blynk website and application, users can monitor remotely everywhere at any time The highlight of this project is that it is possible to monitor the power of two or more electrical devices simultaneously via the internet and the Blynk application, control through measurement and storage of electrical parameters continuously at different times during the day vi MỤC LỤC LỜI CAM ĐOAN i LỜI CẢM ƠN iv TÓM TẮT v ABSTRACT vi MỤC LỤC vii DANH MỤC CÁC TỪ VIẾT TẮT xi DANH SÁCH HÌNH ẢNH xii DANH SÁCH BẢNG xv LỜI MỞ ĐẦU .1 CHƯƠNG GIỚI THIỆU ĐỀ TÀI .2 1.1 ĐẶT VẤN ĐỀ .2 1.2 NHIỆM VỤ NGHIÊN CỨU 1.3 MỤC TIÊU 1.4 ĐỐI TƯỢNG VÀ PHẠM VI NGHIÊN CỨU 1.5 PHƯƠNG PHÁP NGHIÊN CỨU .5 1.6 KẾT QUẢ DỰ KIẾN 1.7 BỐ CỤC .5 CHƯƠNG TỔNG QUAN GIẢI PHÁP CÔNG NGHỆ 2.1 TẦM QUAN TRỌNG CỦA QUẢN LÝ VÀ GIÁM SÁT NĂNG LƯỢNG .7 2.2 GIỚI THIỆU MỘT SỐ HỆ THỐNG GIÁM SÁT VÀ QUẢN LÝ NĂNG LƯỢNG TỪ XA TRONG THỰC TẾ 2.2.1 Hệ thống giám sát quản lý lượng từ xa qua sóng vơ tuyến RF 2.2.2 Hệ thống giám sát quản lý lượng từ xa qua truyền tải tín hiệu thơng qua đường dây điện 2.3 CÔNG NGHỆ IOT .11 2.3.1 Giao thức kết nối 12 vii [12] Internet of things gì?, http://iot.dtt.vn/InternetofThings.html, 2018 [13] Review: IOT data logging services with MQTT, https://hackaday.com/2017 /10/31/review-iot-data-loggingservices-with-mqtt/, 2017 [14] SmartConfig với ESP8266, https://hocarm.org/smartconfig- voi-esp8266/, 2017 [15] Cayenne MQTT ESP Library, https://github.com/myDevicesIoT/Cayenne-MQTTESP, 2017 [16] Cayenne MQTT and Standalone ESP8266 ESP-01, https://mydevices.com /article/cayenne-mqtt-standalone-esp8266esp-01/ 92 PHỤ LỤC PHẦN MỀM Chương trình hệ thống  Chương trình blynk: #include "Pzem004t_V3.h" #include #include #define ESP8266_BAUD 115200 #include #include Pzem004t_V3 pzem(&Serial); BlynkTimer timer char auth[] = "6lWL68oP6dBnF1sIwkji0e7hNEYs5J1N"; // Token char ssid[] = "P.004"; // Tên Wifi nhà bạn (Gõ tên, Chữ hoa chữ thường) char pass[] = "0919237655"; // Mật wifi nhà bạn #define RESET_BUTTON_PIN D3 // Nút nhấn reset D3 #define LONGPRESS_LEN // số vòng lặp tối thiểu giữ #define LED D4 // D1(gpio5) đèn LEd D4 enum { EV_NONE = 0, EV_SHORTPRESS, EV_LONGPRESS }; boolean button_was_pressed; // trạng thái trước int button_pressed_counter; // nhấn thời lượng chạy LiquidCrystal_I2C lcd(0x27, 20, 4); 93 bool result = false; void SendToBlynk(){ pzem_info pzemData = pzem.getData(); if (result){ Blynk.virtualWrite(V1, pzemData.volt);// dien ap Blynk.virtualWrite(V2, pzemData.ampe);//dong dien Blynk.virtualWrite(V3, pzemData.power);//cong suat Blynk.virtualWrite(V4, pzemData.energy);//tieu thu Blynk.virtualWrite(V5, pzemData.powerFactor);//cosphi Blynk.virtualWrite(V6, pzemData.freq);//tan so } lcd.clear(); lcd.setCursor(4, 0);// hàng vị trí lcd.print("Bang thong so"); lcd.setCursor(0, 1);// hàng vị trí lcd.print("U:"); lcd.print(String(pzemData.volt) + "V"); lcd.setCursor(11, 1); lcd.print("I:"); lcd.print(String(pzemData.ampe) + "A"); 94 lcd.setCursor(0, 2); lcd.print("P:"); lcd.print(String(pzemData.power) + "W"); lcd.setCursor(11, 2); lcd.print("E:"); lcd.print(String(pzemData.energy) + "KWh"); lcd.setCursor(0, 3); lcd.print("FR:"); lcd.print(String(pzemData.freq) + "Hz"); lcd.setCursor(11, 3); lcd.print("PF:"); lcd.print(String(pzemData.powerFactor)); CheckResetData(); } void setup() { // Set ESP8266 baud rate(đặt tốc độ truyền esp8266) Serial.begin(ESP8266_BAUD); pinMode(RESET_BUTTON_PIN, INPUT); 95 pinMode(LED, OUTPUT); // thứ bạn muốn kiểm sốt cách sử dụng cơng tắc, ví dụ: đèn Led // tắt LCD lcd.init(); lcd.backlight(); lcd.setCursor(0, 2); lcd.print("Xin cam on!"); lcd.setCursor(0, 0); lcd.print("Kinh chao thay co"); digitalWrite(LED, LOW); pzem.begin(); pzem.setTimeout(100);// đặt thời gian chờ 100ms Blynk.begin(auth, ssid, pass); result = Blynk.connect(); if (result != true) {Serial.println("BLYNK Connection Fail"); } else {Serial.println("BLYNK Connected"); } timer.setInterval(1000L, SendToBlynk); Serial.print("Connecting "); 96 button_was_pressed = false; button_pressed_counter = 0; } BLYNK_WRITE(V0) { // Button Widget chọn V0 if (param.asInt() == 1) { //nếu nhấn nút reset gọi hàm pzem.resetEnergy(); // reset PZEM } else { } } BLYNK_WRITE(V1) {int Relay1State = param.asInt(); digitalWrite(D0, Relay1State); } void D0_on(){ Blynk.virtualWrite(V1,LOW); } int handle_button() {int event; int button_now_pressed = !digitalRead(RESET_BUTTON_PIN); // pin low > pressed if (!button_now_pressed && button_was_pressed) { if (button_pressed_counter = 5) {digitalWrite(LED, HIGH); // set the LED off pzem.resetEnergy(); // reset PZEM } } else {button_pressed_counter = 0; digitalWrite(LED, LOW); // set the LED off } //Serial.println("button_now_pressed:" + String(button_pressed_counter)); button_was_pressed = button_now_pressed; return event; 98 } void CheckResetData() { int eventq = handle_button(); switch (eventq) { case EV_NONE: break; case EV_SHORTPRESS: break; case EV_LONGPRESS: Serial.println("Reset Energy"); break; } } void loop() { Blynk.run(); timer.run(); }  Chương trình Cayenne: #include #include "Pzem004t_V3.h" #include 99 #include LiquidCrystal_I2C lcd(0x27,20,4); Pzem004t_V3 pzem(1,3); // RX,TX on NodeMCU IPAddress ip(192,168,1,1); int voltage_cayenne=0; int ampe_cayenne=0; int power_cayenne=0; int energy_cayenne=0; int freq_cayenne=0; int powerFactor_cayenne=0; char ssid[ ] = "P.004";//ten wifi sử dụng char wifiPassword[ ]= "0919237655";// mật wifi sử dụng char username[ ] = "c8e92070-0992-11ed-bbc1-5d0b0fa0a668";//MQTT USERNAME char password[ ] = "6729019c693cab1c4ef79aada14a4553b38a61d0";//MQTT MẬT KHẨU char clientID[ ] = "df9422d0-111b-11ed-bbc1-5d0b0fa0a668";//ID KHÁCH HÀNG unsigned long lastMillis = 0; void setup() { Serial.begin(115200); Cayenne.begin(username, password, clientID, ssid, wifiPassword); IPAddress(ip); 100 Wire.begin(D2,D1); lcd.init(); lcd.backlight(); lcd.setCursor(0, 0); lcd.print("Chao Quy Khach"); lcd.setCursor(0, 1); lcd.print("Ngay moi vui ve !!! "); } void loop() { Cayenne.loop(); // Read meter PZEM float v; if(v >= 0.0) { voltage_cayenne =v; Serial.print(v); Serial.print("V; "); } if (v < 0.0) { v = 0.0; voltage_cayenne =0.0; } float i; if(i >= 0.0) 101 { ampe_cayenne=i; Serial.print(i); Serial.print("A; "); } if (i < 0.0) { i = 0.0; ampe_cayenne= 0.0; } float p; if(p >= 0.0) { power_cayenne=p; Serial.print(p); Serial.print("W; "); } if (p < 0.0) {p = 0.0; power_cayenne =0.0; } float e; if(e >= 0.0) { energy_cayenne=e; Serial.print(e); Serial.print("E; "); 102 } if (e < 0.0) {e = 0.0; energy_cayenne =0.0; } float fr; if(fr >= 0.0) { freq_cayenne=fr; Serial.print(fr); Serial.print("FR; "); } if (fr < 0.0) {fr= 0.0; freq_cayenne =0.0; } float pf; if(pf >= 0.0) { powerFactor_cayenne=pf; Serial.print(pf); Serial.print("PF; "); } if (pf < 0.0) {pf = 0.0; 103 powerFactor_cayenne =0.0; } if (millis() - lastMillis > 10000) { lastMillis = millis(); Cayenne.virtualWrite(0,voltage_cayenne); Cayenne.virtualWrite(1,ampe_cayenne); Cayenne.virtualWrite(2,power_cayenne); Cayenne.virtualWrite(3,energy_cayenne); Cayenne.virtualWrite(4,freq_cayenne); Cayenne.virtualWrite(5,powerFactor_cayenne); Cayenne.virtualWrite(6,lastMillis); Cayenne.virtualWrite(7,voltage_cayenne); Cayenne.virtualWrite(8,ampe_cayenne); Cayenne.virtualWrite(9,power_cayenne); Cayenne.virtualWrite(10,energy_cayenne); Cayenne.virtualWrite(11,freq_cayenne); Cayenne.virtualWrite(12,powerFactor_cayenne); } lcd.clear(); lcd.setCursor(4, 0); lcd.print("Bang thong so"); lcd.setCursor(0, 1); 104 lcd.print("U:"); lcd.print(String(voltage_cayenne) + "V"); lcd.setCursor(11, 1); lcd.print("I:"); lcd.print(String(ampe_cayenne) + "A"); lcd.setCursor(0, 2); lcd.print("P:"); lcd.print(String(power_cayenne) + "W"); lcd.setCursor(11, 2); lcd.print("E:"); lcd.print(String(energy_cayenne) + "KWh"); lcd.setCursor(0, 3); lcd.print("FR:"); lcd.print(String(freq_cayenne) + "Hz"); lcd.setCursor(11, 3); lcd.print("PF:"); lcd.print(String(powerFactor_cayenne)); } 105 Phần mềm sử dụng Tên phần mềm Chức Altium Designer 17.0 Vẽ mạch PCB, mạch nguyên lý Arduino IDE Lập trình điều khiển Cayenne Giám sát thiết bị qua internet Fritzing Vẽ sơ đồ kết nối mạch Microsoft Visio Vẽ lưu đồ khối XIN CẢM ƠN 106 ... ngành điện Việt Nam, nhóm em bắt tay vào nghiên cứu thực đề tài ? ?Hệ thống giám sát điện gia đình, có điều khiển cảnh báo q dịng” Trên sở tìm hiểu IoT nhằm giám sát điện thông số khác hệ thống điện. .. tài đồ án ? ?Hệ thống giám sát điện gia đình, có điều khiển cảnh báo q dịng” Trên sở tìm hiểu IoT nhằm giám sát điện thông số khác hệ thống điện từ xa qua internet điện thoại, nhu cầu có thật tăng... GIÁO DỤC VÀO ĐÀO TẠO TRƯỜNG ĐẠI HỌC CÔNG NGHỆ TP HỒ CHÍ MINH ĐỒ ÁN TỐT NGHIỆP ĐỀ TÀI: HỆ THỐNG GIÁM SÁT ĐIỆN NĂNG GIA ĐÌNH, CĨ ĐIỀU KHIỂN VÀ CẢNH BÁO QUÁ DÒNG NGÀNH: KỸ THUẬT ĐIỆN – ĐIỆN TỬ Giảng

Ngày đăng: 22/02/2023, 20:06