Differences

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

Link to this comparison view

pm:prj2022:arosca:2312 [2022/05/27 16:21]
adrian_mihai.savu [Software:]
pm:prj2022:arosca:2312 [2022/06/02 02:33] (current)
adrian_mihai.savu [Hardware Design]
Line 11: Line 11:
 </​note>​ </​note>​
 ===== Descriere generală ===== ===== Descriere generală =====
-{{ :​pm:​prj2022:​arosca:​schema_bloc.png?​550 |}} 
- 
  
 +{{ :​pm:​prj2022:​arosca:​diagrama_savu.drawio.png?​550 |}}
 ===== Hardware Design ===== ===== Hardware Design =====
  
Line 26: Line 25:
   * Rezistente   * Rezistente
   * Circuite de diferite culori (pt GND, 5V etc.)   * Circuite de diferite culori (pt GND, 5V etc.)
 +  * Potentiometru (pentru afisajul LCD-ului)
  
 {{ :​pm:​prj2022:​arosca:​schema_electrica_savu_adrian.png?​800 |}} {{ :​pm:​prj2022:​arosca:​schema_electrica_savu_adrian.png?​800 |}}
 +
 +Schema electrica a fost realizata cu ajutorul Friltzing
  
 ===== Software Design ===== ===== Software Design =====
Line 44: Line 46:
     float readTemperature(bool S = false, bool force = false);     float readTemperature(bool S = false, bool force = false);
     ​     ​
 +Functii folosite din biblioteca Servo.h: 
 +    uint8_t attach(int pin); 
 +    void write(int value); 
 +     
 +Functii folosite din biblioteca LiquidCrystal.h:​ 
 +    LiquidCrystal(uint8_t rs, uint8_t enable, uint8_t d0, uint8_t d1, uint8_t d2, uint8_t d3); 
 +    void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS);​ 
 +    void clear(); 
 +    void setCursor(uint8_t,​ uint8_t); 
 +     
 +Codul sursa din cadrul aplicatiei:​ 
 +  #include "​DHT.h"​ 
 +  #include <​Servo.h>​ 
 +  #include <​LiquidCrystal.h>​ 
 +   
 +  #define DHTPIN 2     // Digital pin connected to the DHT sensor 
 +   
 +  #define SERVOPIN 9   // Digital pin connected to the micro servo motor 
 +   
 +  #define WATERSENSORPIN A4   // Analog pin connected to the water sensor 
 +   
 +  #define LIGHTPIN A0   // Analog pin connected to the photoresistor 
 +   
 +  #define POWER_PIN 7  // Digital pin used to power up the water sensor when the value is scanned 
 +   
 +  #define DHTTYPE DHT11   // DHT 11 
 +   
 +  #define water_limit 130 
 +   
 +  #define light_limit 400 
 +   
 +  #define humidity_limit 30.0 
 +   
 +  #define temp_limit 24.0 
 +   
 +  // DHT11 sensor init 
 +   
 +  DHT dht(DHTPIN, DHTTYPE); 
 +   
 +  // mircroservo motor 
 +   
 +  Servo servo; 
 +   
 +  LiquidCrystal lcd(12, 11, 5, 4, 3, 13); 
 +   
 +  // pump on or off 
 +   
 +  bool on = false; 
 +   
 +  // micro servo motor delay 
 +   
 +  int movement_delay = 300; 
 +   
 +  void setup() { 
 +    Serial.begin(9600);​ 
 +   
 +    lcd.begin(16,​ 2); 
 +   
 +    servo.attach(SERVOPIN);​ 
 +   
 +    dht.begin();​ 
 +   
 +    pinMode(POWER_PIN,​ OUTPUT); ​  // configure D7 pin as an OUTPUT 
 +    digitalWrite(POWER_PIN,​ LOW); // turn the sensor OFF 
 +  } 
 +   
 +  void loop() { 
 +    // Wait a few seconds between measurements. 
 +    delay(2000);​ 
 +   
 +    // counter for the weather conditions 
 +    // if the count is bigger than 2 than the pump is activated and water is realesed 
 +    int conditions_count = 0; 
 +   
 +    // Reading temperature or humidity takes about 250 milliseconds! 
 +    float h = dht.readHumidity();​ 
 +    // Read temperature as Celsius (the default) 
 +    float t = dht.readTemperature();​ 
 +   
 +    // light photoresistor read value 
 +    int light_value = analogRead(LIGHTPIN);​ 
 +   
 +    // Check if any reads failed and exit early (to try again). 
 +    if (isnan(h) || isnan(t)) { 
 +      Serial.println(F("​Failed to read from DHT sensor!"​));​ 
 +      return; 
 +    } 
 +   
 +    Serial.print(F("​ Humidity: ")); 
 +    Serial.print(h);​ 
 +    Serial.print(F("​% ​ Temperature:​ ")); 
 +    Serial.print(t);​ 
 +    Serial.print(F("​C ")); 
 +     
 +    Serial.println("​Light Value :"); 
 +    Serial.print(light_value);​ 
 +   
 +    // water sensor 
 +     
 +    int water_value = 0; 
 +   
 +    digitalWrite(POWER_PIN,​ HIGH); ​ // turn the sensor ON 
 +    delay(10); ​                     // wait 10 milliseconds 
 +   
 +    water_value = analogRead(WATERSENSORPIN);​ // read the analog value from sensor 
 +   
 +    Serial.print("​Water value: "); 
 +    Serial.println(water_value);​ 
 +   
 +    digitalWrite(POWER_PIN,​ LOW);   // turn the sensor OFF 
 +   
 +    delay(1000);​ 
 +   
 +    if (light_value > light_limit){ 
 +      conditions_count++;​ 
 +    } 
 +   
 +    if (h < humidity_limit){ 
 +      conditions_count++;​ 
 +    } 
 +   
 +    if (t > temp_limit){ 
 +      conditions_count++;​ 
 +    } 
 +   
 +    if (water_value < water_limit){ 
 +      conditions_count++;​ 
 +    } 
 +   
 +    Serial.print(conditions_count);​ 
 +   
 +    if (conditions_count > 2){ 
 +      on = true; 
 +    } else { 
 +      on = false; 
 +    } 
 +   
 +    // servo motor  
 +    if(on){ 
 +      lcd.clear();​ 
 +      lcd.setCursor(0,​ 0); 
 +      lcd.print("​Pouring..."​);​ 
 +      servo.write(0);​ 
 +      delay(movement_delay);​ 
 +      servo.write(90);​ 
 +      delay(movement_delay);​ 
 +      servo.write(180);​ 
 +      delay(movement_delay);​ 
 +      servo.write(90);​ 
 +      delay(movement_delay);​ 
 +      servo.write(180);​ 
 +      delay(movement_delay);​ 
 +    } else { 
 +      lcd.clear();​ 
 +      lcd.setCursor(0,​ 0); 
 +      lcd.print("​Idle"​);​ 
 +    } 
 +  }
 ===== Rezultate Obţinute ===== ===== Rezultate Obţinute =====
  
