(Đồ án hcmute) thiết kế và thi công hệ thống đo và cảnh báo nồng độ các thông số môi trường( co, co2, bụi và uv)

134 4 0
(Đồ án hcmute) thiết kế và thi công hệ thống đo và cảnh báo nồng độ các thông số môi trường( co, co2, bụi và uv)

Đ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

BỘ GIÁO DỤC VÀ ĐÀO TẠO TRƯỜNG ĐẠI HỌC SƯ PHẠM KỸ THUẬT THÀNH PHỐ HỒ CHÍ MINH KHOA ĐIỆN - ĐIỆN TỬ ĐỒ ÁN TỐT NGHIỆP NGÀNH CÔNG NGHỆ KỸ THUẬT ĐIỆN TỬ TRUYỀN THÔNG THIẾT KẾ VÀ THI CÔNG HỆ THỐNG ĐO VÀ CẢNH BÁO NỒNG ĐỘ CÁC THÔNG SỐ MÔI TRƯỜNG (CO, Co2, BỤI VÀ UV) GVHD: KS HÀ A THỒI SVTH : HUỲNH THỊ MỸ DIỆU ĐINH THỊ THANH TUYỀN MSSV: 16141124 16141331 SKL 0 Tp Hồ Chí Minh, tháng 01/2021 an BỘ GIÁO DỤC & ĐÀO TẠO TRƢỜNG ĐẠI HỌC SƢ PHẠM KỸ THUẬT TP HỒ CHÍ MINH KHOA ĐIỆN – ĐIỆN TỬ BỘ MÔN ĐIỆN TỬ CÔNG NGHIỆP – Y SINH - HCMUTE ĐỒ ÁN TỐT NGHIỆP NGÀNH CÔNG NGHỆ KỸ THUẬT ĐIỆN TỬ TRUYỀN THÔNG ĐỀ TÀI: THIẾT KẾ VÀ THI CÔNG HỆ THỐNG ĐO VÀ CẢNH BÁO NỒNG ĐỘ CÁC THÔNG SỐ MÔI TRƢỜNG (CO, CO2, BỤI VÀ UV) GVHD: KS Hà A Thồi SVTH: Huỳnh Thị Mỹ Diệu 16141124 Đinh Thị Thanh Tuyền 16141331 Tp Hồ Chí Minh – 01/2021 an an BỘ GIÁO DỤC & ĐÀO TẠO TRƢỜNG ĐẠI HỌC SƢ PHẠM KỸ THUẬT TP HỒ CHÍ MINH KHOA ĐIỆN – ĐIỆN TỬ BỘ MƠN ĐIỆN TỬ CÔNG NGHIỆP – Y SINH - ĐỒ ÁN TỐT NGHIỆP NGÀNH KỸ THUẬT ĐIỆN TỬ TRUYỀN THÔNG ĐỀ TÀI: THIẾT KẾ VÀ THI CÔNG HỆ THỐNG ĐO VÀ CẢNH BÁO NỒNG ĐỘ CÁC THÔNG SỐ MÔI TRƢỜNG (CO, CO2, BỤI VÀ UV) GVHD: KS Hà A Thồi SVTH: Huỳnh Thị Mỹ Diệu 16141124 Đinh Thị Thanh Tuyền 16141331 Tp Hồ Chí Minh – 01/2021 an TRƯỜNG ĐH SPKT TP HỒ CHÍ MINH CỘNG HÕA XÃ HỘI CHỦ NGHĨA VIỆT NAM KHOA ĐIỆN-ĐIỆN TỬ ĐỘC LẬP - TỰ DO - HẠNH PHÖC BỘ MÔN ĐIỆN TỬ CÔNG NGHIỆP – Y SINH o0o Tp HCM, ngày 20 tháng 01 năm 2021 NHIỆM VỤ ĐỒ ÁN TỐT NGHIỆP Họ tên sinh viên: Huỳnh Thị Mỹ Diệu MSSV: 16141124 Đinh Thị Thanh Tuyền MSSV: 16141331 Chuyên ngành: Điện tử công nghiệp Mã ngành: 141 Hệ đào tạo: Đại học quy Mã hệ: Khóa: 2016 Lớp: 16941DT I TÊN ĐỀ TÀI: THIẾT KẾ VÀ THI CÔNG HỆ THỐNG ĐO VÀ CẢNH BÁO NỒNG ĐỘ CÁC THÔNG SỐ MÔI TRƢỜNG (CO, CO2, BỤI VÀ UV) II NHIỆM VỤ Nội dung thực hiện: - Đọc tài liệu, tìm hiểu tài liệu liên quan tới đồ án - Tìm hiểu cảm biến - Tìm hiểu chuẩn giao tiếp UART - Tìm hiểu phần mềm STM32CubeMX KeilC để giao tiếp với vi điều khiển hệ thống - Thiết kế mơ hình hệ thống - Thiết kế web hiển thị thông số cảnh báo nồng độ khí - Thi công phần cứng, chạy thử nghiệm hiệu chỉnh hệ thống - Thực viết luận văn báo cáo - Tiến hành báo cáo đề tài tốt nghiệp III NGÀY GIAO NHIỆM VỤ: 05/10/2020 IV NGÀY HOÀN THÀNH NHIỆM VỤ: 20/01/2021 V HỌ VÀ TÊN CÁN BỘ HƯỚNG DẪN: CÁN BỘ HƯỚNG DẪN KS Hà A Thồi BM ĐIỆN TỬ CÔNG NGHIỆP – Y SINH Hà A Thồi an TRƢỜNG ĐẠI HỌC SPKT TPHCM Khoa Điện - Điện Tử Bộ Môn Điện Tử Công Nghiệp CỘNG HÕA XÃ HỘI CHỦ NGHĨA VIỆT NAM Độc lập - Tự - Hạnh phúc Tp Hồ Chí Minh, ngày 22 tháng 10 năm 2020 LỊCH TRÌNH THỰC HIỆN ĐỒ ÁN TỐT NGHIỆP (Bản lịch trình đƣợc đóng vào báo cáo) Họ tên sinh viên: Huỳnh Thị Mỹ Diệu MSSV: 16141124 Họ tên sinh viên: Đinh Thị Thanh Tuyền MSSV: 16141331 Lớp: 16941DT Tên đề tài: Thiết kế thi công hệ thống đo cảnh báo nồng độ thông số môi trường (Bụi mịn, CO2, CO tia UV) Tuần/ngày Tuần (05/10 – 11/10) Nội dung Gặp GVHD để nghe phổ biến yêu cầu làm đồ án, tiến hành chọn đồ án - GVHD tiến hành xét duyệt đề tài Tuần (12/10 - 18/10) Tuần (19/10 - 25/10) Tuần - Viết tóm tắt yêu cầu đề tài chọn: Đề tài làm gì, nội dung thiết kế, thông số giới hạn đề tài Tiến hành thiết kế sơ đồ khối, giải thích chức khối - Bổ sung hồn thiện sơ đồ khối mạch (26/10 - 01/11) - Tiến hành tìm hiểu tổng quan linh kiện Tuần - Thiết kế sơ đồ mạch, giải thích nguyên lý hoạt động mạch (02/11 - 08/11) Tuần (09/11 - 15/11) Tuần (16/11 - 22/11) Tuần (23/11 - 29/11) Tuần (30/11 - 06/12) Tuần 10 (07/12 - 13/12) - Mô mạch Chỉnh sửa hoàn thiện sơ đồ nguyên lý mạch Tiến hành tính tốn để lựa chọn linh kiện, vẽ PCB Tiến hành thi công mạch - Kiểm tra mạch thi công - Tiến hành viết giao diện web hiển thị Chỉnh sửa, bổ sung hoàn thiện web an Xác nhận GVHD Tuần 11 (14/12 - 20/12) Tuần 12 (21/12 - 03/01) Tuần 13 (04/01 - 10/01) Tuần 14 (11/01 - 17/01) Tuần 15 (18/01 - 24/01) Tuần 16 (25/01 – 27/01) Kết nối web với mạch Kiểm tra hồn thiện kết nối mạch với web Trang trí, hồn thành sản phẩm viết báo cáo Hoàn thành báo cáo Làm slide, báo cáo với GVHD Bảo vệ Đồ án Tốt nghiệp GV HƯỚNG DẪN (Ký ghi rõ họ tên) Hà A Thồi an LỜI CAM ĐOAN Đề tài nhóm em tự thực dựa vào số tài liệu trước khơng chép từ tài liệu hay cơng trình có trước Người thực đề tài Huỳnh Thị Mỹ Diệu Đinh Thị Thanh Tuyền an LỜI CẢM ƠN Lời chúng em xin gửi lời cảm ơn sâu sắc thầy cô giáo Bộ môn Điện Tử Cơng nghiệp - Y Sinh nói riêng thầy Khoa Điện - Điện tử nói chung giúp đỡ, nhiệt tình bảo chúng em kiến thức liên quan tới lĩnh vực nghiên cứu đề tài, kiến thức sâu rộng bổ ích mà thầy truyền dạy cho chúng em suốt thời gian học tập trường Xin gửi lời cảm ơn chân thành đến giảng viên hướng dẫn KS Hà A Thồi tận tình hướng dẫn, giúp đỡ, cung cấp tài liệu kiến thức quan trọng tạo điều kiện thuận lợi cho chúng em suốt trình thực đề tài Chúng em gửi lời cảm ơn tới ba mẹ người thân đồng hành, chia sẻ động viên tinh thần vật chất suốt trình thực đề tài Chúng em gửi lời cảm ơn tới bạn ngành CNKT Điện tử - Truyền thông K16 trao đổi chia sẻ kiến thức kinh nghiệm quý báu suốt trình thực đề tài Xin chân thành cảm ơn! Ngƣời thực đề tài Huỳnh Thị Mỹ Diệu Đinh Thị Thanh Tuyền an TĨM TẮT Xã hội ngày đại người quan tâm đến vấn đề sức khỏe Vì vậy, nhu cầu sử dụng ứng dụng thơng báo mức độ nhiễm cho người dùng ngày cao Có nhiều loại cảm biến đo thông số môi trường thị trường, nhiên nhiều nghiên cứu hệ thống đo tích hợp loại khí gây nhiễm thơng báo cho người dùng Hiện xu hướng sử dụng dòng vi điều khiển để điều khiển thiết bị STM32, PIC, Arduino, … phát triển cách mạnh mẽ Nhờ mà việc điều khiển hệ thống trở lên thuận tiện dễ dàng nhiều Nội dung đề tài áp dụng kiến thức học vi điều khiển để thiết kế hệ thống đo nồng độ cảnh báo mức độ nguy hiểm chất khơng khí, cụ thể CO, CO2, bụi UV Hệ thống gồm mạch điện tử kết nối với cảm biến điều khiển điều khiển trung tâm STM32F103C8T6 Khi phát chất CO, CO2, bụi UV, vi điều khiển tiến hành xử lý đưa liệu lên web thông qua SIM808 Thông số nồng độ chất hiển thị trang web, giúp người dùng dễ dàng đọc thơng số có biện pháp để hạn chế tác hại chất nồng độ vượt ngưỡng cho phép Thời gian xử lý liệu vi điều khiển nhanh nên người dùng liên tục cập nhập mức độ ảnh hưởng chất môi trường an PHỤ LỤC void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) { if(huart->Instance == USART2) { HAL_UART_Receive_IT(&huart2,(uint8_t*)buffer2,sizeof(buffer2)); } } /* USER CODE END */ /** * @brief This function is executed in case of error occurrence * @retval None */ void Error_Handler(void) { /* USER CODE BEGIN Error_Handler_Debug */ /* User can add his own implementation to report the HAL error return state */ disable_irq(); while (1) { } /* USER CODE END Error_Handler_Debug */ } #ifdef USE_FULL_ASSERT /** * @brief Reports the name of the source file and the source line number * where the assert_param error has occurred * @param file: pointer to the source file name * @param line: assert_param error line source number * @retval None */ BỘ MÔN ĐIỆN TỬ CÔNG NGHIỆP an PHỤ LỤC void assert_failed(uint8_t *file, uint32_t line) { /* USER CODE BEGIN */ /* User can add his own implementation to report the file name and line number, ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */ /* USER CODE END */ } #endif /* USE_FULL_ASSERT */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ Code debugControl #include "debugControl.h" extern extern extern extern extern extern extern uint8_t uint8_t uint8_t uint8_t uint8_t uint8_t uint8_t debug_string; debug; SIM_active; GPRS_active; HTTP_active; enable_GPS; getVDD; extern char status[50]; extern char buffer2[500]; extern extern extern extern uint16_t uint16_t uint16_t uint16_t timer1_ms; timer1_min; debugging_PreTimer; debuggingTime; void DebuggingSystem(void) { if(debug) { /*Debugging the system*/ SIM808_init(); /*Set the debugging duration, if an error occured, the duration/2*/ if(!GPRS_active||!SIM_active) debuggingTime = 1; //minutes else debuggingTime = 2; //minutes debug = 0; // debugging_PreTimer = timer1_ms; debugging_PreTimer = timer1_min; } } BỘ MÔN ĐIỆN TỬ CÔNG NGHIỆP an PHỤ LỤC void SIM808_init(void) { if(debug_string) strcpy(status,"Check SIM"); else strcpy(status,"Debugging "); SIM_active = Check_SIM_activated(); if(debug_string) strcpy(status,"Check GPRS"); GPRS_active = Check_GPRS_connection(); if(debug_string) strcpy(status,"Check HTTP"); HTTP_active = Check_HTTP_Service(); if(SIM_active&&GPRS_active&&HTTP_active) { /*If everything run smoothly our work is done*/ /*Last check for GPS activation, and HTTP_PARA*/ if(enable_GPS) { if(!Check_GPS_activated()) { if(debug_string) { strcpy(status,"Enable GPS"); HAL_Delay(2000); } Send_Command_SIM(GPS_On,OK,1000,1); } } else { if(Check_GPS_activated()) Send_Command_SIM(GPS_Off,OK,1000,1); } Send_Command_SIM(HTTP_TERM,OK,1000,1); Init_HTTP(); strcpy(status,"System OK 1!"); return; } /*If SIM have a problem*/ if(!SIM_active) { if(!getVDD) { strcpy(status,"ERROR:VDD=0"); return; } Start_SIM(); } /*If couldnt connected to GPRS*/ if(!GPRS_active) { if(!Send_Command_SIM("AT+CPIN?\r\n",OK,1000,1)) { strcpy(status,"Check SIM card connection"); HAL_Delay(2000); Reset_SIM(); HAL_Delay(8000); } BỘ MÔN ĐIỆN TỬ CÔNG NGHIỆP an PHỤ LỤC Activate_GPRS(); } /*Check again*/ SIM_active = Check_SIM_activated(); GPRS_active = Check_GPRS_connection(); HTTP_active = Check_HTTP_Service(); if(SIM_active) { if(GPRS_active) { Send_Command_SIM(HTTP_TERM,OK,1000,1); if(Init_HTTP()) { HTTP_active = 1; if(debug_string) { strcpy(status,"HTTP init succeed"); HAL_Delay(2000); } } else { HTTP_active = 0; if(debug_string) { strcpy(status,"HTTP fail"); HAL_Delay(2000); } } strcpy(status,"System OK 2!"); } else strcpy(status,"ERROR:GPRS offline"); if(enable_GPS) { if(!Check_GPS_activated()) { if(debug_string) { strcpy(status,"Enable GPS"); HAL_Delay(2000); } Send_Command_SIM(GPS_On,OK,1000,1); } } else { if(Check_GPS_activated()) Send_Command_SIM(GPS_Off,OK,1000,1); } } else { SIM_active = 0; GPRS_active = 0; HTTP_active = 0; strcpy(status,"ERROR:SIM808 offline"); } } BỘ MÔN ĐIỆN TỬ CÔNG NGHIỆP an PHỤ LỤC Code SIM808 #include "SIM808.h" #include "string.h" #include "stdio.h" /*EXTERN FROM MAIN*/ extern UART_HandleTypeDef huart2; extern char buffer2[500]; extern char status[50]; extern char debug_string; extern uint8_t debug; extern uint8_t postData; extern uint8_t getData; extern uint8_t getGPS; extern uint8_t getSMS; char lengh[100]; void Power_On(void) { HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, GPIO_PIN_SET); // RST_SIM muc HAL_GPIO_WritePin(CS_SIM_GPIO_Port,CS_SIM_Pin,GPIO_PIN_SET); if(debug_string) strcpy(status,"Power on"); HAL_Delay(2000); HAL_GPIO_WritePin(CS_SIM_GPIO_Port,CS_SIM_Pin,GPIO_PIN_RESET); } void Power_Off(void) { HAL_GPIO_WritePin(CS_SIM_GPIO_Port,CS_SIM_Pin,GPIO_PIN_SET); if(debug_string) { strcpy(status,"Power off"); HAL_Delay(2000); } HAL_GPIO_WritePin(CS_SIM_GPIO_Port,CS_SIM_Pin,GPIO_PIN_RESET); } void Reset_SIM(void) { HAL_GPIO_WritePin(RST_SIM_GPIO_Port,RST_SIM_Pin,GPIO_PIN_RESET); if(debug_string) strcpy(status,"Reset SIM"); HAL_Delay(100); HAL_GPIO_WritePin(RST_SIM_GPIO_Port,RST_SIM_Pin,GPIO_PIN_SET); } uint8_t Send_Command_SIM(char* command,char* responce,uint32_t timeout,uint8_t clear_buffer) { uint32_t time; uint8_t length; length=strlen(command); time=timeout; if(HAL_UART_Transmit(&huart2,(uint8_t*)command,length,500) != HAL_OK) return 0; while(strstr(buffer2,(const char*)responce)==NULL) { BỘ MÔN ĐIỆN TỬ CÔNG NGHIỆP an PHỤ LỤC if(time==0) { if(clear_buffer) Clear_Buffer2(); return 0; } time ; HAL_Delay(1); } if(clear_buffer) Clear_Buffer2(); return 1; } uint8_t Check_SIM_activated(void) { if(Send_Command_SIM(AT,OK,1000,1)) return 1; else if(Send_Command_SIM(AT,"ERROR",1000,1)) return 1; return 0; } uint8_t Check_GPS_activated(void) { if(Send_Command_SIM(GPS_Query,"+CGNSPWR: 1",1000,1)) return 1; else return 0; } void Start_SIM(void) { Power_On(); HAL_Delay(8000); if(debug_string) strcpy(status,"Send ATE0"); Send_Command_SIM(ATE0,OK,1000,1); } uint8_t Check_GPRS_connection(void) { if(Send_Command_SIM(SAPBR4,"+SAPBR: 1,1,",2000,1)) { HAL_Delay(800); Clear_Buffer2(); return 1; } else return 0; } void Activate_GPRS(void) { if(debug_string) strcpy(status,"Set connection type is GPRS"); if(!Send_Command_SIM(SAPBR1,OK,1000,1)) { /*If the system take too long to reconnect,*/ BỘ MÔN ĐIỆN TỬ CÔNG NGHIỆP an PHỤ LỤC /*meanning something has went wrong, Its no point for waiting*/ /*return the Function*/ HAL_Delay(1000); if(!Send_Command_SIM(SAPBR1,OK,1000,1)) return; } if(debug_string) strcpy(status,"Set APN"); if(!Send_Command_SIM(SAPBR2,OK,1000,1)) { HAL_Delay(1000); if(!Send_Command_SIM(SAPBR2,OK,1000,1)) return; } if(debug_string) strcpy(status,"Set USER"); if(!Send_Command_SIM(SAPBR2_1,OK,1000,1)) { HAL_Delay(1000); if(!Send_Command_SIM(SAPBR2_1,OK,1000,1)) return; } if(debug_string) strcpy(status,"Set PWD"); if(!Send_Command_SIM(SAPBR2_2,OK,1000,1)) { HAL_Delay(1000); if(!Send_Command_SIM(SAPBR2_2,OK,1000,1)) return; } if(debug_string) strcpy(status,"Enable GPRS"); if(!Send_Command_SIM(SAPBR3,OK,1300,1)) { HAL_Delay(1000); if(!Send_Command_SIM(SAPBR3,OK,1300,1)) return; } if(debug_string) strcpy(status,"Get IP"); if(!Send_Command_SIM(SAPBR4,OK,1300,1)) { HAL_Delay(1000); if(!Send_Command_SIM(SAPBR4,OK,1300,1)) return; } if(debug_string) strcpy(status,"Define PDP"); if(!Send_Command_SIM(CGDCONT,OK,1000,1)) { HAL_Delay(1000); if(!Send_Command_SIM(CGDCONT,OK,1000,1)) return; } if(debug_string) strcpy(status,"Attach to GPRS"); if(!Send_Command_SIM(GPRS_ATTACH,OK,1000,1)) { HAL_Delay(1000); if(!Send_Command_SIM(GPRS_ATTACH,OK,1000,1)) return; BỘ MÔN ĐIỆN TỬ CÔNG NGHIỆP an PHỤ LỤC } } uint8_t Init_HTTP(void) { if(debug_string) strcpy(status,"Setup HTTP"); Send_Command_SIM(HTTP_INIT,OK,1000,1); HAL_Delay(500); Send_Command_SIM(HTTPSSL_ON,OK,1000,1); HAL_Delay(500); if(debug_string) strcpy(status,"Set HTTP_PARA1"); Send_Command_SIM(HTTP_PARA1,OK,1000,1); HAL_Delay(500); if(debug_string) strcpy(status,"Set HTTP_PARA2"); Send_Command_SIM(HTTP_PARA2,OK,1000,1); HAL_Delay(500); if(Send_Command_SIM(QUERY_HTTPINIT,OK,1000,1)) { HAL_Delay(500); return 1; } else { HAL_Delay(500); return 0; } } uint8_t Check_HTTP_Service(void) { if(Send_Command_SIM(QUERY_HTTPINIT,OK,1000,1)) return 1; else return 0; } uint8_t Post_HTTP_Data(char *data, char* HTTP_PARA3) { if(debug_string) strcpy(status,"Set HTTP_PARA1"); Send_Command_SIM(HTTP_PARA1,OK,1000,1); if(debug_string) strcpy(status,"Set HTTP_PARA2"); Send_Command_SIM(HTTP_PARA2,OK,1000,1); if(debug_string) strcpy(status,"Set HTTP_PARA3"); if(!Send_Command_SIM(HTTP_PARA3,OK,1000,1)) return 0; if(debug_string) strcpy(status,"DOWNLOAD DATA"); sprintf(lengh,"AT+HTTPDATA=%d,%d\r\n",strlen(data),10000); Send_Command_SIM(lengh,"DOWNLOAD",1000,1); Send_Command_SIM(data,"OK",1000,1); if(debug_string) strcpy(status,"POST DATA"); if(!Send_Command_SIM(HTTP_POST,"+HTTPACTION: 1,20",3500,1)) return 0; return 1; BỘ MÔN ĐIỆN TỬ CÔNG NGHIỆP an PHỤ LỤC } void Clear_Buffer2(void) { unsigned short _size = sizeof(buffer2); huart2.RxXferCount = _size; huart2.pRxBuffPtr=(uint8_t *)&buffer2[0]; memset(buffer2,0,_size); } Code timerControl #include "timerControl.h" extern uint16_t timer1_ms; extern uint16_t timer1_min; extern uint16_t debugging_PreTimer; extern extern extern extern extern extern extern extern uint16_t debuggingTime; uint16_t GetGPS_PreTimer; uint16_t PostData_PreTimer; uint16_t Sensor_PreTimer; uint8_t debug; uint8_t postData; uint8_t getGPS; uint8_t flagSensor; // Other void updateTimer() { if(timer1_Check(&timer1_min,&debugging_PreTimer,debuggingTime)) debug = 1; /*Control the time GET GPS data*/ if(timer1_Check(&timer1_ms,&GetGPS_PreTimer,5000)) getGPS = 1; /*Control the time POST data*/ if(timer1_Check(&timer1_ms,&PostData_PreTimer,5000)) postData = 1; // Other } uint8_t timer1_Check(uint16_t *timer1_,uint16_t *timer1_previous,uint16_t duration_time) { if(*timer1_ > *timer1_previous) { if(*timer1_ - *timer1_previous >= duration_time) return 1; } if(*timer1_ < *timer1_previous) { if((60000 - (*timer1_previous - *timer1_)) >= duration_time) return 1; } return 0; } BỘ MÔN ĐIỆN TỬ CÔNG NGHIỆP an PHỤ LỤC Diệu Tuyền Thông số môi
  • CO
  • CO2
  • DoBui
  • UV
  • KinhDo
  • ViDo
