Differences

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

Link to this comparison view

pm:prj2026:florin.stancu:alexandra.zahiu [2026/05/08 20:02]
alexandra.zahiu
pm:prj2026:florin.stancu:alexandra.zahiu [2026/05/23 11:57] (current)
alexandra.zahiu
Line 25: Line 25:
  
 ===== Hardware Design ===== ===== Hardware Design =====
 +
 +Electrical Scheme (done in Wokwi)
 {{:​pm:​prj2026:​florin.stancu:​screenshot_2026-05-08_at_19.45.37.png?​300|}} {{:​pm:​prj2026:​florin.stancu:​screenshot_2026-05-08_at_19.45.37.png?​300|}}
 <note tip> <note tip>
Line 31: Line 33:
   * Microcontroller:​ Arduino-UNO board. ​   * Microcontroller:​ Arduino-UNO board. ​
   * Climate Sensor: DHT11 for temperature and humidity tracking. ​   * Climate Sensor: DHT11 for temperature and humidity tracking. ​
-  * Unordered List ItemAir ​Quality Sensor: MQ8 for gas and CO2 detection.  +  * Air Quality Sensor: MQ8 for gas and CO2 detection.  
-  * Unordered List ItemProximity ​Sensor: HC-SR04 Ultrasonic sensor to detect user presence/​absence and how close the user is sitting to their computer.  +  * Proximity ​Sensor: HC-SR04 Ultrasonic sensor to detect user presence/​absence and how close the user is sitting to their computer.  
-  * Unordered List ItemActuator: SG90 Servomotor for physical intervention.  +  * Actuator: SG90 Servomotor for physical intervention.  
-  * Unordered List ItemDisplay: LCD 1602 with I2C interface for status updates. ​+  * Display: LCD 1602 with I2C interface for status updates. ​
   * Connectivity:​ USB cable. ​   * Connectivity:​ USB cable. ​
  
 </​note>​ </​note>​
 +
 +==== Proposed pinout ​ ====
 +
 +**Arduino UNO:**
 +^ Component ​       ^ Arduino Pins                                                  ^
 +| DHT11            | DATA -> D7 (PD7), VCC -> 5V, GND -> GND                        |
 +| HC-SR04 ​         | TRIG -> D9 (PB1), ECHO -> D8 (PB0), VCC -> 5V, GND -> GND      |
 +| MQ-8 Gas Sensor ​ | AO -> A0 (PC0 / ADC0), VCC -> 5V, GND -> GND                   |
 +| SG90 Servo       | Signal -> D6 (PD6), VCC -> 5V, GND -> GND                      |
 +| LCD 1602 (I2C)   | SDA -> A4 (PC4), SCL -> A5 (PC5), VCC -> 5V, GND -> GND        |
 +| Buttons (x4)     | D2, D3, D4, D5 (PD2-PD5), INPUT_PULLUP,​ common pin -> GND      |                          |
 +
 +**Button mapping:**
 +  * **Button 1 (D2):** ARM / DISARM the system.
 +  * **Button 2 (D3):** Monitoring screen (temperature,​ humidity, gas, distance).
 +  * **Button 3 (D4):** Temperature min / max screen.
 +  * **Button 4 (D5):** Humidity min / max screen.
 +
 +Power Supply:
 +The project is directly linked to the Laptop, using a USB cable, making the data collection easier. All sensors are powered through 5V from the Arduino UNO.
 +
 +<note warning>
 +**Servo power note.** The SG90 draws short current spikes (hundreds of mA) when it starts moving. When the servo is powered from the Arduino 5V pin (especially over USB), these spikes cause brief voltage dips that can disturb the I2C bus and make both the LCD and the servo behave erratically. For a stable build, the servo should ideally be powered from a separate 5V source with a common ground to the Arduino, with a decoupling capacitor (470-1000 uF) close to the servo. In firmware, a short "quiet window"​ is inserted before the servo starts moving (no I2C traffic, no sensor reads) to reduce this interference.
 +
 +</​note>​
 +{{:​pm:​prj2026:​florin.stancu:​whatsapp_image_2026-05-18_at_15.29.31.jpeg?​200|}}
 +{{:​pm:​prj2026:​florin.stancu:​whatsapp_image_2026-05-18_at_15.29.31_1_.jpeg?​200|}}
 +
  
 ===== Software Design ===== ===== Software Design =====
