From 254c2533d0c3bf1c42018c942307fb6d481a75c2 Mon Sep 17 00:00:00 2001 From: Dano van den Bosch Date: Tue, 13 Feb 2024 12:31:39 +0100 Subject: [PATCH 01/30] Add Rasberry Pi documentation --- .../InfrastructuurDocumentatie/rasberryPi.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 docs/Sp1Schets van het project/InfrastructuurDocumentatie/rasberryPi.md diff --git a/docs/Sp1Schets van het project/InfrastructuurDocumentatie/rasberryPi.md b/docs/Sp1Schets van het project/InfrastructuurDocumentatie/rasberryPi.md new file mode 100644 index 0000000..ae2aab0 --- /dev/null +++ b/docs/Sp1Schets van het project/InfrastructuurDocumentatie/rasberryPi.md @@ -0,0 +1,15 @@ +#Rasberry Pi + +##Table of contents + +##Introduction + +##Rasberry Pi + +###Dev Page + +##Database + +###Database software + +###Esp to database \ No newline at end of file From 54a83e4a6239d3069cd93960e00a094966e09b35 Mon Sep 17 00:00:00 2001 From: Dano van den Bosch Date: Tue, 13 Feb 2024 12:34:22 +0100 Subject: [PATCH 02/30] Pages updated --- docs/.pages | 2 ++ .../{rasberryPi.md => raspberryPi.md} | 0 2 files changed, 2 insertions(+) rename docs/Sp1Schets van het project/InfrastructuurDocumentatie/{rasberryPi.md => raspberryPi.md} (100%) diff --git a/docs/.pages b/docs/.pages index c4543b4..3584ddd 100644 --- a/docs/.pages +++ b/docs/.pages @@ -8,6 +8,8 @@ nav: - Links: opdracht/links - 📚 Documentatie: - I2C: arduino-documentation/i2c-ESP32 + - Infrastructuur documentation: + - Raspberry Pi: InfrastructuurDocumentatie/raspberryPi.md - 🧠 Brainstorm: - Ideeën: brainstorm/ideeën - Database design: brainstorm/Database diff --git a/docs/Sp1Schets van het project/InfrastructuurDocumentatie/rasberryPi.md b/docs/Sp1Schets van het project/InfrastructuurDocumentatie/raspberryPi.md similarity index 100% rename from docs/Sp1Schets van het project/InfrastructuurDocumentatie/rasberryPi.md rename to docs/Sp1Schets van het project/InfrastructuurDocumentatie/raspberryPi.md From 82905faf3cdba5f59dce357607e52918450766eb Mon Sep 17 00:00:00 2001 From: Dano van den Bosch Date: Tue, 13 Feb 2024 12:37:37 +0100 Subject: [PATCH 03/30] pages --- docs/.pages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/.pages b/docs/.pages index 3584ddd..cad03fc 100644 --- a/docs/.pages +++ b/docs/.pages @@ -9,7 +9,7 @@ nav: - 📚 Documentatie: - I2C: arduino-documentation/i2c-ESP32 - Infrastructuur documentation: - - Raspberry Pi: InfrastructuurDocumentatie/raspberryPi.md + - I2C: arduino-documentation/i2c-ESP32 - 🧠 Brainstorm: - Ideeën: brainstorm/ideeën - Database design: brainstorm/Database From 19433c3a6711fa4de56065ac7c3e1a57699ee6fd Mon Sep 17 00:00:00 2001 From: Dano van den Bosch Date: Tue, 13 Feb 2024 12:38:13 +0100 Subject: [PATCH 04/30] Pages changes reverted --- docs/.pages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/.pages b/docs/.pages index cad03fc..3584ddd 100644 --- a/docs/.pages +++ b/docs/.pages @@ -9,7 +9,7 @@ nav: - 📚 Documentatie: - I2C: arduino-documentation/i2c-ESP32 - Infrastructuur documentation: - - I2C: arduino-documentation/i2c-ESP32 + - Raspberry Pi: InfrastructuurDocumentatie/raspberryPi.md - 🧠 Brainstorm: - Ideeën: brainstorm/ideeën - Database design: brainstorm/Database From 5af5637027f9f2f3f2d0fb457cf485c78711a3ee Mon Sep 17 00:00:00 2001 From: Dano van den Bosch Date: Tue, 13 Feb 2024 12:44:12 +0100 Subject: [PATCH 05/30] rasberry emoji --- docs/.pages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/.pages b/docs/.pages index 3584ddd..e804870 100644 --- a/docs/.pages +++ b/docs/.pages @@ -9,7 +9,7 @@ nav: - 📚 Documentatie: - I2C: arduino-documentation/i2c-ESP32 - Infrastructuur documentation: - - Raspberry Pi: InfrastructuurDocumentatie/raspberryPi.md + - 🍓 Raspberry Pi: InfrastructuurDocumentatie/raspberryPi.md - 🧠 Brainstorm: - Ideeën: brainstorm/ideeën - Database design: brainstorm/Database From 6a640ba96f44d25920a0f325de78a64ff43b1c1a Mon Sep 17 00:00:00 2001 From: Dano van den Bosch Date: Tue, 13 Feb 2024 12:49:31 +0100 Subject: [PATCH 06/30] added path --- docs/.pages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/.pages b/docs/.pages index e804870..2bd6e87 100644 --- a/docs/.pages +++ b/docs/.pages @@ -9,7 +9,7 @@ nav: - 📚 Documentatie: - I2C: arduino-documentation/i2c-ESP32 - Infrastructuur documentation: - - 🍓 Raspberry Pi: InfrastructuurDocumentatie/raspberryPi.md + - 🍓 Raspberry Pi: Sp1Schets van het project/InfrastructuurDocumentatie/raspberryPi.md - 🧠 Brainstorm: - Ideeën: brainstorm/ideeën - Database design: brainstorm/Database From 0754c661d2dae9918c5db3f2b56017e15ebea566 Mon Sep 17 00:00:00 2001 From: Dano van den Bosch Date: Tue, 13 Feb 2024 12:52:14 +0100 Subject: [PATCH 07/30] Changes spaces in folder name --- .../HetAlgehelePLan.md | 0 .../InfrastructuurDocumentatie/raspberryPi.md | 0 .../infrastructuur.md | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename docs/{Sp1Schets van het project => Sp1SchetsProject}/HetAlgehelePLan.md (100%) rename docs/{Sp1Schets van het project => Sp1SchetsProject}/InfrastructuurDocumentatie/raspberryPi.md (100%) rename docs/{Sp1Schets van het project => Sp1SchetsProject}/infrastructuur.md (100%) diff --git a/docs/Sp1Schets van het project/HetAlgehelePLan.md b/docs/Sp1SchetsProject/HetAlgehelePLan.md similarity index 100% rename from docs/Sp1Schets van het project/HetAlgehelePLan.md rename to docs/Sp1SchetsProject/HetAlgehelePLan.md diff --git a/docs/Sp1Schets van het project/InfrastructuurDocumentatie/raspberryPi.md b/docs/Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi.md similarity index 100% rename from docs/Sp1Schets van het project/InfrastructuurDocumentatie/raspberryPi.md rename to docs/Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi.md diff --git a/docs/Sp1Schets van het project/infrastructuur.md b/docs/Sp1SchetsProject/infrastructuur.md similarity index 100% rename from docs/Sp1Schets van het project/infrastructuur.md rename to docs/Sp1SchetsProject/infrastructuur.md From 6035fe971bed443a0e45307a350349b631fd224d Mon Sep 17 00:00:00 2001 From: Dano van den Bosch Date: Tue, 13 Feb 2024 12:52:34 +0100 Subject: [PATCH 08/30] Update Raspberry Pi documentation path --- docs/.pages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/.pages b/docs/.pages index 2bd6e87..e8b9858 100644 --- a/docs/.pages +++ b/docs/.pages @@ -9,7 +9,7 @@ nav: - 📚 Documentatie: - I2C: arduino-documentation/i2c-ESP32 - Infrastructuur documentation: - - 🍓 Raspberry Pi: Sp1Schets van het project/InfrastructuurDocumentatie/raspberryPi.md + - 🍓 Raspberry Pi: Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi.md - 🧠 Brainstorm: - Ideeën: brainstorm/ideeën - Database design: brainstorm/Database From 5911f56be707f81240a3e08e2e8d96f37769b698 Mon Sep 17 00:00:00 2001 From: Dano van den Bosch Date: Tue, 13 Feb 2024 13:12:24 +0100 Subject: [PATCH 09/30] Update Raspberry Pi documentation path --- docs/.pages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/.pages b/docs/.pages index e8b9858..e4a71d9 100644 --- a/docs/.pages +++ b/docs/.pages @@ -9,7 +9,7 @@ nav: - 📚 Documentatie: - I2C: arduino-documentation/i2c-ESP32 - Infrastructuur documentation: - - 🍓 Raspberry Pi: Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi.md + - 🍓 Raspberry Pi: docs\Sp1SchetsProject\InfrastructuurDocumentatie\raspberryPi.md - 🧠 Brainstorm: - Ideeën: brainstorm/ideeën - Database design: brainstorm/Database From 6906dc0c632786c10af2065822fa361e04ca530f Mon Sep 17 00:00:00 2001 From: Dano van den Bosch Date: Tue, 13 Feb 2024 13:15:20 +0100 Subject: [PATCH 10/30] Update Raspberry Pi documentation path --- docs/.pages | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/.pages b/docs/.pages index e4a71d9..d463886 100644 --- a/docs/.pages +++ b/docs/.pages @@ -8,8 +8,7 @@ nav: - Links: opdracht/links - 📚 Documentatie: - I2C: arduino-documentation/i2c-ESP32 - - Infrastructuur documentation: - - 🍓 Raspberry Pi: docs\Sp1SchetsProject\InfrastructuurDocumentatie\raspberryPi.md + - 🍓 Raspberry Pi: docs\Sp1SchetsProject\InfrastructuurDocumentatie\raspberryPi.md - 🧠 Brainstorm: - Ideeën: brainstorm/ideeën - Database design: brainstorm/Database From d473917968cc030bfd5c25902fd59f44e4b280d0 Mon Sep 17 00:00:00 2001 From: Dano van den Bosch Date: Tue, 13 Feb 2024 13:17:50 +0100 Subject: [PATCH 11/30] Update Raspberry Pi documentation path --- docs/.pages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/.pages b/docs/.pages index d463886..644db6b 100644 --- a/docs/.pages +++ b/docs/.pages @@ -8,7 +8,7 @@ nav: - Links: opdracht/links - 📚 Documentatie: - I2C: arduino-documentation/i2c-ESP32 - - 🍓 Raspberry Pi: docs\Sp1SchetsProject\InfrastructuurDocumentatie\raspberryPi.md + - 🍓 Raspberry Pi: docs/Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi - 🧠 Brainstorm: - Ideeën: brainstorm/ideeën - Database design: brainstorm/Database From 1882d09fb51987ec95dae01cc07d701dbdad4a49 Mon Sep 17 00:00:00 2001 From: Dano van den Bosch Date: Tue, 13 Feb 2024 13:27:34 +0100 Subject: [PATCH 12/30] Update Raspberry Pi documentation path --- docs/.pages | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/.pages b/docs/.pages index 644db6b..e16c25a 100644 --- a/docs/.pages +++ b/docs/.pages @@ -8,7 +8,7 @@ nav: - Links: opdracht/links - 📚 Documentatie: - I2C: arduino-documentation/i2c-ESP32 - - 🍓 Raspberry Pi: docs/Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi + - 🍓 Raspberry Pi: Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi - 🧠 Brainstorm: - Ideeën: brainstorm/ideeën - Database design: brainstorm/Database From cdb2bd0d0bc8dd9b20962b445b9f48067667ce96 Mon Sep 17 00:00:00 2001 From: Dano van den Bosch Date: Tue, 13 Feb 2024 13:58:29 +0100 Subject: [PATCH 13/30] added tabel of contents --- .../InfrastructuurDocumentatie/raspberryPi.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi.md b/docs/Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi.md index ae2aab0..4664de6 100644 --- a/docs/Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi.md +++ b/docs/Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi.md @@ -1,6 +1,12 @@ #Rasberry Pi ##Table of contents +1. [Introduction](##introduction) +2. [Rasberry-Pi](##Rasberry-Pi) +3. [Dev-Page](###Dev-Page) +4. [Database](##Database) +5. [Database-software](###Database-software) +6. [Esp-to-database](###Esp-to-database) ##Introduction From 567a66212254151321b3d966df53903e073592fe Mon Sep 17 00:00:00 2001 From: Dano van den Bosch Date: Tue, 13 Feb 2024 14:02:53 +0100 Subject: [PATCH 14/30] Update headings in raspberryPi.md --- .../InfrastructuurDocumentatie/raspberryPi.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi.md b/docs/Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi.md index 4664de6..35d3b94 100644 --- a/docs/Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi.md +++ b/docs/Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi.md @@ -2,11 +2,11 @@ ##Table of contents 1. [Introduction](##introduction) -2. [Rasberry-Pi](##Rasberry-Pi) +2. [Rasberry Pi](##Rasberry-Pi) 3. [Dev-Page](###Dev-Page) 4. [Database](##Database) -5. [Database-software](###Database-software) -6. [Esp-to-database](###Esp-to-database) +5. [Database software](###Database-software) +6. [Esp to database](###Esp-to-database) ##Introduction From 4954e955498fb5561422ab891d14a34e753533df Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 13 Feb 2024 14:36:59 +0100 Subject: [PATCH 15/30] Added documentation infrastructure uml --- docs/brainstorm/UML infrastructure.md | 39 ++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/docs/brainstorm/UML infrastructure.md b/docs/brainstorm/UML infrastructure.md index 63d23e1..c97d7ca 100644 --- a/docs/brainstorm/UML infrastructure.md +++ b/docs/brainstorm/UML infrastructure.md @@ -5,14 +5,15 @@ ``` mermaid classDiagram -Node --> Raspberry pi : postData - +Node --> Raspberry pi : Websocket +Raspberry pi --> Website : getData +Raspberry pi <--> EnqueteNode : Websocket namespace Server { class Raspberry pi { Database() Webserver() - + Websocket() } class Node { @@ -22,7 +23,39 @@ namespace Server { +Tfok +Sound collectData() + } } + + +namespace User { + class Website { + +Co2 + +Temperature + +Humidity + +Tfok + +Sound + +Graph + +Map + +Settings + GetData() + } + class EnqueteNode { + +Co2 + +Temperature + +Humidity + +Tfok + +Sound + +Graph + +Map + +QuestionResponse + EnqueteDisplay() + EnqueteButtons() + GetData() + + + } + +} ``` From 9dec623af0eaa29409c428dbf0a814685398fffb Mon Sep 17 00:00:00 2001 From: Sietse Jonker Date: Tue, 13 Feb 2024 14:39:37 +0100 Subject: [PATCH 16/30] adds documentation for nodes --- docs/node-documentation/node-sensors.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 docs/node-documentation/node-sensors.md diff --git a/docs/node-documentation/node-sensors.md b/docs/node-documentation/node-sensors.md new file mode 100644 index 0000000..df55b5b --- /dev/null +++ b/docs/node-documentation/node-sensors.md @@ -0,0 +1,22 @@ +# Node sensor documentation + +## How does it work? + +The nodes are used to collect data about the environment. They are connected to the database using post requests, every node sends a post request to the database with the sensordata it has collected. The database then stores this data in the right table. Every node is also connected to a websocket server, this server is used to send the data to the frontend. The frontend then uses this data to display the current situation in the environment. + +Every node has the same sensors, this makes it easy to create more and ensures that you get as many equal measurements as possible everywhere. There is 1 node that will be different. This is the one with the screen. This will have some other functions. + +The goal is to put every node on a populated area or in every room, this way we can get a good overview of the environment and react on it to make it more comfortable for everyone. + +## What sensors will we use? + +We will use the following sensors in the nodes: +* SGP30 for eCO2 and TVOC +* DHT11 for temperature and humidity +* Sound sensor for sound level + +We chose these sensors because they are cheap to buy and don't require a lot of power to run. This makes it easy to create more nodes and to put them everywhere. These sensors aren't the most accurate, but they are good enough for our use case. Since we will only use them to get an overview of the environment and not for scientific research. + +## Appearance of the nodes + +Every node has the sensors listed above. The also have a little oled screen to display the current situation in the environment. This is used to show the current temperature, humidity, eCO2, TVOC. Next to it is also a little led matrix which will show the current sound level. \ No newline at end of file From 6688e884509f1c3429468e5a59bf91925e54da4c Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 13 Feb 2024 15:17:58 +0100 Subject: [PATCH 17/30] Added database --- server/Database.sql | 133 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) create mode 100644 server/Database.sql diff --git a/server/Database.sql b/server/Database.sql new file mode 100644 index 0000000..43311b3 --- /dev/null +++ b/server/Database.sql @@ -0,0 +1,133 @@ +-- MySQL Script generated by MySQL Workbench +-- Tue Feb 13 15:17:23 2024 +-- Model: New Model Version: 1.0 +-- MySQL Workbench Forward Engineering + +SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0; +SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0; +SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'; + +-- ----------------------------------------------------- +-- Schema NodeData +-- ----------------------------------------------------- + +-- ----------------------------------------------------- +-- Schema NodeData +-- ----------------------------------------------------- +CREATE SCHEMA IF NOT EXISTS `NodeData` DEFAULT CHARACTER SET utf8 ; +USE `NodeData` ; + +-- ----------------------------------------------------- +-- Table `NodeData`.`enqueteAnswer` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `NodeData`.`enqueteAnswer` ( + `AnswerID` INT NOT NULL, + `NodeID` INT NOT NULL, + `Result` VARCHAR(45) NULL, + `enqueteDatacol` VARCHAR(45) NULL, + `enqueteAnswerscol` VARCHAR(45) NULL, + `Question_QuestionID` INT NOT NULL, + PRIMARY KEY (`AnswerID`, `Question_QuestionID`)) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `NodeData`.`Question` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `NodeData`.`Question` ( + `QuestionID` INT NOT NULL, + `Question` VARCHAR(45) NULL, + PRIMARY KEY (`QuestionID`)) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `NodeData`.`Node` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `NodeData`.`Node` ( + `NodeID` INT NOT NULL, + `Name` VARCHAR(45) NULL, + `Location` VARCHAR(45) NULL, + PRIMARY KEY (`NodeID`)) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `NodeData`.`Measurement` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `NodeData`.`Measurement` ( + `NodeID` INT NOT NULL, + `Type` VARCHAR(45) NULL, + `Value` FLOAT NULL, + `TimeStamp` DATETIME NULL DEFAULT CURRENT_TIMESTAMP, + `Node_NodeID` INT NOT NULL, + PRIMARY KEY (`NodeID`, `Node_NodeID`), + INDEX `fk_Measurement_Node1_idx` (`Node_NodeID` ASC) VISIBLE, + CONSTRAINT `fk_Measurement_Node1` + FOREIGN KEY (`Node_NodeID`) + REFERENCES `NodeData`.`Node` (`NodeID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `NodeData`.`Enquete` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `NodeData`.`Enquete` ( + `EnqueteID` INT NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`EnqueteID`)) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `NodeData`.`enqueteQuestion` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `NodeData`.`enqueteQuestion` ( + `Enquete_EnqueteID` INT NOT NULL, + `Question_QuestionID` INT NOT NULL, + PRIMARY KEY (`Enquete_EnqueteID`, `Question_QuestionID`), + INDEX `fk_Enquete_has_Question_Question1_idx` (`Question_QuestionID` ASC) VISIBLE, + INDEX `fk_Enquete_has_Question_Enquete1_idx` (`Enquete_EnqueteID` ASC) VISIBLE, + CONSTRAINT `fk_Enquete_has_Question_Enquete1` + FOREIGN KEY (`Enquete_EnqueteID`) + REFERENCES `NodeData`.`Enquete` (`EnqueteID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_Enquete_has_Question_Question1` + FOREIGN KEY (`Question_QuestionID`) + REFERENCES `NodeData`.`Question` (`QuestionID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +-- ----------------------------------------------------- +-- Table `NodeData`.`Reply` +-- ----------------------------------------------------- +CREATE TABLE IF NOT EXISTS `NodeData`.`Reply` ( + `Node_NodeID` INT NOT NULL, + `enqueteQuestion_Enquete_EnqueteID` INT NOT NULL, + `enqueteQuestion_Question_QuestionID` INT NOT NULL, + `Result` INT NULL, + `Time` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP, + `AnswerID` INT NULL AUTO_INCREMENT, + PRIMARY KEY (`Node_NodeID`, `enqueteQuestion_Enquete_EnqueteID`, `enqueteQuestion_Question_QuestionID`), + INDEX `fk_Node_has_enqueteQuestion_enqueteQuestion1_idx` (`enqueteQuestion_Enquete_EnqueteID` ASC, `enqueteQuestion_Question_QuestionID` ASC) VISIBLE, + INDEX `fk_Node_has_enqueteQuestion_Node1_idx` (`Node_NodeID` ASC) VISIBLE, + CONSTRAINT `fk_Node_has_enqueteQuestion_Node1` + FOREIGN KEY (`Node_NodeID`) + REFERENCES `NodeData`.`Node` (`NodeID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION, + CONSTRAINT `fk_Node_has_enqueteQuestion_enqueteQuestion1` + FOREIGN KEY (`enqueteQuestion_Enquete_EnqueteID` , `enqueteQuestion_Question_QuestionID`) + REFERENCES `NodeData`.`enqueteQuestion` (`Enquete_EnqueteID` , `Question_QuestionID`) + ON DELETE NO ACTION + ON UPDATE NO ACTION) +ENGINE = InnoDB; + + +SET SQL_MODE=@OLD_SQL_MODE; +SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; +SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS; From e285cea782ff5f6da0d9b03dbf5c2c3a5b365eff Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 13 Feb 2024 15:18:06 +0100 Subject: [PATCH 18/30] Creation file --- docs/brainstorm/Questions Enquete.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 docs/brainstorm/Questions Enquete.md diff --git a/docs/brainstorm/Questions Enquete.md b/docs/brainstorm/Questions Enquete.md new file mode 100644 index 0000000..a695ce5 --- /dev/null +++ b/docs/brainstorm/Questions Enquete.md @@ -0,0 +1,5 @@ +# Questions + +How clean are the toilets (clean, normal, disgusting) +How clean is the study area (clean, normal, disgusting) +What do you think of the temparature in the study area (hot, perfect, cold) From 3e112a8e783694766323e8b9d102471cc4b53a4b Mon Sep 17 00:00:00 2001 From: Dano van den Bosch Date: Tue, 13 Feb 2024 15:46:09 +0100 Subject: [PATCH 19/30] Added raspberry py documentation --- .../InfrastructuurDocumentatie/raspberryPi.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/docs/Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi.md b/docs/Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi.md index 35d3b94..21899c4 100644 --- a/docs/Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi.md +++ b/docs/Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi.md @@ -10,8 +10,14 @@ ##Introduction +The backend of this project there is a raspberry pi 3 for handeling the dev page (more on this later) and the database. The Esp nodes are going to send a api request to the dev page wich is going to make a POST request to the database. + ##Rasberry Pi +The Raspberry 3 can be descriped as a "little" computer running a quad-code 64-bit prossesor, the previus Raspberry witch is 50% slower than this one + +The Raspberry Pi 3 is equipped with a quad-core 64-bit Broadcom BCM2837 ARM Cortex-A53 SoC processor running at 1.2 GHz, making it about 50% more powerful than the Pi 2. + ###Dev Page ##Database From 41b159f6c5fb261fb9e22ed7c62afb321389ea17 Mon Sep 17 00:00:00 2001 From: Sietse Jonker Date: Tue, 13 Feb 2024 16:21:06 +0100 Subject: [PATCH 20/30] adds documentation on how to install mariadb on rpi --- .../rpi-documentation/mariadb-installation.md | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 docs/rpi-documentation/mariadb-installation.md diff --git a/docs/rpi-documentation/mariadb-installation.md b/docs/rpi-documentation/mariadb-installation.md new file mode 100644 index 0000000..85f2e0a --- /dev/null +++ b/docs/rpi-documentation/mariadb-installation.md @@ -0,0 +1,37 @@ +# Mariadb + +First we have to install the package. This is done by running the following command: + +```bash +$ sudo apt install mariadb-server +``` + +Now the raspberry pi will download the package and install it. After the installation is done, we have to secure the installation. This is done by running the following command: + +```bash +$ sudo mysql_secure_installation +``` + +This will ask you a couple of questions. The first question is if you want to set a password for the root user. We chose not to because we are the only ones that have access to the raspberry pi. The second question is if you want to remove the anonymous user. We chose to remove the anonymous user. The third question is if you want to disallow root login remotely. We chose NOT to disallow root login remotely, otherwise we wouldn't be able to login to the database remotely anymore. The fourth question is if you want to remove the test database. We chose yes because we made our own database. The fifth question is if you want to reload the privilege tables now. We chose yes, because we want to apply the changes we made. + +Now the installation is done and the database is secured. Now we can start using the database. + +# Create a database + +First we have to login to the database. This is done by running the following command: + +```bash +$ sudo mysql -u root +``` + +Now we are logged in to the database. We have created our database by using the forward engineer function of MySQL workbench and then exporting the sql file to the raspberry pi. + +# Create a user + +We have to create a user for the database. This is done by running the following command: + +```sql +GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION; +``` + +Replace username with the username you want to use and password with the password you want to use. This will create a user with all privileges on all databases. If you want to create a user with less privileges you can change the ALL PRIVILEGES to the privileges you want to give the user. We chose to give the user all privileges to make it easy for us to use the database. \ No newline at end of file From 25bb4d0f7b766682e623bc637ad5de8bfcfffa15 Mon Sep 17 00:00:00 2001 From: Sietse Jonker Date: Tue, 13 Feb 2024 16:21:25 +0100 Subject: [PATCH 21/30] adds documentation on how to install phpmyadmin on rpi --- .../phpmyadmin-installation.md | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 docs/rpi-documentation/phpmyadmin-installation.md diff --git a/docs/rpi-documentation/phpmyadmin-installation.md b/docs/rpi-documentation/phpmyadmin-installation.md new file mode 100644 index 0000000..6a5e073 --- /dev/null +++ b/docs/rpi-documentation/phpmyadmin-installation.md @@ -0,0 +1,20 @@ +# PHPMyAdmin + +## Installation + +```bash +$ sudo apt install phpmyadmin +``` + +The raspberry pi will download the package and install it. It will also ask a few questions. For the first question we selected the “apache2” option by pressing SPACE and then ENTER. Then it will ask us to configure the database using dbconfig-common, we selected “yes” and then pressed ENTER. Then it will ask us for the password of the root user of the database, we entered the password and then pressed ENTER. Then it will ask us to enter a password for the phpmyadmin application, we entered the password and then pressed ENTER. Then it will ask us to confirm the password, we entered the password again and then pressed ENTER. After this the installation is done and we can start using phpmyadmin. + +## Usage + +To use phpmyadmin we have to go to the following url in our browser: http://(ip adress of your pi)/phpmyadmin. This will open the phpmyadmin login page. We can login using the root user and the password we entered during the installation. After we have logged in we can start using the database. + +This didnt work for us, we first had to run this command on hte raspberry pi: +```bash +$ sudo apt install php +``` + +After this we could use phpmyadmin, access the database we've created and start using it. From 4cc7c2fa8b1f57b82efbd5fa29e8322fc68df957 Mon Sep 17 00:00:00 2001 From: Sietse Jonker Date: Tue, 13 Feb 2024 16:24:02 +0100 Subject: [PATCH 22/30] Add node power information and author details --- docs/node-documentation/node-sensors.md | 6 +++++- docs/rpi-documentation/mariadb-installation.md | 4 +++- docs/rpi-documentation/phpmyadmin-installation.md | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/node-documentation/node-sensors.md b/docs/node-documentation/node-sensors.md index df55b5b..f654fa3 100644 --- a/docs/node-documentation/node-sensors.md +++ b/docs/node-documentation/node-sensors.md @@ -19,4 +19,8 @@ We chose these sensors because they are cheap to buy and don't require a lot of ## Appearance of the nodes -Every node has the sensors listed above. The also have a little oled screen to display the current situation in the environment. This is used to show the current temperature, humidity, eCO2, TVOC. Next to it is also a little led matrix which will show the current sound level. \ No newline at end of file +Every node has the sensors listed above. The also have a little oled screen to display the current situation in the environment. This is used to show the current temperature, humidity, eCO2, TVOC. Next to it is also a little led matrix which will show the current sound level. + +## Power + +The nodes are powered by 2 lithium batteries. They will be removable to charge them. We might consider using double A batteries, but we are not sure yet, since lithium batteries are more powerful, last longer and AA batteries are not rechargeable, and we want to make the nodes as sustainable as possible. \ No newline at end of file diff --git a/docs/rpi-documentation/mariadb-installation.md b/docs/rpi-documentation/mariadb-installation.md index 85f2e0a..b561b6b 100644 --- a/docs/rpi-documentation/mariadb-installation.md +++ b/docs/rpi-documentation/mariadb-installation.md @@ -34,4 +34,6 @@ We have to create a user for the database. This is done by running the following GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION; ``` -Replace username with the username you want to use and password with the password you want to use. This will create a user with all privileges on all databases. If you want to create a user with less privileges you can change the ALL PRIVILEGES to the privileges you want to give the user. We chose to give the user all privileges to make it easy for us to use the database. \ No newline at end of file +Replace username with the username you want to use and password with the password you want to use. This will create a user with all privileges on all databases. If you want to create a user with less privileges you can change the ALL PRIVILEGES to the privileges you want to give the user. We chose to give the user all privileges to make it easy for us to use the database. + +**Written by Sietse** \ No newline at end of file diff --git a/docs/rpi-documentation/phpmyadmin-installation.md b/docs/rpi-documentation/phpmyadmin-installation.md index 6a5e073..0b4d7ae 100644 --- a/docs/rpi-documentation/phpmyadmin-installation.md +++ b/docs/rpi-documentation/phpmyadmin-installation.md @@ -18,3 +18,5 @@ $ sudo apt install php ``` After this we could use phpmyadmin, access the database we've created and start using it. + +**Written by Sietse** \ No newline at end of file From eb64ad653b9c1e5e0ff299adfa4fcdad3033a54f Mon Sep 17 00:00:00 2001 From: Sietse Jonker Date: Tue, 13 Feb 2024 16:26:08 +0100 Subject: [PATCH 23/30] adds websocket docu to rpi docu --- docs/rpi-documentation/websockets.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 docs/rpi-documentation/websockets.md diff --git a/docs/rpi-documentation/websockets.md b/docs/rpi-documentation/websockets.md new file mode 100644 index 0000000..ff80e29 --- /dev/null +++ b/docs/rpi-documentation/websockets.md @@ -0,0 +1,3 @@ +# Websockets + +## Introduction \ No newline at end of file From c52da69a529d2755cbf929d12c69c4faeef227e5 Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 13 Feb 2024 16:26:54 +0100 Subject: [PATCH 24/30] Start websocket --- server/Websocket.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 server/Websocket.py diff --git a/server/Websocket.py b/server/Websocket.py new file mode 100644 index 0000000..407038c --- /dev/null +++ b/server/Websocket.py @@ -0,0 +1,21 @@ +import websockets; +import asyncio; + + +async def handler(websocket): + while True: + #Save the incoming message in variable message. + message = await websocket.recv() + print(message) + + +async def main(): + async with websockets.serve(handler, "145.92.8.114" , 8001): + await asyncio.Future() # run forever + + +if __name__ == "__main__": + asyncio.run(main()) + + +#https://websockets.readthedocs.io/en/stable/reference/sync/server.html#websockets.sync.server.serve \ No newline at end of file From 90b540e519c8b704d9dc6db5afff49ab519a4428 Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 13 Feb 2024 16:33:34 +0100 Subject: [PATCH 25/30] Start websockets documentation --- docs/rpi-documentation/websockets.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/rpi-documentation/websockets.md b/docs/rpi-documentation/websockets.md index ff80e29..c5a612e 100644 --- a/docs/rpi-documentation/websockets.md +++ b/docs/rpi-documentation/websockets.md @@ -1,3 +1,14 @@ # Websockets -## Introduction \ No newline at end of file +## Introduction +### Why are we going to use websockets? +With websockets you can establish a connection between the client and the server, and both can send data fast to each other. This is useful for real-time applications like for our project to plot live graphs of the data we are collecting from the sensors. + +### How to use websockets +There are different languages to serve websockets with, but we are going to use Python with the library `websockets`. This library is easy to use and has a lot of documentation. + + + + +#### Sources: +* https://websockets.readthedocs.io/en/stable/index.html \ No newline at end of file From 401710cbf4eaf4c4c1d9d9bbfdbffe2ed0fc0569 Mon Sep 17 00:00:00 2001 From: Sietse Jonker Date: Tue, 13 Feb 2024 16:36:35 +0100 Subject: [PATCH 26/30] Add Arduino and RPi documentation --- docs/.pages | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/docs/.pages b/docs/.pages index e16c25a..f1f1108 100644 --- a/docs/.pages +++ b/docs/.pages @@ -7,8 +7,15 @@ nav: - User Stories: opdracht/user_stories - Links: opdracht/links - 📚 Documentatie: + + - 🎮 Arduino documentation: - I2C: arduino-documentation/i2c-ESP32 - - 🍓 Raspberry Pi: Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi + + - 🍓 RPi Documentation: + - Raspberry pi: Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi + - MariaDB: rpi-documentation/mariadb-installation + - phpMyAdmin: rpi-documentation/phpmyadmin-installation + - Websockets: rpi-documentation/websockets - 🧠 Brainstorm: - Ideeën: brainstorm/ideeën - Database design: brainstorm/Database From 21a6a9095738893bbf152036b0f576631c4bddf7 Mon Sep 17 00:00:00 2001 From: Sietse Jonker Date: Tue, 13 Feb 2024 16:37:15 +0100 Subject: [PATCH 27/30] cleans up code --- docs/.pages | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/.pages b/docs/.pages index f1f1108..34dcb28 100644 --- a/docs/.pages +++ b/docs/.pages @@ -7,10 +7,8 @@ nav: - User Stories: opdracht/user_stories - Links: opdracht/links - 📚 Documentatie: - - 🎮 Arduino documentation: - I2C: arduino-documentation/i2c-ESP32 - - 🍓 RPi Documentation: - Raspberry pi: Sp1SchetsProject/InfrastructuurDocumentatie/raspberryPi - MariaDB: rpi-documentation/mariadb-installation From d73690f7b27b1f8ad8e7944c4d70b2a48e463bcd Mon Sep 17 00:00:00 2001 From: Sietse Jonker Date: Tue, 13 Feb 2024 16:38:51 +0100 Subject: [PATCH 28/30] Remove empty documentation section --- docs/.pages | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/.pages b/docs/.pages index 34dcb28..48dcba5 100644 --- a/docs/.pages +++ b/docs/.pages @@ -6,7 +6,6 @@ nav: - Criteria: opdracht/criteria - User Stories: opdracht/user_stories - Links: opdracht/links - - 📚 Documentatie: - 🎮 Arduino documentation: - I2C: arduino-documentation/i2c-ESP32 - 🍓 RPi Documentation: From a6696b36dfcb7845b06d53af4e7a1dff7067ce26 Mon Sep 17 00:00:00 2001 From: sam Date: Tue, 13 Feb 2024 16:38:55 +0100 Subject: [PATCH 29/30] Added problem and solution --- docs/brainstorm/Problem.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 docs/brainstorm/Problem.md diff --git a/docs/brainstorm/Problem.md b/docs/brainstorm/Problem.md new file mode 100644 index 0000000..8251ac2 --- /dev/null +++ b/docs/brainstorm/Problem.md @@ -0,0 +1,7 @@ +# The problem + +The problem we are facing with the study area is having to walk around a lot to find a place to study. Which costs lots of valuable time to work on your project. + + +## The solution +Thats why we are going to make a system that can show how loud it is in the study area, so you have a better chance of walking to a spot where you can sit and work in peace. There are going to be 3 nodes in different study areas that are going to measure the sound level. These nodes are going to send the data to a server, which is going to process the data and send it to the main node that is located at the coffee machine. This node is going to show the data on a display. \ No newline at end of file From 8722f8908754b2a97d7e54ff72dc7018db612133 Mon Sep 17 00:00:00 2001 From: sietse jonker Date: Tue, 13 Feb 2024 22:31:16 +0100 Subject: [PATCH 30/30] Update MariaDB user in installation documentation --- docs/rpi-documentation/mariadb-installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/rpi-documentation/mariadb-installation.md b/docs/rpi-documentation/mariadb-installation.md index b561b6b..9b4a303 100644 --- a/docs/rpi-documentation/mariadb-installation.md +++ b/docs/rpi-documentation/mariadb-installation.md @@ -31,7 +31,7 @@ Now we are logged in to the database. We have created our database by using the We have to create a user for the database. This is done by running the following command: ```sql -GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION; ``` Replace username with the username you want to use and password with the password you want to use. This will create a user with all privileges on all databases. If you want to create a user with less privileges you can change the ALL PRIVILEGES to the privileges you want to give the user. We chose to give the user all privileges to make it easy for us to use the database.