Feeder for aquarium fish based on Arduino. How to make a do-it-yourself auto feeder for cats Then I threw everything into a plastic box bought at a hardware store

In this series of articles, I will talk about my experience in assembling a "smart" automatic system for feeding a pet, in my case, a cat.

I want to immediately note that at the first step we will only talk about the "automatic" feeder, and it will become "smart" at the next stages (if you're lucky, and everything goes according to plan).

So, let's start with the concept and goals:

  • Make a system that frees me from the obligation to feed my cat dry food (step 1)

  • Equip the system with a weight sensor under the bowl and carry out feeding in accordance with the indications of the scales: if the bowl is empty, add it, otherwise, wait until the bowl is empty (step 2)

  • Add a Wi-Fi module and a video camera to the system to transfer photos with your favorite cat, as well as provide remote control of feeding. In addition, collect data on how much the cat ate and build analytics (step 3)
  • The first step does not require a large number of sensors and manipulators, one servo motor is enough (for example, Micro Servo Towerpro SG90 9 g), so all control comes from the ArdruinoUno board, which is ideal for this kind of tasks.

    Feeding systems in one way or another contain some container in which dry food lies, and a rotating mechanism that dispenses its amount. Having studied the experience of other "inventors", I would single out three main mechanisms:

  • The container and the system itself are used from under the muesli dispenser (probably seen in hotels). A rod with blades is installed at the bottom in the neck of the container. The axis of the rod lies along the plane of the neck. A motor is attached to it, which scrolls the blade by one division once in a given period of time. Such a mechanism looks quite neat, it is easy to assemble (in fact, almost nothing needs to be assembled), but, alas, it is very expensive. But here the taste and color.

  • Another option - on the contrary, the design is made by hand from acrylic, and a rotating dispenser from CDs. It is pretty clear how to make such a feeder is described in this video. If there is acrylic on hand, a cutter for it, and, in principle, there is some experience in assembling this kind of thing, then this is

    A very budget option. But not for people like me - designing, cutting and joining everything on your own requires a different level of accuracy.


  • For the third option, you will need: an ordinary jar that will play the role of a container, something from which you can cut a small sector (for example, the lid of some plastic IKEA box is suitable), and a couple of magnets for fastening the structure. We will analyze this option in more detail, it does not require engineering education and a large number of investments, in general, just what you need.
  • All the materials that I needed to assemble the feeder at the first stage:


    • Glass jar

    • Arduino Uno

    • MicroServo (I have an allowed rotation angle of 180, but it doesn't matter)

    • piece of plastic

    • magnets

    • pins for connecting the board to the servomotor

    • USB charging at 5V

    The logic of the mechanism is simple: a sector-type hole is made in the lid of the can (the center of the lid is not cut out), the same sector is cut out of plastic. A servo motor is attached inside the cover, for example, with adhesive tape. First, a cover is mounted on the engine axis, and a cut-out sector on the outside. So, when the axis of the servomotor is rotated, the cut sector is displaced relative to the hole in the lid of the can.

    Also, do not forget to make a hole for the output of the servomotor wire to the outside to connect to the board. At step 1, feeding occurs on a timer, my cat is not a glutton, so the sector opens once a day for a short time, below is the code for Arduino:

    #include #define servoPin 9 Servo myservo; void setup() //setup procedure ( myservo.attach(servoPin); //attach the drive to port 9 ) void loop() ( myservo.write(0); //put the shaft at 0 degrees delay(300); // wait 0.3 seconds myservo.write(160); //set shaft at 160 degrees delay(86400000); //wait 24 hours )

    To fasten the jar to the wall, I used these magnets, each 4kg (I think it's better to use more powerful ones). Magnets are attached to the jar simply with glue, and to the wall with screws.

    The board is attached to the bank with Velcro, it is convenient to remove and attach it back. Velcro is sold in any household, used for fastening pictures.

    Since my only external module is a servo motor, no additional power is needed, it is enough to power the board, it can be connected directly to the network via a 5V usb charger.

    Here's what it looks like when assembled:

    http://habrahabr.ru/https:/docs.google.com/drawings/d/sZPzsxkEnz9YKjsg006HPBA/image?w=320&h=311&rev=7&ac=1

    "Below I have outlined a few ideas for the further development of the feeder, there are a lot of them and it is not yet clear what exactly will be done next, this part is for discussion.


    • installation of motion sensors, photographing the cat at the moment when it appears in the field of view. The integration of a weight sensor and a motion sensor allows you to determine when the cat is just walking past the feeder, and when he came to eat. Accordingly, you can tighten the analytics when the cat prefers to eat and how much.

    • you can add a weight sensor to the feed container itself so that the feeder determines the moment when it becomes empty and sends a warning to the owner that, they say, it is empty, it needs to be replenished. Then, as an option, add the possibility of auto-ordering food from your favorite site with delivery.

    • You can add the ability of the feeder to work for two cats:

      • Or it will be two different feeders, each of which can scare away a “strange” cat

      • Or is this one, but somehow modified


    • We need to think about how to implement a drinker and integrate it with a feeder, add a filtration system.

    I hope this will be useful to someone.

    I have a Maine Coon that weighs over 10 kilos. His name is Duke. The cat loves to bask in the sun, watch the birds and… wake me up at 5 am so that I give him breakfast.

    As you can imagine, if a 10 kg cat sits on your chest early in the morning, then you have no choice but to wake up, take in more air and feed the animal. You ask, "why not buy a feeder for animals?".

    So, the answer lies in the fact that it is very boring and simple. Instead, I wanted to make my own automatic cat feeder. As an engineering student, I had completed many projects and was ready to take on the challenge, but could I build an electronic feeder that would cost less than $100?

    Step 1: Feeder Assembly Parts

    The main idea of ​​the project will be to keep under $100 and see what can be used to make a simple cat feeder.

    Here is a list of our parts:

    • Grain dispenser/dispenser (I used Home Basics - $17.75 on eBay)
    • Continuous rotation device (I used SPRING SM-S4303R JR - $8.90 on eBay)
    • Board for projects (plywood) 30*30*0.5 cm
    • Arduino Uno R3, 16 Hz - ($3.50 on eBay)
    • Right side corners 10 * 1 cm (cost around $1.97)
    • Pack of nuts, screws, bolts ~ 1.3 cm long (cost around $1.18)
    • Rectangular PVC "elbow" ~ 5 cm (cost about $.98)

    Step 2: Let's start collecting

    Initially, I thought to collect everything on my knee, but the more I thought about the project, the more difficult it became. And then I thought: “Is there already something designed for dosing that would be cheap and that could be easily modified?” And voila - there are ready-made grain dispensers on sale, they can be easily modified and connected to the drive.

    Step 3: Servo/Crank Assembly




    The first thing I did was to modify the crank that came with the corn meter. I cut off all the protrusions, so that only the central cylinder remained. After a little sanding, I was able to screw the small servo rotation disc onto it. After that, all that remained to be done was to attach the disk to the servo.

    Step 4: Front Panel



    After that, I designed the front panel of the automatic cat feeder. I cut a piece of the board to the right size so that it fits the front well and covers all the electronics that will be behind it. Once I cut and sanded the board, I attached 4 corners to it, with which you can secure the board to the feeder. I drilled 2 holes on each side of the feeder body and attached the board with bolts and nuts.

    Step 5: Dosing Funnel




    This was the easiest part of the project. I circled the tube outlet on the front panel, then hot glued the tube to the grain dispenser outlet.

    Note: double-check that the tube and front panel are well seated before attaching the tube with hot glue.

    Step 6: Attaching the Servo

    Now that most of the work is done, you can secure the servo to keep it from moving while you work. I took two wood screws and screwed the servo through the holes directly to the wood.

    Step 7: Program the Arduino




    Now comes the fun part. We need to program the Arduino so that it gives out food at a certain time of the day. I tried to make the code as simple as possible. Based on age, weight, and breed, I looked at how much and how often Duke needed to eat throughout the day to feel full. The automatic feeder was set to 0.65 cups every 8 hours. The time and amount of food can be easily modified depending on the needs of your pet. The pinout will remain the same.

    Step 8: Connect and Test





    Now that the code is ready, we can connect the Arduino and the servo. The connection looks like this:

    • The black wire of the servo goes to GND of the Arduino.
    • Red servo wire goes to 5V Arduino
    • The white servo wire goes to pin 13 of the Arduino

    Once you have verified that everything is working properly, you can secure the Arduino in place. To protect my board, I created a case on a 3D printer and simply glued it inside the feeder with hot glue.

    The final improvement was the addition of legs to the feeder so that it rises above the bowl. 5 cm wooden boards were used as legs. I glued foam to their bottom part - it protected the floor from scratches. All that remains to be done is to glue the legs themselves to the feeder.

    Step 9: Finished Feeder

    In the photo you see the finished result. The project cost $39.18 (about 2300 rubles). And I hope it inspires you to build your own automated pet feeder.

    This project is based on the ESP8266 WIFI board and is designed to be controlled and monitored via the BLYNK app on your smartphone.

    You can also add an IP camera to the project (or use an old smartphone with a camera as a server) for real-time monitoring. time via IP Webcam Pro via a widget in the BLYNK app.

    Feed is delivered using a NEMA17 stepper motor in 1.8 degree increments - 200 steps per revolution. The motor rotates the auger in the plumbing adapter into which feed enters from the hopper.

    The dosage portion can be adjusted, as well as visually display the filling in the BLYNK application. And there are also a lot of settings, in the application itself, which I will talk about towards the end of the post and demonstrate in a video on my YouTube channelYoutube - DenisGeek

    Applications in the play store for smartphones:

    Electronic part and components:

    The schematic of this device is very simple. It consists of an ESP8266 board - which serves as a brain, as well as a means of communication with your Wi-Fi router, transmitting data through a special. API key on the BLYNK application server. Our "brains" control the stepper motor driver, and it at one time sets the movement for the NEMA17 stepper. The LM2596 buck board serves as a buck module to power the ESP8266 board.
    There is also a remote button on the case, which is added through a 10K pull-up resistor to ground - it implements the function to start "feeding" in manual mode.


    I ordered components for the project on Aliexpress:

    ESP board 8266 NODEmcu LUA http://ali.pub/2k460i \ http://ali.pub/2k4622

    Power supply 12 V 2 A http://ali.pub/2k464e

    Stepper motor driver L289N http://ali.pub/2k4674

    Nema17 stepper motor http://ali.pub/2k46a8

    Buck Converter LM2596 http://ali.pub/2k46jk

    If you don’t want to solder the ESP board, you can connect everything with breadboard wires http://ali.pub/2k46un

    Auxiliary tool:

    Soldering iron http://ali.pub/2k2wz8

    Solder http://ali.pub/2k471g

    Wire cutters http://ali.pub/2k4730


    Everything else can be bought locally at a radio or hardware store (beam for frame assembly, junction box, clamps, self-tapping screws, etc.)



    To begin with, I assembled everything in the form of a layout on the table and checked for performance, as well as made additional settings.



    Then I threw everything into a plastic box bought at a hardware store.

    Feeder frame dimensions:


    The frame looks like this. Everything is very simple and universal, assembled from timber, plywood and self-tapping screws.



    You can download printable files here: https://goo.gl/EwqCC1

    The feed mechanism was printed on a 3D printer - an auger, glued from 2 parts with Dismokol glue.



    The print was successful.



    You can order a print, or try to adapt the auger from a broken meat grinder.


    As a basis for the tank, a bottle of kvass "Taras" was used, as well as a connector for plastic pipes.



    Here is a general view of the assembled device:



    After assembly, it is enough to supply power to our unit, and also after 20 seconds, press the button to check and start the "feeding" and check the dosage.

    And then we move on to the BLYNK application. Download it to your smartphone from the play store or from the site https://www.blynk.cc/

    After downloading the application, login / register and get 2000 energy points to create your application.

    Next, we scan the QR code and automatically pull up the template of my already configured widget:


    After that, in the application you will need to specify your authorization token (which you received by mail after creating a new project - we also indicate it in the program code)



    Also, if your account was registered a long time ago, then you may have more energy, or you can buy in addition in the application - 1000 for 1 dollar.

    I got this widget, but it costs 3200-3600 (depending on the visual modules)


    And the last option with 6 timers is very convenient.



    I also add a table of bindings of virtual pins to BLYNK widgets



    Suppose to add another timer in the blink application, you need to add the Timer item, and set VIRTUAL OUTPUT V6 or V7 in the settings.




    The firmware with comments can be downloaded here: https://goo.gl/xuaZm9

    As well as how to add an ESP8266 nodemcu board to the ARDUINO IDE and flash it, it is described in detail here



    After all the manipulations, we load the sketch, first of all we connect the power to our system, wait 20 seconds and press the button to turn the auger for the test. If there is a reaction, then it is assembled correctly. Next, we launch the BLYNK application. First of all, we look at the status of the project - if everything is correct, then your feeder should appear on the network. After that, you need to set the time zone by clicking on the clock icon, and you can also immediately set the necessary timers. To synchronize the settings - press the "Timer" button in the on mode. If after a reboot (power failure) the timers do not work, you need to go into the application and press the "Timer" button to turn it off and on.



    July 28, 2015 at 02:28 pm

    Feeder for aquarium fish based on Arduino

    • DIY or DIY

    Summer is the holiday season. I was afraid that three weeks at sea would lead to starvation of the inhabitants of the aquarium, and since my mother-in-law went with me, there was no one to entrust the task of feeding the fish.

    After thinking a little about the problem, I decided to use the Arduino UNO, which was at hand, to make an automatic feeder. Fortunately, there was already a little experience in automation. And since the Ethernet Shield was purchased for the future, the idea arose of a terrible perversion: feeding control through a computer network. The fact is that at home I have a constantly turned on computer acting as a home server. It is connected to an uninterruptible power supply, and therefore there are high chances that even with short-term switching of the mains, the computer will meet us with the buzz of its fans, and for one it will descend to the control of this very feeder.

    The fact is that in the examples from the Arduino IDE development environment for the Ethernet Shield, a web server was found, some alteration of which made it possible to issue the state of all analog contacts in JSON format.

    A little experimentation with the query string in this web server made it possible to recognize URLs like:

    The last two I adapted to turn on and off the light in the aquarium, and the first - for direct feeding.

    Turning the light on and off is done by means of a relay module. I directly built this relay into a pre-purchased outlet. From all this, he subsequently made a small controlled extension cord.

    The hardest part was making the feeding station itself. It became obvious that during the holidays the fish goes on a diet from which frozen bloodworms are excluded, and eats only granules.

    Rummaged Runet in search of an acceptable design for hand-made production. The most acceptable was considered a rotating drum with food inside. At the same time, the drum has a slot through which the granules are poured out passing the bottom point. The most important thing at the same time is that this same drum does not accidentally stop in the “slot down” position, then the fish can have a “belly holiday”, and after a while the feeling that they live in a sartir instead of an aquarium. In short, there are problems:

    1. what to make a drum
    2. how to rotate it
    3. how to make it stop in time, making only one turn
    After rummaging through the toys broken down by my son, I found a decent, as it seemed to me, gearbox with a motor. Around which he began to collect the mechanical part of the feeder. The drum was an ordinary plastic jar of oatmeal jelly, which for some time the wife indulged in. But when I assembled the design and tried it on a standard five-volt power supply, I realized that the reducer had too little reduction, and the behavior of the entire system was somewhat reminiscent of a centrifuge. It was too lazy to remake for another gearbox and I decided to go the other way - by lowering the voltage. But the three-volt power supply too quickly rotated the drum. Specially bought even a 1.5-volt power supply. I was delighted, but my joy was not long, because. when checking the work in the "semi-combat" mode, i.e. when turning the feeder on and off through the relay, it suddenly turned out that after 20-40 cycles - the Chinese power supply was safely dead. I had to urgently buy a Motor Shield and use its wide capabilities to control the speed of rotation of the drum.

    At this point, two of the three problems went away, and I began to seriously think about solving the problem of exact stopping. A mechanical switch that would signal the passage of a turn seemed to me not a very good solution. I was confused by the additional mechanical load on the gearbox, which occurs only in one position of the drum. Therefore, I decided to use the system: LED + black mark on the drum + photoresistor. I took a photoresistor, assembled a voltage divider with it, and using one of the Arduino UNO analog inputs, I began to measure the voltage to determine the presence or absence of a label. The label itself was a small piece of electrical tape, and the backlight was organized by means of an LED powered through a resistor (to limit the current). Then there was a boring accumulation of statistics, with different degrees of illumination of the drum (the light in the room). I determined what values ​​are taken from the analog input, and set the threshold values ​​for the options “there is a label” - “there is no label”. So the last problem was solved.

    Then I tried the feeder with pellets and a slot, but in order not to feed the fish in advance, I carried out all the tests over a sheet of paper, where I not only determined the size of the slot (gluing it with fragments of adhesive tape), but also found out that some of the pellets wake up past the distance intended for this between two rails. I had to unpack the plastic packaging for some kind of cable and make something resembling brushes in an electric motor out of them, so that when the slot was raised, the feed would “shut up” with these transparent plates rubbing against the drum.

    As you already understood, the purpose of this device is not at all a well-fed fish life, but some test of oneself. And I decided to go further. In terms of software development. In the hardware, I only had the performer of three commands, but on the home server, I decided to keep some statistics. Since I am a web programmer, out of habit, I took the MySQL database and created two tables in it. I added the URLs and dates of requests to the device to one, wrote answers to the other, as a result I got statistics on whether the fish were successfully fed and what time the light in the aquarium turned on and off. (The fact is that the device gives a response only after execution commands. And it does not issue if something went wrong.) Remembering some of my skills in Java, I took the URL class and with it made all these three http requests to the arduino.JSON response was parsed by the library downloaded from json.org. approached rapidly, because there was not enough time for the remaining perversions, and I decided to run the control java software itself using the good old cron "a.

    It was in this form that the departure to the sea found both us and the fish. Three weeks later, we returned tanned and saw all our fish swimming around the aquarium merrily, and pretty well fed.

    August 8, 2017 at 09:43

    Arduino-Based Smart Automatic Pet Feeder - STEP 1

    • Microcontroller programming
    • tutorial

    In this series of articles, I will talk about my experience in assembling a "smart" automatic system for feeding a pet, in my case, a cat.


    I want to immediately note that at the first step we will only talk about the "automatic" feeder, and it will become "smart" at the next stages (if you're lucky, and everything goes according to plan).


    So, let's start with the concept and goals:

    1. Make a system that frees me from the obligation to feed my cat dry food (step 1)
    2. Equip the system with a weight sensor under the bowl and carry out feeding in accordance with the indications of the scales: if the bowl is empty, add it, otherwise, wait until the bowl is empty (step 2)
    3. Add a Wi-Fi module and a video camera to the system to transfer photos with your favorite cat, as well as provide remote control of feeding. In addition, collect data on how much the cat ate and build analytics (step 3)

    The first step does not require a large number of sensors and manipulators, one servo motor is enough (for example, Micro Servo Towerpro SG90 9 g), so all control comes from the ArdruinoUno board, which is ideal for this kind of tasks.


    Feeding systems in one way or another contain some container in which dry food lies, and a rotating mechanism that dispenses its amount. Having studied the experience of other "inventors", I would single out three main mechanisms:

    All the materials that I needed to assemble the feeder at the first stage:

    • Glass jar
    • Arduino Uno
    • MicroServo (I have an allowed rotation angle of 180, but it doesn't matter)
    • piece of plastic
    • magnets
    • pins for connecting the board to the servomotor
    • USB charging at 5V

    The logic of the mechanism is simple: a sector-type hole is made in the lid of the can (the center of the lid is not cut out), the same sector is cut out of plastic. A servo motor is attached inside the cover, for example, with adhesive tape. First, a cover is mounted on the engine axis, and a cut-out sector on the outside. So, when the axis of the servomotor is rotated, the cut sector is displaced relative to the hole in the lid of the can.


    Also, do not forget to make a hole for the output of the servomotor wire to the outside to connect to the board. At step 1, feeding occurs on a timer, my cat is not a glutton, so the sector opens once a day for a short time, below is the code for Arduino:


    #include #define servoPin 9 Servo myservo; void setup() //setup procedure ( myservo.attach(servoPin); //attach the drive to port 9 ) void loop() ( myservo.write(0); //put the shaft at 0 degrees delay(300); // wait 0.3 seconds myservo.write(160); //set shaft at 160 degrees delay(86400000); //wait 24 hours )

    To fasten the jar to the wall, I used these magnets, each 4kg (I think it's better to use more powerful ones). Magnets are attached to the jar simply with glue, and to the wall with screws.


    The board is attached to the bank with Velcro, it is convenient to remove and attach it back. Velcro is sold in any household, used for fastening pictures.


    Since my only external module is a servo motor, no additional power is needed, it is enough to power the board, it can be connected directly to the network via a 5V usb charger.


    Here's what it looks like when assembled:


    Below I have outlined a few ideas for the further development of the feeder, there are many of them and it is not yet clear what exactly will be done next, this part is for discussion.

    • installation of motion sensors, photographing the cat at the moment when it appears in the field of view. The integration of a weight sensor and a motion sensor allows you to determine when the cat is just walking past the feeder, and when he came to eat. Accordingly, you can tighten the analytics when the cat prefers to eat and how much.
    • you can add a weight sensor to the feed container itself so that the feeder determines the moment when it becomes empty and sends a warning to the owner that, they say, it is empty, it needs to be replenished. Then, as an option, add the possibility of auto-ordering food from your favorite site with delivery.
    • You can add the ability of the feeder to work for two cats:
      • Or it will be two different feeders, each of which can scare away a “strange” cat
      • Or is this one, but somehow modified
    • We need to think about how to implement a drinker and integrate it with a feeder, add a filtration system.

    I hope this will be useful to someone.