Add node documentation and wiring diagram
This commit is contained in:
BIN
docs/assets/imagesSp3/wiringDiagramNode.png
Normal file
BIN
docs/assets/imagesSp3/wiringDiagramNode.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 130 KiB |
64
docs/node-documentation/node.md
Normal file
64
docs/node-documentation/node.md
Normal file
@@ -0,0 +1,64 @@
|
||||
# Node
|
||||
|
||||
Since the node is what gathers all the data from the sensors, it is the most important part of the system. The node is responsible for reading the data from the sensors, processing it, and sending it to the server.
|
||||
|
||||
## Hardware
|
||||
|
||||
The node is composed of the following hardware components:
|
||||
|
||||
- [ESP32 S3 DevkitC](https://www.espressif.com/en/products/socs/esp32-s3)
|
||||
- [SGP30](https://www.sensirion.com/en/environmental-sensors/gas-sensors/sgp30/)
|
||||
- [DHT11](https://www.sparkfun.com/datasheets/Sensors/Temperature/DHT11.pdf)
|
||||
- [OLED Display](https://www.tinytronics.nl/nl/displays/oled/1.3-inch-oled-display-128*64-pixels-wit-i2c)
|
||||
|
||||
## Software
|
||||
|
||||
The node is programmed using the Arduino IDE. The code is written in C++ and is responsible for reading the data from the sensors, processing it, and sending it to the server. The first couple versions of the code were written by Sietse, and because we all had to use Object Oriented Programming, Dano rewrote the code to be object-oriented. Which is now final version
|
||||
|
||||
### Libraries
|
||||
|
||||
The following libraries are used in the node code:
|
||||
|
||||
- <Wire.h>
|
||||
- <Adafruit_SH110X.h
|
||||
- <Adafruit_SGP30.h>
|
||||
- <DHT.h>
|
||||
- <WiFiMulti.h>
|
||||
- <WiFi.h>
|
||||
- <WebSocketsClient.
|
||||
- <nodeCodeHeader.h>
|
||||
|
||||
### Code
|
||||
|
||||
The code is divided into the following classes:
|
||||
|
||||
uitleg dano
|
||||
|
||||
### Communication
|
||||
|
||||
The node communicates with the server using WebSockets. The node sends the data to our website which uses a reverse proxy to route it to the websocket. The server then processes the data and stores it in the database / puts it on the website. We use the WebSocketsClient library to communicate with the server. Because [websocket connections](docs\rpi-documentation\websockets.md) are stateful, we need to keep the connection alive. So we do not use any delays in the code, but instead use the millis() function to keep track of time.
|
||||
|
||||
Flow of the data:
|
||||
|
||||
```mermaid
|
||||
|
||||
flowchart LR
|
||||
A(Sensors)
|
||||
B(Node)
|
||||
D(Websocket)
|
||||
E(Website)
|
||||
F(DB-Client)
|
||||
G(Database)
|
||||
|
||||
A-->|sensordata| B
|
||||
B -->|JSONData| D
|
||||
D -->|JSONData| E
|
||||
D -->|JSONData| F
|
||||
F -->|Data| G
|
||||
```
|
||||
|
||||
### Wiring Diagram
|
||||
|
||||
The wiring diagram for the node is as follows:
|
||||
|
||||

|
Reference in New Issue
Block a user