This shows you the differences between two versions of the page.
iothings:proiecte:2022sric:smart-room-monitoring-and-control-system [2023/06/02 04:43] claudiu.pumnea 1 |
iothings:proiecte:2022sric:smart-room-monitoring-and-control-system [2023/06/02 09:11] (current) claudiu.pumnea [Code description] |
||
---|---|---|---|
Line 27: | Line 27: | ||
* EspWROOM32: Microcontroller that integrates Wi-Fi (802.11 b/g) and Bluetooth (dual mode version 4.2) capabilities. It serves as the core of the project, enabling data collection from sensors and transmitting the it to a database through requests. Additionally, the ESP32 is responsible for controlling various components of the system, such as managing lights and outlets in the kitchen. | * EspWROOM32: Microcontroller that integrates Wi-Fi (802.11 b/g) and Bluetooth (dual mode version 4.2) capabilities. It serves as the core of the project, enabling data collection from sensors and transmitting the it to a database through requests. Additionally, the ESP32 is responsible for controlling various components of the system, such as managing lights and outlets in the kitchen. | ||
+ | === Hardware setup === | ||
+ | |||
+ | {{ :iothings:proiecte:2022sric:hardwaresetup.jpeg?300 |}} | ||
---- | ---- | ||
Line 49: | Line 52: | ||
These technologies form the foundation of the project, combining front-end (HTML, CSS, React), back-end ( Nest.js), and database (PostgreSQL) components to create a comprehensive web application with enhanced functionality and a reliable data storage system. | These technologies form the foundation of the project, combining front-end (HTML, CSS, React), back-end ( Nest.js), and database (PostgreSQL) components to create a comprehensive web application with enhanced functionality and a reliable data storage system. | ||
- | ===== Code description ===== | + | ===== Code ===== |
==== Used Libraries ==== | ==== Used Libraries ==== | ||
Line 160: | Line 163: | ||
pinMode(CURRENT_OUTLET_RELAY_PIN, OUTPUT); | pinMode(CURRENT_OUTLET_RELAY_PIN, OUTPUT); | ||
pinMode(GAS_SENSOR_MQ2_PIN, INPUT); | pinMode(GAS_SENSOR_MQ2_PIN, INPUT); | ||
- | pinMode(LIGHT_CURRENT_SENSOR_PIN, INPUT); | ||
- | pinMode(OUTLET_CURRENT_SENSOR_PIN, INPUT); | ||
//Setting the initial state of the relays | //Setting the initial state of the relays | ||
Line 353: | Line 354: | ||
- Electric Relay Table: | - Electric Relay Table: | ||
- | * The "electric_relay" table is used to control the outputs and lights in the system. | + | * The "electrical_relay" table is used to control the outputs and lights in the system. |
* It has properties like "isOn" to indicate if the relay should be closed or not, and "isUsedFor" to specify whether it is used for outlets or lights. | * It has properties like "isOn" to indicate if the relay should be closed or not, and "isUsedFor" to specify whether it is used for outlets or lights. | ||
* This table helps manage and control the electrical components of the system. | * This table helps manage and control the electrical components of the system. | ||
Line 360: | Line 361: | ||
* The "room_inputs" table is used to store variables related to monitoring the room. | * The "room_inputs" table is used to store variables related to monitoring the room. | ||
* It holds the data collected from sensors or other inputs for monitoring purposes. | * It holds the data collected from sensors or other inputs for monitoring purposes. | ||
+ | |||
+ | ==== Application walkthrough ===== | ||
+ | |||
+ | First time when you will open the app you will be redirected to the login page: | ||
+ | |||
+ | {{ :iothings:proiecte:2022sric:loginpagemonitoringandcontrolsystem.png |}} | ||
+ | |||
+ | After a successful login, users are directed to the monitoring and control page. The page features two dropdown menus, one for selecting the apartments and another for choosing the rooms. This allows users to manage multiple apartments and select specific rooms within those apartments. For the purpose of the demo and screenshots, a single room (the kitchen) is being used. | ||
+ | |||
+ | On the page, users can find two graphs, one displaying the temperature and the other showing the humidity data. These graphs provide visual representation of the collected data. Users can customize the plotted data by selecting a start and end date using the date and time pickers. This allows them to view data recorded within a specific time period. | ||
+ | |||
+ | In addition to monitoring the data, the page also provides switches for controlling the relays individually. This functionality enables users to control the electrical components such as lights or outlets associated with each room. | ||
+ | |||
+ | {{ :iothings:proiecte:2022sric:loginmonitoringandcontrolsystem.png |}} | ||
+ | |||
+ | ===== Demo ==== | ||
+ | |||
+ | In the demo, the main page of the web app will be showcased, featuring the date pickers that allow users to select a specific time range for data visualization. To illustrate the control system, a light bulb will be connected to the relay by connecting the positive terminal of the outlet to the positive terminal of the bulb. We will be able to switch the relay on or off, thereby controlling the power supply to the light bulb in real-time. | ||
+ | |||
+ | Links: | ||
+ | * https://www.youtube.com/watch?v=L_2GDmiQ1Do Here the app is presented with the focus on its date pickers feature. | ||
+ | * https://www.youtube.com/watch?v=gNgK9Tk7Zqg&list=PLtRGGOiyGrNN6PvqboIy8p1ljLqFSURG8&index=2 Here, the system control part of the project is showcased. By accident, I connected the bulb to the current outlet relay instead of connecting it to the designated light relay, but you still can see the functionality. | ||
+ | * https://www.youtube.com/watch?v=_KdiClldT98 Here is showed the case where the level of the water is over 30% and the relays are turned off automatically. | ||
+ | |||
+ | |||
+ | ===== Bibliography ==== | ||
+ | |||
+ | * Typeorm: https://typeorm.io/ | ||
+ | * Typescript: https://www.typescriptlang.org/docs/ | ||
+ | * Nest: https://docs.nestjs.com/ | ||
+ | * React: https://reactjs.org/docs/getting-started.html | ||
+ | * esp32: http://esp32.net/, https://ieeexplore.ieee.org/abstract/document/8765944 | ||
+ | * Dht11: https://components101.com/sensors/dht11-temperature-sensor | ||
+ | * MQ2: https://lastminuteengineers.com/mq2-gas-senser-arduino-tutorial/ | ||
+ | * WaterLevelSensor: https://lastminuteengineers.com/water-level-sensor-arduino-tutorial/ | ||
+ | * Relays: https://www.galco.com/comp/prod/relay.htm | ||
+ | * RestApi: https://www.restapitutorial.com/lessons/httpmethods.html | ||