Welcome to a new Arduino project. In this tutorial we will see how to build an automatic pet food dispenser using a servo motor and an Arduino board. We will also review the materials used to build it, show the wiring diagram and share the code needed to control the dispenser. It can be adapted for many pets, from fish and turtles to hamsters or rabbits.
Table of contents
Materials used in the pet dispenser
Below you can find the materials used to build this Arduino dispenser, together with a brief description of each one. If you want to make the project yourself, you can click the images to visit a website where those materials are available.
Arduino UNO board: It is the brain of the project and controls all of its processes through the code you will find below.
Servo motor: motor de 5v con una reductora, lo que permite un gran manejo de su posición y una gran fuerza para su reducido tamaño.
Protoboard: A board with internally connected holes (pins) that we will use to make the project's electrical connections.
Jumper wires: These wires have male or female pin ends that let us connect the different components used in the project.
Cartulina: Se usará como estructura aunque puede usarse cualquier otro tipo de material.
Components needed for this Arduino project
WE DEVELOP YOUR IDEA
Need help with a project?
- Prototyping and MVPs
- Arduino and ESP32
- PCB design
- 3D part design
- Bluetooth connectivity
- Feasibility study
- Cost optimization
- Technical consulting
- Internet of Things
- Patent support
Step-by-step video of the pet dispenser
If you want a much more detailed explanation of how to build this project from start to finish, including the code, the video below covers the full process in a clearer and more visual way. And if you enjoy this kind of content, do not forget to subscribe.
Arduino wiring diagram to build the automatic dispenser
One of the most important parts of assembling this automatic pet dispenser is wiring every component correctly. To avoid assembly mistakes or wrong connections, here is the wiring diagram used in this project. With this wiring setup, you can use the code at the end of the post without any modification.

Arduino code for the pet dispenser
Below you can find the Arduino code developed specifically for this project. The pins used in the code are the same ones shown in the wiring diagram above.
If you want a more detailed explanation of the different parts of the code and how the dispenser works, I recommend watching the video linked above.
If you have any questions about how to use or install the development environment used for Arduino, here is a link to how to download the Arduino IDE





//Canal de YouTube -> RobotUNO
//Proyecto -> Dispensador automatico
#include<Servo.h>
Servo servo1;
int PINSERVO = 2;
int PULSOMIN = 1000;
int PULSOMAX = 2000;
void setup(){
servo1.attach(PINSERVO, PULSOMIN, PULSOMAX);
}
void loop(){
servo1.write(0);
delay(10000);
servo1.write(180);
delay(500);
}