-<note tip> +Cazul 1: Lumina, umiditatea si temperatura activeaza pompa
-Care au fost rezultatele obţinute în urma realizării proiectului vostru. +
-</​note>​+
  
 +{{ :​pm:​prj2022:​arosca:​whatsapp_image_2022-05-27_at_6.29.28_pm_1_.jpeg?​700 |}}
 +
 +Cazul 2: Apa, umiditatea si temperatura activeaza pompa
 +
 +{{ :​pm:​prj2022:​arosca:​whatsapp_image_2022-05-27_at_6.29.29_pm.jpeg?​700 |}}
 +
 +Cazul 3: Pompa inactiva
 +
 +{{ :​pm:​prj2022:​arosca:​whatsapp_image_2022-05-27_at_6.29.28_pm.jpeg?​700 |}}
 +
 +Au fost testate, de asmenea si cazurile in care temperatura este mai mare sau umiditatea este mai mica decat valoarea definita, o simulare live a fost dificil de obtinut.
 ===== Concluzii ===== ===== Concluzii =====
  
 +Always solder your LCD display, a fost destul de straight-forward proiectul, nu am avut probleme cu componentele,​ bibliotecile etc. A fost destul de interesanta realizarea unui proiect functional cu un arduino.
 ===== Download ===== ===== Download =====
  
Line 64: Line 233:
  
 <note tip> <note tip>
-Puteți avea și o secțiune de jurnal în care să poată urmări asistentul de proiect progresul proiectului.+27/05/2022, 18:56: final
 </​note>​ </​note>​
  
Line 71: Line 240:
 ==== Software: ===== ==== Software: =====
  
-[1]: https://​github.com/​adafruit/​DHT-sensor-library +  * [1]: https://​github.com/​adafruit/​DHT-sensor-library 
-[2]: https://​github.com/​arduino-libraries/​Servo+  ​* ​[2]: https://​github.com/​arduino-libraries/​Servo 
 +  * [3]: https://​github.com/​arduino-libraries/​LiquidCrystal
 ==== Hardware: ===== ==== Hardware: =====
  
 +
 +  * [1]: https://​create.arduino.cc/​projecthub/​pibots555/​how-to-connect-dht11-sensor-with-arduino-uno-f4d239
 +  * [2]: https://​arduinogetstarted.com/​tutorials/​arduino-water-sensor
 +  * [3]: https://​create.arduino.cc/​projecthub/​MisterBotBreak/​how-to-use-a-photoresistor-46c5eb
  
 <​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/prj2022/arosca/2312.1653657696.txt.gz · Last modified: 2022/05/27 16:21 by adrian_mihai.savu
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