GVHD: Hà A Thồi SVTH: Huỳnh Thị Mỹ Diệu: 16141124 BỘ MÔN ĐIỆN TỬ CÔNG NGHIỆP an PHỤ LỤC Đinh Thị Thanh Tuyền: 16141331 Chương trình lấy liệu từ firebase cảnh báo var val_CO; var val_CO2; var val_UV; var val_DoBui; var data = firebase.database().ref().child("data"); data.on('value', function (r) { r.forEach(function (item) { entry = item.val(); console.log(entry); val_CO = entry.CO; val_CO2 = entry.CO2; val_UV = entry.UV; val_DoBui = entry.DoBui; }); document.getElementById('CO').innerHTML = entry.CO+"ppm"; document.getElementById('CO2').innerHTML = entry.CO2 +"ppm" ; document.getElementById('tiaUV').innerHTML entry.UV+"mW/cm2" ; = document.getElementById('DoBui').innerHTML = entry.DoBui +"mg/m3"; document.getElementById('KinhDo').innerHTML entry.KinhDo+" " ; document.getElementById('ViDo').innerHTML "; BỘ MÔN ĐIỆN TỬ CÔNG NGHIỆP an = = entry.ViDo +" PHỤ LỤC if(val_CO-0>100) playsound1(); if(val_CO2-0>400) playsound1(); if(val_UV-0>7) playsound1(); if(val_DoBui-0>0.1) playsound1(); }); //firebase.database().ref().child("/").set(null); function playsound1() { var audio = new Audio('WARNING.mp3'); audio.play(); } Chương trình xử lý màu khoảng cách đối tượng giao diện .main{ width: 550px; margin: 0px auto; border-left: 2px solid blue; border-right: 2px solid blue; border-bottom: 2px solid blue; } h1{ color: blue; text-align: center; border: 2px solid blue; margin: 0px; padding: 10px 10px; background-color: rgb(194, 255, 251); } ul li{ margin: 0px; padding: 0px; list-style: none; font-size: 30px; } notice{ BỘ MÔN ĐIỆN TỬ CÔNG NGHIỆP an PHỤ LỤC margin-left: 60px; } air{ padding: 0px; margin: 0px; float: left; } khi{ width: 150px; } val{ text-align: center; } value{ padding: 0px; margin: 0px; } #text1{ color: maroon; font-size: 50px; } text2{ color: maroon; font-size: 25px; margin: 30px; clear: left; } nds{ font-size: 30px; margin: 60px; } #das{ margin-left: 20px; } BỘ MÔN ĐIỆN TỬ CÔNG NGHIỆP an S an K L 0

Ngày đăng: 27/12/2023, 03:34

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan