DR ST: Shaqra University - Reem Hamdawi: Raghad Abdullah Al-Majmaj
DR ST: Shaqra University - Reem Hamdawi: Raghad Abdullah Al-Majmaj
Shaqra University
Dr. Reem Hamdawi
ST : Raghad Abdullah Al-Majmaj
Contents
Introduction: Automated Horse Stable Management System Using
Arduino...........................................................................................................3
Detailed Explanation of the Project..........................................................3
1. Project Overview..................................................................................3
2. Key Features..........................................................................................3
3. Components Used.................................................................................4
Function of Each Component in Detail.....................................................5
Table Summarizing the Function of Each Component...........................8
How the Components Interact...................................................................9
Working Principle of the Project................................................................9
Step-by-Step Operation of the System..................................................11
Flowchart of the System's Operation.....................................................12
Practical Example.......................................................................................13
System Analysis.........................................................................................13
Use Case Diagram......................................................................................14
Use Case Description.................................................................................14
Sequence Diagram.....................................................................................15
Wiring Instructions....................................................................................15
Complete Code for the Project :..............................................................17
................................................................................................................19
Functions of the Current System.............................................................20
Future Enhancements................................................................................20
Conclusion...................................................................................................24
References...................................................................................................24
Raghad Abdullah Al-Majmaj
3. Components Used
Arduino Uno: The main microcontroller that
processes inputs and controls outputs.
3. Servo Motor
Function:
A servo motor is an electric motor that can rotate to a
specific angle with high precision. It is used to automate the
movement of the gate.
Role in the Project:
Opens the gate when it receives a signal from the Arduino
(after the sensor detects a horse).
Closes the gate after the horse has passed through.
The motor's rotation angle (e.g., 90° to open and 0° to close)
is controlled by signals from the Arduino.
4. LCD Display
Function:
The LCD (Liquid Crystal Display) is used to display textual or
numerical information. In this project, it shows the current
number of horses in the stable.
Role in the Project:
Displays the current horse count dynamically.
Raghad Abdullah Al-Majmaj
5. Buzzer
Function:
The buzzer is an electronic component that produces sound
when an electric current is applied. It is used to generate
audible alerts.
Role in the Project:
Emits an alert sound if the horse count falls below the
required number.
Notifies the stable manager to take necessary actions.
6. Breadboard
Function:
A breadboard is used to connect electronic components
temporarily without soldering.
Role in the Project:
Facilitates wiring between components such as the Arduino,
sensors, motors, and display.
Provides flexibility during development and testing.
7. Resistors
Function:
Resistors are used to control electric current and protect
electronic components from damage.
Raghad Abdullah Al-Majmaj
8. Wires
Function:
Wires are used to connect electronic components and
transmit electrical signals.
Role in the Project:
Transmits signals between the Arduino and other
components such as sensors, motors, and the display.
Provides the necessary electrical connections for the system
to function.
9. Power Supply
Function:
The power supply (e.g., a 9V battery or USB adapter)
provides electrical power to the system.
Role in the Project:
Supplies power to the Arduino and other components.
Ensures uninterrupted operation of the system.
Component Function
Arduino Processes signals and controls other
Uno components.
Raghad Abdullah Al-Majmaj
Component Function
IR Sensor Detects the entry or exit of a horse.
Servo
Automates the opening and closing of the gate.
Motor
LCD
Displays the current horse count.
Display
Buzzer Emits an audible alert if the horse count is low.
Breadboar Facilitates temporary connections during
d development.
Resistors Controls current and protects components.
Transmits electrical signals between
Wires
components.
Power
Provides electrical power to the system.
Supply
Practical Example
Assume the stable has 10 horses, and one horse exits:
1. The horse approaches the gate, interrupting the infrared
beam.
2. The gate opens automatically.
3. The horse passes through, and the count is decremented
from 10 to 9.
4. The gate closes automatically.
5. The system checks the count and finds it is below the
required number (9 instead of 10).
6. The buzzer is activated to issue an alert.
7. The updated count (9) is displayed on the LCD screen.
System Analysis
Primary Users of the System:
1. Horse: Enters or exits the stable.
Raghad Abdullah Al-Majmaj
Sequence Diagram
This diagram represents the interaction between components
when a horse enters or exits:
1. The horse approaches the stable.
2. The sensor detects the horse.
3. The sensor sends a signal to the Arduino.
4. The Arduino activates the motor to open the gate.
5. The horse enters.
Raghad Abdullah Al-Majmaj
Wiring Diagram
1. IR Sensor Connections
VCC → 5V on Arduino.
GND → GND on Arduino.
OUT → Digital Pin 9 on Arduino.
2. Servo Motor Connections
Red Wire (VCC) → 5V on Arduino.
Black Wire (GND) → GND on Arduino.
Yellow Wire (Signal) → Digital Pin 6 on Arduino.
3. LCD Display Connections
VSS → GND on Arduino.
Raghad Abdullah Al-Majmaj
VDD → 5V on Arduino.
V0 → Middle Pin of Potentiometer (for contrast control).
RS → Digital Pin 12 on Arduino.
RW → GND on Arduino.
E → Digital Pin 11 on Arduino.
D4 → Digital Pin 5 on Arduino.
D5 → Digital Pin 4 on Arduino.
D6 → Digital Pin 3 on Arduino.
D7 → Digital Pin 2 on Arduino.
A (Backlight Anode) → 5V on Arduino.
K (Backlight Cathode) → GND on Arduino.
4. Buzzer Connections
Positive (+) Terminal → Digital Pin 8 on Arduino.
Negative (-) Terminal → GND on Arduino.
5. Potentiometer Connections
Pin 1 → 5V on Arduino.
Pin 2 → V0 on LCD.
Pin 3 → GND on Arduino.
#include <Servo.h>
#include <LiquidCrystal.h>
// Initialize components
Servo gateServo;
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
// Variables
int horseCount = 0;
Raghad Abdullah Al-Majmaj
void setup() {
// Attach servo to pin 6
gateServo.attach(6);
void loop() {
// Check if the IR sensor detects a horse
if (digitalRead(irSensorPin) == LOW) {
// Open the gate
gateServo.write(90); // Rotate servo to 90 degrees
delay(2000); // Wait for the horse to pass
Current System
Raghad Abdullah Al-Majmaj
Future Enhancements
1. Advanced User Interface
A. Touch Screen Display:
Replace the LCD with a touch screen to display more
detailed information, such as:
o Current horse count.
o Gate status (open or closed).
o Alerts if the horse count is low.
B. Control Menu:
Add a control menu on the touch screen to allow users to
adjust settings, such as:
o Changing the required horse count.
Raghad Abdullah Al-Majmaj
3. Additional Sensors
A. Motion Sensor (PIR Sensor):
Add a motion sensor to detect the presence of horses more
accurately, especially in dark or enclosed areas.
B. Weight Sensor (Load Cell):
Add a weight sensor to measure the weight of horses as they
enter or exit. This can help monitor the health of the horses.
C. RFID Sensor:
Use an RFID sensor to uniquely identify each horse. This
can help track individual horses and manage the stable more
effectively.
Raghad Abdullah Al-Majmaj
7. Security System
A. Surveillance Camera:
Add a camera connected to the Arduino for remote
monitoring of the stable.
B. Alarm System:
Add an alarm system that triggers if unusual activity or
unauthorized entry is detected.
Conclusion
The Automated Horse Stable Management System Using
Arduino presents a practical and efficient solution for modern
stable management. By integrating various sensors, actuators,
and a microcontroller, the system automates key operations such
as gate control, horse counting, and alert mechanisms. The
implementation of an LCD display ensures real-time monitoring,
while the buzzer system enhances security by notifying the
manager of discrepancies. This project demonstrates the potential
of IoT-based automation in animal management, improving
operational efficiency, reducing human error, and ensuring the
well-being of horses. Future enhancements could include RFID
tracking, cloud-based data logging, and mobile app integration to
further optimize stable management.
References
1. Arduino Official Documentation – https://www.arduino.cc/
2. Kumar, R., & Sharma, P. (2020). Microcontroller-Based
Automated Systems: Applications and Implementation.
Springer.
3. Smith, J. (2018). IoT and Automation in Agriculture:
Enhancing Efficiency through Smart Systems. IEEE
Transactions on Industrial Electronics.
4. SIM800L GSM Module Datasheet –
https://simcom.ee/modules/gsm-gprs/sim800l/