Differences

This shows you the differences between two versions of the page.

Link to this comparison view

pm:prj2026:bianca.popa1106:stefan.lupoi [2026/05/06 21:22]
stefan.lupoi
pm:prj2026:bianca.popa1106:stefan.lupoi [2026/05/19 21:39] (current)
stefan.lupoi
Line 20: Line 20:
  
   - **User Input (PS/2 Keyboard and Custom Driver)**   - **User Input (PS/2 Keyboard and Custom Driver)**
-    * //​Hardware://​ Signals that are coming from the keyboard (5V) go through ​a logic level converter ​to protect the ESP32 (3.3V).+    * //​Hardware://​ Signals that are coming from the keyboard (5V) go through ​resistors ​to protect the ESP32 (3.3V).
     * //​Software://​ The ISR listens to the CLK pin of the keyboard and receives the data bits at every negedge cycle. The scan codes are decoded and inserted into a buffer.     * //​Software://​ The ISR listens to the CLK pin of the keyboard and receives the data bits at every negedge cycle. The scan codes are decoded and inserted into a buffer.
   - **Data Reading (Sensors and Timers)**   - **Data Reading (Sensors and Timers)**
Line 34: Line 34:
   * **Display:​** TFT SPI 2.4 inch display module 240x320 resolution   * **Display:​** TFT SPI 2.4 inch display module 240x320 resolution
   * **Input:** Standard PS/2 keyboard and female PS/2 connector (modified extension cable)   * **Input:** Standard PS/2 keyboard and female PS/2 connector (modified extension cable)
-  * **Logic Level Converter:​** Bidirectional logic level converter - 4 channels (5V <-> 3.3V) 
   * **Non-volatile Memory:** EEPROM I2C AT24C256 (32K)   * **Non-volatile Memory:** EEPROM I2C AT24C256 (32K)
   * **Digital Sensors:** BMP180 (I2C) pressure and temperature sensor   * **Digital Sensors:** BMP180 (I2C) pressure and temperature sensor
   * **Analog Sensors:** Photoresistor (type 5528) + 10kΩ resistor (voltage divider), 10kΩ potentiometer   * **Analog Sensors:** Photoresistor (type 5528) + 10kΩ resistor (voltage divider), 10kΩ potentiometer
 +  * **Resistors**:​ 1kΩ and 10kΩ resistors
 +  * **Transistor**:​ BC547B NPN transistor ​
   * **Infrastructure:​** Breadboard and wires (female-male,​ male-male)   * **Infrastructure:​** Breadboard and wires (female-male,​ male-male)
   * **Power:** TBD   * **Power:** TBD
Line 44: Line 45:
  
 {{ :​pm:​prj2026:​bianca.popa1106:​electrical_diagram_lupoi_stefan-alexandru.png?​direct&&​800 |}} {{ :​pm:​prj2026:​bianca.popa1106:​electrical_diagram_lupoi_stefan-alexandru.png?​direct&&​800 |}}
