Differences

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

Link to this comparison view

pm:prj2025:iotelea:alexa_andreea.voicu [2025/05/25 23:50]
alexa_andreea.voicu [Component list]
pm:prj2025:iotelea:alexa_andreea.voicu [2025/05/26 21:44] (current)
alexa_andreea.voicu [Software Design]
Line 41: Line 41:
 The LCD display shows live values of temperature and humidity and the alerts for the user, while LEDs indicate status: The LCD display shows live values of temperature and humidity and the alerts for the user, while LEDs indicate status:
  
-Green = optimal 
  
-Yellow = warning +  * Green = optimal 
- +  * Yellow = warning 
-Red = out of range+  ​* ​Red = out of range
  
 The buzzer notifies the user when human intervention is needed. The buzzer notifies the user when human intervention is needed.
Line 66: Line 65:
   * 12V battery   * 12V battery
   * IRF520 Module   * IRF520 Module
 +
 +
 +==== How the components are connected ====
 +
 +1. DHT22 Sensor
 +
 +  * Out pin on D2
 +  * VCC on 5V
 +  * GND on GND
 +
 +2. LCD 1602 Display
 +
 +  * SDA on A4
 +  * SCL on A5
 +  * VCC on 5V
 +  * GND on GND
 +
 +3. MicroSD module:
 +
 +  * CS (Chip Select) on D4
 +  * MOSI: D11
 +  * MISO: D12
 +  * SCK (Clock) on D13
 +  * VCC on 5V
 +  * GND on GND
 +
 +4. 12V Fan and IRF520:
 +
 +  * IRF520 SIG on D8
 +  * IRF520 GND on GND
 +  * IRF520 VIN and GND on + and - from the battery
 +  * IRF520 V+ and V- on + and - from the fan
 +
 +5. Passive Buzzer:
 +
 +  * Signal on D7
 +  * GND on GND
 +
 +6. LEDs (Red, Yellow, Green) ​
 +
 +  * Red: D9
 +  * Yellow: D10
 +  * Green: D6
  
  
Line 81: Line 123:
 ===== Software Design ===== ===== Software Design =====
  
-The Arduino sketch uses the following ​libraries:+=== Libraries === 
 +The program was developed using the Arduino IDE, and relies on several key libraries ​for sensor communication,​ display control, data logging, and peripheral management:
  
-DHT sensor ​library+DHT.h – for reading temperature and humidity values from the DHT22 sensor
  
-Adafruit SSD1306 (for OLED)+Wire.h & LiquidCrystal_I2C.h – for controlling the I2C 1602 LCD display
  
-SD library+SD.h – for writing environmental data to the microSD card
  
-Wire (I2C communication)+tone() – native Arduino function used to control the passive buzzer with PWM audio signals
  
-Functional logic: 
  
-Read DHT22 values every 2 seconds+=== The flow ===
  
-Log data to SD every 60 seconds+In each cycle it performs the following tasks:
  
-Compare values against threshold:+Read data from the DHT22 sensor
  
-If temp < 37°C → turn ON heat+Evaluate both temperature and humidity and assign status flags:
  
-If humidity < 50% → turn ON humidifier+0 = optimal (green)
  
-If values are too low/high → buzzer + red LED+1 = medium (yellow)
  
-If values are optimal → green LED+2 = critical (red)
  
 +Determine the worst case (maximum of the two flags) to define the overall system status
  
-===== Probleme întâmpinate =====+Temperature and humidity evaluation:
  
 +If temperature or humidity drops below/above certain thresholds, the corresponding flag is set to red (2).
 +If values are within an acceptable but not ideal range, yellow (1) is assigned.
 +Ideal values result in green (0).
 +The worst of the two flags determines the LED status and whether a buzzer or fan should be activated and displays the message accordingly.
  
 +The buzzer is passive, meaning it needs a signal with a defined frequency.
 +It only activates when the system transitions into the red alert state
 +It emits three tones with decreasing frequency (1000 Hz → 800 Hz → 600 Hz), each followed by a short pause.
 +Total alert duration is approx. 2 seconds.
 +The tone is played using Arduino’s tone() function and not repeated unless a new red alert is triggered.
  
 +The fan is connected via an IRF520 module and is triggered only if the temperature exceeds 27°C.
 +It automatically shuts off once the temperature returns to the safe range.
 +
 +The I2C LCD shows:
 +Alerts, "​Low/​High temperature!",​ "​Low/​High humidity!"​ when entering critical states
 +Live readings, Temp: ... C, Hum: ..% when values are stable
 +Logging confirmation,​ "​Logging data..."​ when writing to SD
 +Priority is given to alert messages, which override live readings for 2 seconds
 +
 +===== Rezultate obținute =====
 +The project was successfully implemented and tested and all major functionalities work as intended.
 +Demo:
 +
 +[[https://​www.youtube.com/​shorts/​_8tk-wFxubc|Smart Egg Incubator]]
 ===== Concluzii ===== ===== Concluzii =====
  
 +While my project wasn’t very complex, it gave me the opportunity to integrate multiple hardware components and manage real-time system logic. The availability of the libraries for the DHT22 sensor, LCD, and SD card modules helped me a lot with my work, allowing me to focus more on logic and the incubator'​s behavior.
  
-===== Resurse =====+The biggest challenge was controlling the fan. I initially underestimated the current it needed, and quickly realized that driving it directly from a digital pin was not possible. So I needed to used a 12V battery, but wasn't sure how i would actually connect it so that it would work without any risks. After some research, I added an IRF520 Mosfet module, and thinking now, a flyback diode would have been a great addition to protect against voltage spikes when switching off the fan.
  
 +Another issue was that I didn't know what the timing conflicts would be between SD card access and LCD updates. At one point, I 
 +was trying to write to the SD card while displaying messages caused flickering and delays. I had to be careful about when and how often updates happened, and add short delays to give each module time to operate without interfering.
 +
 +Overall, the project helped me learn how to integrate sensors, fans and storage, and how to troubleshoot the small issues that appear only when everything is running at the same time.
 +===== Resurse =====
  
 +  * [[https://​www.arduino.cc/​reference/​en/​|Arduino Official Documentation]] – language reference and built-in functions
 +  * [[https://​github.com/​adafruit/​DHT-sensor-library|DHT Sensor Library by Adafruit]] – for reading temperature and humidity values
 +  * [[https://​github.com/​johnrickman/​LiquidCrystal_I2C|LiquidCrystal I2C Library]] – used to control the 1602 I2C LCD display
 +  * [[https://​www.arduino.cc/​en/​Reference/​SD|Arduino SD Library]] – for reading/​writing data to the microSD card
 +  * [[https://​www.arduino.cc/​reference/​en/​language/​functions/​advanced-io/​tone/​|tone() – Arduino Function]] – used to generate PWM audio signals for passive buzzers
 +  * [[https://​cdn-shop.adafruit.com/​datasheets/​Digital+humidity+and+temperature+sensor+AM2302.pdf|DHT22 Datasheet]] – for technical specifications of the sensor
 +  * [[https://​www.youtube.com/​watch?​v=17vqLv508Uw|Using IRF520 Mosfet]] – for connection to the fan
pm/prj2025/iotelea/alexa_andreea.voicu.1748206222.txt.gz · Last modified: 2025/05/25 23:50 by alexa_andreea.voicu
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