• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

Circuit Ideas for You

Get free circuit ideas online.

  • Home
  • Privacy Policy
  • About
Home » Building a Smart Pet Feeder Circuit using Arduino

Building a Smart Pet Feeder Circuit using Arduino

Last updated on 31 July 2025 by Admin-Lavi Leave a Comment

Feeding pets can be easy and on time using automatic system.

This project for Building a Smart Pet Feeder Circuit using Arduino and other parts like IC 7809, SG90 servo motor and HC-SR04 sensor to make simple pet feeder.

Feeder work with distance sensor to give food so pet can eat on time without people help.

This system help pet owners save time and feed pets regularly.

Code:

#include <Servo.h>

Servo myservo;  // create a servo object to control the servo

const int trigPin = 9;    // Trigger pin of the ultrasonic sensor
const int echoPin = 10;   // Echo pin of the ultrasonic sensor

const int   
 servoPin = 2;   // Servo motor pin

int duration, distance;

void setup() {
  myservo.attach(servoPin);  // attach the servo to pin 2
  pinMode(trigPin, OUTPUT); // sets the trigPin as an output
  pinMode(echoPin, INPUT);  // sets the echoPin as an input
}

void loop() {
  // Generate a pulse of 10us on the TRIGGER pin
  digitalWrite(trigPin, HIGH);
  delayMicroseconds(10);
  digitalWrite(trigPin, LOW);

  // Read the duration of the pulse on the ECHO pin
  duration = pulseIn(echoPin, HIGH);

  // Calculate the distance in centimeters
  distance = duration * 0.0343 / 2;   


  // Check if a pet is within the desired range
  if (distance >= 10 && distance <= 20) {
    // Dispense food by rotating the servo
    myservo.write(90); // Adjust the angle as needed
    delay(1000); // Delay for dispensing
    myservo.write(0); // Return to initial position
  }

  // Add code for timer-based feeding if desired
}

Code Explanation:

  • This line include Servo library and it helps control servo motor.
  • This line make servo object name myservo.
  • myservo will control servo motor.
  • Next lines set pins for trigger (trigPin), echo (echoPin) and servo (servoPin) as constant numbers.
  • duration and distance are integer variables and they save pulse time and measured distance.
  • This function run one time when program start.
  • myservo attaches to servoPin.
  • echoPin set as input and trigPin set as output.
  • This function run again and again in loop.
  • trigPin send small pulse to make ultrasonic sound.
  • echoPin measure how long sound come back and it uses this to find distance.
  • If distance is between 10 and 20 cm then servo motor turn to 90° to drop food.
  • We can also add timer code to feed by time.

Circuit Working:

Building a Smart Pet Feeder Circuit Diagram using Arduino

Parts List:

ComponentQuantity
Arduino Uno1
IC 7809 (Voltage Regulator)1
Servo Motor SG901
Ultrasonic Distance Sensor HC-SR041

In this circuit diagram choose container big enough to hold pet food.

Add open-close lid on container and servo motor will control this lid.

Fix servo motor in box so it can open and close food container properly.

Simple Automatic Arduino Pet Feeder Model Setup

Fix ultrasonic sensor so it can see pet in set distance.

Ensure pet can come in front of sensor clearly.

Put all parts inside box to protect from weather.

Make small hole so pet can reach food.

Use IC 7809 to change 12V to 5V which is needed for Arduino, servo and sensor.

Give 5V power to sensor and servo using breadboard.

HC-SR04 sensor check how far pet is by sending sound waves and measuring return time.

Servo motor control food lid.

Arduino tell servo to turn and open or close feeder.

How to Build:

For Building a Smart Pet Feeder Circuit using Arduino following steps need to be followed for assembling:

  • First collect all parts shown in circuit diagram.
  • Connect IC 7809 to give steady 9V DC to Arduino as shown in circuit diagram.
  • Connect Servo Motor SG90 with black wire to GND on Arduino, red wire to 5V on Arduino and orange wire to pin 2 on Arduino
  • Connect Ultrasonic Sensor HC-SR04 with VCC to 5V on Arduino, TRIG to pin 9 on Arduino, ECHO to pin 10 on Arduino and GND to GND on Arduino

Conclusion:

This Building a Smart Pet Feeder Circuit using Arduino shows how to make automatic pet feeder using servo motor and ultrasonic sensor.

It helps feed pet without human help by making pet care easier.

References:

Reliable Smart Pet Feeding Machine Using Arduino Uno Starter Kit

Filed Under: Arduino Projects, Sensors and Detectors

About Admin-Lavi

Lavi is a B.Tech electronics engineer with a passion for designing new electronic circuits. Do you have questions regarding the circuit diagrams presented on this blog? Feel free to comment and solve your queries with quick replies

Previous Post: « Human Presence and Motion Sensor Circuit using Arduino
Next Post: Metal Detector Circuit using Arduino »

Reader Interactions

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Primary Sidebar




Categories

  • Alarm Circuits (34)
  • Amplifier Circuits (67)
  • Arduino Projects (56)
  • Audio Circuits (97)
  • Automobile Circuits (19)
  • Battery Charger Circuits (48)
  • Free Energy (13)
  • Heater and Temperature Controllers (10)
  • High Voltage (1)
  • Indicator Circuits (40)
  • Inverter Circuits (13)
  • LDR Circuits (16)
  • LED and Lamps (116)
  • Meters and Testers (28)
  • Motor Controllers (18)
  • Oscillator Circuits (34)
  • Power Supply Circuits (92)
  • Remote Control Circuits (7)
  • Security and Protection (26)
  • Sensors and Detectors (97)
  • Solar Circuits (17)
  • Timer Circuits (30)
  • Transistor Circuits (57)
  • Transmitter Circuit (13)
  • Tutorials (5)
  • Water Level Controller (4)

Recent Posts

  • Sound Activated LED Circuit with Arduino
  • Whistle Controlled Light Circuit using Arduino
  • Tilt Switch Interfacing Circuit with Arduino Uno
  • Interfacing Hall Effect Magnetic Sensor Circuit with Arduino
  • Hall Effect Sensor Circuit with IC LM393

Recent Comments

  1. Admin-Lavi on Constant Voltage, Constant Current Battery Charger Circuit
  2. Bill on Constant Voltage, Constant Current Battery Charger Circuit
  3. Admin-Lavi on Long Range FM Transmitter Circuit (2km)
  4. Sina on Long Range FM Transmitter Circuit (2km)
  5. Admin-Lavi on Long Range FM Transmitter Circuit (2km)

Copyright © 2025 | New Circuit Ideas