Bird Deterrent Alarm System

Name: Enescu Maria
Group: 331CA

Introduction

A farmer is facing the problem of birds destroying crops. To solve this issue, I decided to build an automatic alarm system designed to scare birds away without harming them.

The system uses:

  • an Arduino Uno board as the microcontroller (with the code uploaded from a PC)
  • an analog light sensor to detect whether it is day or night
  • four distance sensors to cover multiple angles from which birds may approach
  • an RGB LED for visual signaling
  • a buzzer for sound-based alerts
  • a 16×2 LCD display to show essential information

The purpose of the system is to protect agricultural crops from birds that damage them, thereby reducing the farmer's losses and avoiding methods such as spraying the plants with chemical solutions that may be harmful to consumers or to the environment.

The basic idea started from observing a common problem in agriculture: crop losses caused by birds. I wanted to create an automated solution that helps farmers protect their crops without constant human intervention and without a negative impact on nature.

We believe that this system is useful for other farmers because it provides a real solution for crop protection and profit improvement, without suffering losses. For me, the project is an opportunity to learn and apply knowledge in electronics, programming, and strategic thinking to solve a problem in the field of agriculture.

General description

Block diagram:

 Block diagram of the system

Analog Light Sensor

The analog light sensor measures the intensity of ambient light in the environment. When it detects low light levels—typically at night—it activates the RGB LED to enhance visibility. Additionally, it sends the calculated light percentage to the LCD display, providing real-time feedback on lighting conditions.

Distance Sensors (HC-SR04)

The system includes four HC-SR04 ultrasonic distance sensors strategically placed to monitor multiple angles around the protected area. These sensors detect the approach of birds or other objects. If an object comes within a predefined distance, the system triggers both the RGB LED and the buzzer as a warning response. The exact distance to the object is also displayed in meters on the LCD screen.

Microcontroller – Arduino Uno

The Arduino Uno serves as the brain of the system. It receives data from the light sensor and all four distance sensors, processes this input using the uploaded program, and determines whether the conditions for activating the alarm are met. Based on this logic, it controls all actuators and outputs accordingly.

Pin Extender – PCF8574

Because the Arduino Uno has a limited number of digital I/O pins, the PCF8574 I/O expander module is used to extend pin availability. It communicates with the Arduino and allows additional components—such as sensors and displays that use digital pins—to be connected without exceeding the board’s capacity.

Actuators and Indicators

The system includes an RGB LED and a buzzer as output components. The RGB LED visually indicates system states through different colors, such as idle, alert, or alarm. The buzzer provides an audio warning signal intended to scare away birds without causing them harm, contributing to a non-invasive deterrent solution.

LCD Display and Values

The 16×2 LCD display is used to present real-time system data. It shows the ambient light level as a percentage, the distance to the nearest detected object, and context-specific alert messages such as ALARM or WARNING. This allows the user to monitor system status easily at a glance.

Hardware Design

Bill of Materials - BOM

Component Name Model Protocol Purchase Datasheet
Microcontroller Arduino Uno R3 - Here Datasheet
Distance Sensor HC-SR04 Digital Here Datasheet
Light Sensor Sensor Lumina Brick ADC Here Datasheet
LCD Display LCD 16×2 (lcd016n002bcfhet) I2C (with PCF8574) Here Datasheet
LED RGB PWM Here Datasheet
Buzzer Mini Diffuser Brick PWM Here Datasheet
Pin Extender PCF8574 I2C Here Datasheet
Breadboard BreadBoard Mini - Here -

Shematic View

3D View

Images

Images showing ALARM and WARNING states

Connection Overview:

* HC-SR04 Ultrasonic Sensors

  • Trig pin is connected to Arduino digital pin 13
  • Echo pins are connected to digital pins 9, 10, 11, and 12

* RGB LED

  • Red, Green, and Blue channels are connected through the PCF8574 I2C expander
  • Connected to pins 0, 1, and 2 on the expander

* LCD 16×2 Display

  • Connected via I2C using a PCF8574 module
  • Uses SDA (A4) and SCL (A5) on the Arduino

* Buzzer

  • Connected to digital pin 8

* Light Sensor

  • Connected to analog pin A0
Simulation Results:

The verification was performed both via the Serial Monitor (DEBUG mode) and directly on the physical components:

* Using the Serial Monitor, the following were observed:

  • Distance values measured by the HC-SR04 ultrasonic sensors
  • Ambient light level from the TEMT6000 light sensor
  • Logical state and reaction of the RGB LED and buzzer under various conditions

* On the 16×2 LCD display, the following physical outputs were visible:

  • Ambient light percentage
  • Distance to the nearest detected object
  • Alert messages :ALARM, WARNING

Software Design

Development Environment:

  • Arduino IDE

Libraries Used:

  • LiquidCrystal.h – for controlling the 16×2 LCD display connected directly to digital pins
  • pcf8574.h – for communication with the PCF8574 pin expander via I2C protoco

Logical Structure:

Flowchart

 Flowchart

You can explore the full source code here: Bird Deterrent Alarm System Code

Definitions, Variables and Functions:

  • #define DEBUG → Enables Serial Monitor output for debugging
  • LiquidCrystal lcd(7, 6, 5, 4, 3, 2) → Initializes the 16×2 LCD using digital pins 2–7
  • PCF8574 ex(0x20) → Creates an I2C expander object at address 0x20
  • int red = 0, green = 1, blue = 2 → RGB LED channels connected via PCF8574
  • int trigger = 13, echo1 = 9, echo2 = 10, echo3 = 11, echo4 = 12 → HC-SR04 ultrasonic sensors (shared trigger, separate echo pins)
  • int buzzer = 8 → PWM pin for the piezo buzzer
  • int lum = A0 → Analog input pin for the light sensor
  • float prev[] → Stores previous valid distance values in case of read errors
  • int melody[] → Array of sound frequencies for buzzer output
  • int leds[] → Binary RGB combinations for light pattern sequences
  • float distance(int echo) → Returns distance in cm using an ultrasonic echo pin
  • void playMelody() → Plays a simple sound sequence on the buzzer
  • void alarm() → Triggers a full alarm: melody and RGB light pattern
  • void clear() → Stops the buzzer and turns off all RGB LED outputs
  • void loop() → Main control loop: reads sensors, processes values, activates components based on thresholds
  • analogRead(lum) → Reads ambient light level
  • digitalWrite(ex, X, HIGH/LOW) → Controls RGB LED colors via I/O expander
  • lcd.setCursor(x, y) / lcd.print() → Displays light level, distance, and status messages on the LCD
  • Serial.print()/println() → Used for debugging (enabled via #define DEBUG)

Result

Download

You can explore the full source code and project details here:

Bird Deterrent Alarm System GitHub Repository

pm/prj2025/eradu/maria.enescu.txt · Last modified: 2025/05/28 23:07 by maria.enescu
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