- 
-<note tip> 
-Aici puneţi tot ce ţine de hardware design: 
-  * listă de piese 
-  * scheme electrice (se pot lua şi de pe Internet şi din datasheet-uri,​ e.g. http://​www.captain.at/​electronic-atmega16-mmc-schematic.png) 
-  * diagrame de semnal ​ 
-  * rezultatele simulării 
-</​note>​ 
  
 ===== Software Design ===== ===== Software Design =====
  
 +**IDE:**
 +  * **PlatformIO** (typically used as an extension within Visual Studio Code). The build environment is configured via ''​platformio.ini''​ utilizing the Arduino framework for the ESP32 (''​espressif32''​ platform).
  
-<note tip> +**Libraries and 3rd Party Resources:​** 
-Descrierea codului aplicaţiei ​(firmware): +  * **TFT_eSPI ​(by Bodmer, v2.5.43):** A high-performance,​ hardware-accelerated graphics library specifically configured for driving the ST7789 TFT display over high-speed SPI. 
-  * mediu de dezvoltare ​(if any) (e.gAVR StudioCodeVisionAVR+  * **LVGL ​(Light and Versatile Graphics Library, v9.1.0):** The core UI framework powering the graphical elements, including the interactive menus, the terminal overlay, and the real-time data charting system. 
-  * librării şi surse 3rd-party ​(e.gProcyon AVRlib+  * **Adafruit BMP085 Library:** Used for interfacing with the BMP180 sensor over I2C to gather atmospheric pressure and temperature data. 
-  * algoritmi şi structuri pe care plănuiţi ​să le implementaţi +  * **EEPROM / Wire (Standard ESP32 Arduino Core):** Used for non-volatile storage of recorded data and managing I2C hardware communication,​ respectively. 
-  * (etapa 3surse şi funcţii implementate +  * //(Note: Adafruit GFX and Adafruit ST7789 libraries are included in dependencies for legacy support but superseded by TFT_eSPI/​LVGL in the active application).// 
-</note>+ 
 +**Algorithms and Data Structures Used (or Planned):​** 
 +  * **Linear Data Buffer (Struct Array):** A static array ''​data_buffer[MAX_SAMPLES]''​ consisting of custom ''​SensorSnapshot''​ structs. It stores aggregated sensor payloads (timestamppotentiometer,​ light, temperature,​ pressure). Capped at 250 samples to perfectly fit within the ESP32'​s 4KB EEPROM limit. 
 +  * **Circular Buffer ​(Ring Buffer):** Used within the custom PS/2 keyboard driver (''​_rawBuffer''​) to safely enqueue raw, asynchronous hardware scan codes triggered by GPIO interrupts without blocking the main thread. 
 +  * **State Machines:​** 
 +    * **Keyboard Decoding:** A state machine tracks modifier keys (Shift, Ctrl, Caps Lock, Extended codes) to accurately translate complex multi-byte PS/2 scan sequences into ASCII characters. 
 +    * **Application Flow Control:** An ''​AppState''​ enum (''​STATE_INITIAL'',​ ''​STATE_RUNNING'',​ ''​STATE_INSPECT''​dictates the high-level system behavior, preventing invalid actions like zooming while actively recording data. 
 +  * **Data Windowing and Mapping Algorithms:​** The graphing engine (''​update_chart_source''​) calculates visible data slices using dynamic array indexing offsets (''​pan_offset''​) and active time windows (''​scale_x_window''​). It dynamically remaps sensor data into the display'​visual space to accomplish real-time panning and zooming. 
 + 
 +**Sources and Implemented Functions:​** 
 +  * **''​main.cpp'':​** The system orchestrator. Initializes the hardware peripherals,​ bridges LVGL with the display ​(''​my_disp_flush''​and the keyboard driver (''​keypad_read_cb''​),​ maps keyboard shortcuts to system commands, and drives the main UI loop (''​lv_timer_handler''​). 
 +  * **''​graph.cpp'' ​''​graph.h'':​** Manages the LVGL charting subsystem, data acquisition,​ and EEPROM state persistence.  
 +    * //Key functions://​ ''​init_graph()'',​ ''​recording_task()'',​ ''​update_chart_source()'',​ ''​cmd_start_recording()'',​ ''​cmd_zoom()'',​ ''​cmd_pan()'',​ ''​cmd_save()'',​ ''​cmd_load()''​. 
 +  * **''​terminal.cpp''​ / ''​terminal.h'':​** Implements the graphical terminal overlay and its text parser, allowing users to type and execute commands that interface with the graphing logic.  
 +    * //Key functions://​ ''​init_terminal_ui()'',​ ''​toggle_terminal()''​. 
 +  * **''​menu.cpp''​ / ''​menu.h'':​** Controls the GUI-based settings menu for intuitive user configuration using LVGL components.  
 +    * //Key functions://​ ''​init_menu()'',​ ''​toggle_menu()''​. 
 +  * **''​ps2_keyboard.cpp''​ / ''​ps2_keyboard.h'':​** A bare-metal PS/2 keyboard driver utilizing hardware interrupts to capture user inputs.  
 +    * //Key functions://​ ''​begin()'',​ ''​read()'',​ ''​handleInterrupt()''​.
  
 ===== Rezultate Obţinute ===== ===== Rezultate Obţinute =====
Line 73: Line 86:
  
 ===== Download ===== ===== Download =====
- +  * [[https://github.com/​SaboJake/​ESP32-Data-Logger-and-Graphing-Terminal|github]]
-<note warning>​ +
-O arhivă (sau mai multe dacă este cazul) cu fişierele obţinute în urma realizării proiectuluisurse, scheme, etcUn fişier README, un ChangeLog, un script de compilare şi copiere automată pe uC crează întotdeauna o impresie bună ;-). +
- +
-Fişierele se încarcă pe wiki folosind facilitatea **Add Images or other files**. Namespace-ul în care se încarcă fişierele este de tipul **:​pm:​prj20??:​c?​** sau **:​pm:​prj20??:​c?:​nume_student** (dacă este cazul). **Exemplu:​** Dumitru Alin, 331CC -> **:​pm:​prj2009:​cc:​dumitru_alin**. +
-</​note>​+
  
 ===== Jurnal ===== ===== Jurnal =====
- +  ​* **06.05.2026:​** Added introduction,​ general description and block and electrical diagrams. 
-* **06.05.2026:​** Added introduction,​ general description and block and electrical diagrams. +  * **19.05.2026:​** Added firmware, bibliography and resources. Updated electrical diagram and block diagram.
- +
-<note tip> +
-Puteți avea și o secțiune de jurnal în care să poată urmări asistentul de proiect progresul proiectului. +
-</​note>​+
  
 ===== Bibliografie/​Resurse ===== ===== Bibliografie/​Resurse =====
- +  * [[https://​documentation.espressif.com/​esp32-wroom-32d_esp32-wroom-32u_datasheet_en.pdf|Data sheet ESP32-WROOM-32D]] 
-<​note>​ +  * [[https://​ww1.microchip.com/​downloads/​en/​DeviceDoc/​doc0006.pdf|Data sheet AT24C256]] 
-Listă cu documente, datasheet-uri,​ resurse Internet folosite, eventual grupate pe **Resurse Software** şi **Resurse Hardware**. +  [[https://​cdn-shop.adafruit.com/​datasheets/​BST-BMP180-DS000-09.pdf|Data sheet BMP180]] 
-</note>+  * [[https://​wiki.osdev.org/​PS/​2_Keyboard|Data sheet PS/2 keyboard]]
  
 <​html><​a class="​media mediafile mf_pdf"​ href="?​do=export_pdf">​Export to PDF</​a></​html>​ <​html><​a class="​media mediafile mf_pdf"​ href="?​do=export_pdf">​Export to PDF</​a></​html>​
  
  
pm/prj2026/bianca.popa1106/stefan.lupoi.1778091770.txt.gz · Last modified: 2026/05/06 21:22 by stefan.lupoi
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0