Line 43: Line 73:
  
 <note tip> <note tip>
-Descrierea codului aplicaţiei (firmware): +**Development environment** 
-  * mediu de dezvoltare ​(if any) (e.g. AVR StudioCodeVisionAVR+  * **PlatformIO** with the Arduino framework ​(board: ''​uno''​platform: ''​atmelavr''​). 
-  * librării şi surse 3rd-party (e.g. Procyon AVRlib+  * Build flags: ''​-Os'' ​(optimize for sizeand ''​-Wall''​ (all warnings). 
-  * algoritmi şi structuri pe care plănuiţi să le implementaţi +  * Serial monitor speed: 9600 baud.
-  * (etapa 3) surse şi funcţii implementate+
 </​note>​ </​note>​
 + 
 +==== 3rd-party libraries ====
 + 
 +The firmware uses a small set of well-known Arduino libraries (declared in ''​platformio.ini''​ under ''​lib_deps''​):​
 + 
 +  * **DHT sensor library** (Adafruit) + **Adafruit Unified Sensor** - reading the DHT11 temperature and humidity.
 +  * **LiquidCrystal_I2C** (marcoschwartz) - driving the 1602 LCD over I2C.
 +  * **Servo** (arduino-libraries) - generating the control pulses for the SG90.
 + 
 +The GPIO access for the HC-SR04 and the buttons, as well as the MQ-8 ADC reads, are done **bare-metal** (direct register manipulation),​ in the PM lab style, instead of using ''​digitalRead''/''​analogRead''​.
 + 
 +**Alert thresholds:​**
 + 
 + ​Alert ​              ​Trigger ​                             When?                 ​| ​                 ​
 +| Temperature ​  | T > 28 C                            | immediate ​                |
 +| Humidity ​     | H > 65 %                            | immediate ​                |
 +| Gas           | gas > 250 ppm                       | immediate ​                |
 +| Too far       | distance > 30 cm                    | held for 10 s             |
 +| Too close     | distance < 10 cm                    | held for 30 s             |
 + 
 +For the distance alerts, a generic **temporal timer** requires the condition to hold continuously for the configured duration before the alert fires; an ultrasonic timeout reading is treated as "very far" (nobody at the desk) so that walking away is detected reliably.
 +
  
 ===== Rezultate Obţinute ===== ===== Rezultate Obţinute =====
Line 56: Line 107:
 </​note>​ </​note>​
  
-===== Concluzii ​=====+===== Conclusions ​===== 
 + 
 +Vital Desk meets its original goal: a stand-alone health assistant that monitors the work environment and intervenes physically and visually when something is off, without depending on a host PC for its logic. 
 +The most useful lessons from the project were on the debugging side rather than the feature side. The servo jitter was instructive:​ it showed clearly where the boundary between a software fix and a hardware fix lies. Spacing out the I2C traffic and the servo activity in firmware reduced the symptom, but the residual jitter is a current/​power problem that software cannot fully solve. 
 +  
 +If the project were continued, the natural next steps would be: a dedicated 5V supply for the servo to eliminate the remaining jitter, replacing the ''​_delay_ms''​-based tick with a hardware timer so the 10 s / 30 s timers are exact.  
  
 ===== Download ===== ===== Download =====
pm/prj2026/florin.stancu/alexandra.zahiu.1778259766.txt.gz · Last modified: 2026/05/08 20:02 by alexandra.zahiu
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