Arduino Pet Feeder with Ultrasonic Distance Sensor and Servo Motor
This Arduino-based Pet Feeder project employs an ultrasonic distance sensor and a servo motor to create an automated feeding system for pets. The ultrasonic sensor measures the distance to detect the pet’s presence, and when triggered, the servo motor dispenses food.
Component List:
Name | Quantity | Component |
---|---|---|
DIST1 | 1 | Ultrasonic Distance Sensor |
SERVO1 | 1 | Positional Micro Servo |
U1 | 1 | Arduino Uno R3 |
Connect the ultrasonic sensor to Arduino pins (trigger and echo) and the servo motor to another pin. Add a container for pet food with a mechanism controlled by the servo motor to release a predetermined amount when activated.
Arduino Code:
#include <Servo.h>
int Distanca = 0;
long readUltrasonicDistance(int triggerPin, int echoPin) {
pinMode(triggerPin, OUTPUT);
digitalWrite(triggerPin, LOW);
delayMicroseconds(2);
digitalWrite(triggerPin, HIGH);
delayMicroseconds(10);
digitalWrite(triggerPin, LOW);
pinMode(echoPin, INPUT);
return pulseIn(echoPin, HIGH);
}
Servo servo_A5;
void setup() {
Serial.begin(9600);
servo_A5.attach(A5, 500, 2500);
}
void loop() {
Serial.println(0.01723 * readUltrasonicDistance(A0, A1));
if (0.01723 * readUltrasonicDistance(A0, A1) < 50) {
servo_A5.write(90);
} else {
servo_A5.write(0);
}
delay(10);
}
The Pet Feeder project provides a convenient solution for pet owners, ensuring regular feeding even when they’re away.
The Arduino’s versatility allows customization of feeding schedules and portion sizes. This project showcases how technology can enhance pet care, offering automation and ease of use. Further improvements can include adding a real-time clock for precise scheduling or integrating a camera for remote monitoring.
The Pet Feeder project aligns with the trend of smart devices for pet welfare, providing a practical and innovative solution for busy pet owners.