Sperietoare Animale Rapitoare Pentru Ferme

Student: Alexandru Olteanu, 332CA

Introducere

Proiectul reprezinta un sistem ce poate fi folosit in recoletele de rosii, castraveti, etc pentru fermele din Romania. Acesta poate aduce un plus de siguranta deoarece intercepteaza distantele pana la animalele / pasarile care dauneaza recolta.

Descriere Generala

Sistemul presupune un senzor ultrasonic de distanta prin care un obiect aflat in fata acestuia este interceptat, calculandu-se distanta pana la el. Distanta este in permanenta afisata pe un LCD, iar daca distanta scade sub o anumita valoare minima, un servomotor porneste miscarea unei elice care are rolul de a speria “animalul rapitor”.

Schema Bloc

Hardware Design

  1. Fire de legatura
  2. Arduino UNO
  3. Senzor Ultrasonic
  4. Display LCD
  5. Servomotor
  6. Elice

Cod Software

#include<Servo.h> #include <LiquidCrystal_I2C.h> #define echo 4 #define trigger 5

LiquidCrystal_I2C lcd(0x27,20,4); const int inf = 2e9; int pos = 0; double duration, distance; double before_distance = inf; Servo servomotor;

void setup() {

servomotor.attach(7);
DDRD |= (1 << trigger);
DDRD &= ~(1 << echo);
Serial.begin(9600);
lcd.init();
lcd.backlight();

}

void updateDistance() {

PORTD |= (1 << trigger);
delayMicroseconds(5);
PORTD &= ~(1 << trigger);
duration = pulseIn(echo, HIGH);
distance = (float)duration * (0.0345) / 2;
if (fabs(distance - before_distance) < 3e-1) {
  distance = before_distance;
}
else {
  before_distance = distance;
}

}

void loop() {

updateDistance();

lcd.setCursor(0,0);
lcd.print("Distance is: ");
lcd.setCursor(0, 1);
lcd.print(distance); 
lcd.print(" cm");
if (distance <= 100) {
  for (pos = 0; pos <= 180; pos += 1) {
    // tell servo to go to position in variable 'pos'
    servomotor.write(pos);
    updateDistance();
    if (distance > 100) {
     	break; 
    }
    delay(2);
  }
  for (pos = 180; pos >= 0; pos -= 1) {
    servomotor.write(pos);
    updateDistance();
    if (distance > 100) {
     	break; 
    }
    delay(2);
  }
  lcd.clear(); 
}

}

Download

Codul Integral si Schema Hardware code.zip

Rezultate Obtinute

Video Rezultate

pm/prj2023/vstoica/sperietoare_animale_ferma_-_alexandru_olteanu_332ca.txt · Last modified: 2023/05/28 17:22 by alexandru.olteanu01
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