diff --git a/README.md b/README.md index 46a577c..0d77014 100644 --- a/README.md +++ b/README.md @@ -10,94 +10,46 @@ This project implements a real-time temperature and humidity monitoring system u ## 🧠 System Architecture -The system is designed using a **layered architecture**, where each component has a specific responsibility. This separation improves maintainability and clarity. +The system is structured as a simple data pipeline that connects the sensor, processing logic, and web interface. Data flows continuously from the physical environment to the user in a clear and modular way. --- -### πŸ”Ή 1. Hardware Layer (Sensor) +### πŸ”Ή Hardware and Communication Layer -The **HTU21D sensor** measures temperature and humidity and communicates using the **I2C protocol**. - -* The Raspberry Pi acts as the **master** -* The sensor acts as the **slave** -* Data is transmitted over SDA (data) and SCL (clock) - ---- - -### πŸ”Ή 2. Data Acquisition Layer (C Program) - -A program written in C interacts directly with the I2C interface: - -* Opens the I2C device (`/dev/i2c-1`) -* Sends commands to the sensor -* Reads raw data -* Converts it into human-readable values (Β°C and %) - -πŸ‘‰ Output is formatted as a JSON file: - -```json -{ "temperature": 23.9, "humidity": 57.4 } -``` +The HTU21D sensor measures temperature and humidity and communicates with the Raspberry Pi using the I2C protocol. This allows the Raspberry Pi to request and receive raw data from the sensor. --- -### πŸ”Ή 3. Data Persistence Layer (JSON File) - -The JSON file acts as an **intermediate data layer**: +### πŸ”Ή Data Processing Layer -* Stores the latest sensor reading -* Decouples backend (C) from frontend (JavaScript) -* Enables simple data exchange without a database +A C program interacts with the I2C interface to read the sensor data. It converts the raw binary values into human-readable units such as degrees Celsius and percentage humidity, and formats the result as JSON. --- -### πŸ”Ή 4. Web Server Layer (Nginx) - -Nginx serves static files: - -* HTML (interface) -* JavaScript (logic) -* JSON (sensor data) +### πŸ”Ή Data Storage Layer -πŸ‘‰ It acts as the **bridge between the system and the user’s browser** +The JSON file stores the latest sensor readings. It acts as an intermediate layer, separating the data acquisition process from the web interface. --- -### πŸ”Ή 5. Presentation Layer (Frontend) +### πŸ”Ή Web Server Layer -The browser executes JavaScript: - -* Uses `fetch()` to request the JSON file -* Updates the DOM dynamically -* Displays values in real time +Nginx serves the JSON file and the web page over HTTP. It allows other devices on the network to access the system through a browser. --- -### πŸ”„ Data Flow Summary +### πŸ”Ή Presentation Layer -```text -Sensor β†’ I2C β†’ C Program β†’ JSON β†’ Nginx β†’ Browser β†’ User Interface -``` +The web page uses JavaScript to periodically request the JSON file and update the displayed values dynamically, enabling near real-time visualization. --- -### 🧠 Key Design Decisions +### πŸ”„ Overall Flow -* **Use of JSON:** lightweight and easy to parse -* **Polling (setInterval):** simple real-time updates -* **Separation of layers:** avoids tight coupling between components +Data is captured by the sensor, processed by the C program, stored as JSON, served by Nginx, and displayed in the browser. This structure keeps the system simple, modular, and easy to maintain. --- -### βš™οΈ Why This Architecture Works - -* Modular β†’ each part can be modified independently -* Scalable β†’ can add database or APIs later -* Simple β†’ ideal for embedded + web integration - ---- - ---- ## 🧰 Materials @@ -126,8 +78,7 @@ Sensor β†’ I2C β†’ C Program β†’ JSON β†’ Nginx β†’ Browser β†’ User Interface Include these images in your repository: -![Esquema de conexiones para la Raspberry Pi 4](RaspberryPi4_PinMap.jpg) -![DistribuciΓ³n de pines del sensor HTU21D](TZCBIN8qL-HTU21D-Module-Pinout.png) +![Esquema de conexiones para la Raspberry Pi 4 y Sensor HTU21D](RaspberryPi4_Sensor_PinMap.jpg) --- @@ -144,26 +95,26 @@ Include these images in your repository: ## πŸš€ Deployment Guide (From Scratch) -### πŸ“₯ 1. Clone the Repository +### 🧰 1. Install Dependencies ```bash -git clone http:////.git -# Downloads the project from the server +sudo apt update +# Updates package list -cd -# Enters the project folder +sudo apt install gcc i2c-tools libi2c-dev nginx git +# Installs compiler, I2C tools, web server, and Git ``` --- -### 🧰 2. Install Dependencies +### πŸ“₯ 2. Clone the Repository ```bash -sudo apt update -# Updates package list +git clone https://gitea.itmorelia.com/Verano-Delfin-2026/Temperature-Humidity-Sensor.git +# Downloads the project from the server -sudo apt install gcc i2c-tools libi2c-dev nginx git -# Installs compiler, I2C tools, web server, and Git +cd Temperature-Humidity-Sensor +# Enters the project folder ``` --- diff --git a/RaspberryPi4_PinMap.jpg b/RaspberryPi4_PinMap.jpg deleted file mode 100644 index 661b531..0000000 Binary files a/RaspberryPi4_PinMap.jpg and /dev/null differ diff --git a/RaspberryPi4_Sensor_PinMap.jpg b/RaspberryPi4_Sensor_PinMap.jpg new file mode 100644 index 0000000..02f1d09 Binary files /dev/null and b/RaspberryPi4_Sensor_PinMap.jpg differ diff --git a/TZCBIN8qL-HTU21D-Module-Pinout.png b/TZCBIN8qL-HTU21D-Module-Pinout.png deleted file mode 100755 index 0a839de..0000000 Binary files a/TZCBIN8qL-HTU21D-Module-Pinout.png and /dev/null differ