CatFeeder

This project builds an automatic feeder for cats (or other small animals). The goal is build a complete, DIY solution, from the fabrication of the container, to software are electronics. The feeder is managed using a web interface, so you can configure it from your home network. Doubles as WIFI AP (for standalone operation) or WIFI client (for home network integration).

This project provides:

  1. The fabrication of the container. You 3D print the parts using the STL provided.
  2. The software to control the feeder.
  3. The electronics schemas to connect all the parts.

Demo video on YouTube

Table Of Contents

  1. Project Features
  2. 3D Printing and Assembly
    1. Prototype
    2. CatFeeder
      1. Part list to print
      2. Printing times
      3. Assembly
        1. Mount the pins in the inner case
        2. Screw the base to the inner case
        3. Mount the axis motor and support
        4. Iron the wires to battery holder
        5. Build the 90 degree wires
        6. Wiring diagram
        7. Mount the UNL2003
        8. Mount the ESP8266
        9. Mount the cap
  3. How to install the Software
    1. Arduino Board Setup
    2. Configuration options
    3. Download the components to the Board
      1. Check for good compilation
      2. Download the FileSystem to the board
      3. Download the CatFeeder application to the board
  4. Configure CatFeeder
    1. Connect to the AP
  5. Using Catfeeder
    1. Calibration
    2. Configure Schedules

Project Features

  1. Fully printable container, so you can download the project, start your printer, and print all the parts. The STL are ready to print, so the orientation and tolerances are configured and tested.
  2. Managed using web interface. Catfeeder provides a WWW server that provides the following capabilities:
    • Network configuration. DCHP / Static / AP operation
    • Calibration
    • NTP client, so we manage the current time.
    • Configuration persistence (SPIFFS).
    • Detailed log of Catfeeder's operation, so you can check what happen.
    • Modern HTML / JS interface, AJAX based operation.
    • Easy, flexible schedule configuration for feeding your pets. No limits on this (only the number of slots).
    • Capable of communicate using a Telegram Bot (Experimental).
  3. Cheap to build. Based on standard hardware components:
    • ESP8266 Core on an NodeMCU LoLin v3 development board (about 7€)
    • Stepper motor: 28BYJ48 (5 motors about 6€)
    • Stepper motor driver: ULN2003 (5 drivers mounted on development board about 6€)
    • Printed on PLA
    • Some wiring cable (8 wires)
    • 4 allen screws (13mm)
    • 2 allen screws (6mm)
    • Powered on 4xAA batteries (6V)
    • 1 4xAA battery holder (5 holders about 4€)
    • 4 small screws to support the boards to pins
    • 4 pins to build the power connector
  4. Easy of operation:
    • Cap is removable so you can clean / add the meal easily.
    • The shape is designed to be "safe" for your cats. They can't bump it.
    • Schedule the meals using the phone or your computer easily.
    • With 1 meal/day, you can serve a full week.
    • Very quiet operation, due the stepper motor.
    • Can be calibrated easily, using the web interface.

3D Printing and Assembly

All the parts are designed on Autodesk Inventor 2019. I provide two models, CatFeeder the "production" one, and the Prototype useful to develop new features, or test things. Printed on a Creality Ender-3 Pro, with generic brand PLA. These are the CURA settings for all the parts printed:

Prototype

This prototype is not usable to feed pets, buts prints fast, and is used to check some mechannical interfaces (axis, motor coupling, etc.) The prototype is an easy asembly, build from three printed parts:

You also need:

CatFeeder

This is the production-ready CatFeeder parts. CatFeeder has a diameter of 190mm, and 650 of height. Each slots size 72mm x 90mm. It takes some time to print, so be patient. See the following diagram for more detail about measures.

Part List to print

You need to print this files (included in the Repo):

Printing times

part namecuantitycolorprinting time
motor axis1white00:45
base1green02:30
cap1white14:38
inner case1green16:15
motor support1white00:30
separator_battery2grey00:05
separator8grey00:10

Assembly

To assemble the CatFeeder, you need the following:

Mount the pins in the inner case

Parts:

Push the pins (separators) in their holes to support the boards. The two small ones are the battery separator (2mm) and the 8 are the ULN2003 holder and ESP9266 holder, that fits in the big holes. Push gently, and if you found too much resistence, file them lightly using a sharp knife. Also you can glue the pins to the base, but it shouldn't be needed.

Screw the base to the inner case

Parts:

Using the 4 long screws, screw the base to the inner case. File lightly the holes to ensure smooth fit.

Mount the axis motor and support

Parts:

Push gently the motor into the axis. The axis (long part) has two pockets. One big, one small. In the photo you will see the big one, used to hold the cap. Push firmly but not to hard. It should be fitted snugly.

Now, get the motor support, and align it with the inner base (bottom) The protuding triangles are designed to be fitted in the triangle pockets in the inner case. Once fitted the support, screw the motor to the inner case using the small screws. The support, the motor and the axis only have one way to be mounted.

Iron the wires to battery holder

Parts:

First of all, we need to "build" a connector for the power. Get a pin strip as the photo, and split two pairs of pins. Stack them, and iron the pins together using the wires. You will get something like the connector in the photo. Then, iron the wires to the battery holder. I usually iron the red one to the VCC (+) and the black to the GND (-).

Build the 90 degree wires

Parts:

I want to get a low-profile cat feeder, so I ended using 90 degrees cables to connect the ESP8266 and the UNL2003 motor driver, along the power supply. I get a standard female-female connection wire, removing the plastic cap (a needle or sharp cutter is useful to extract the plastic cap), add some thermoretractile (while the pin is still straight) and them, using the pliers, bend the end point to 90 degree. Apply some heat, and you have a 90-degree connection cable done. Repeat 10 times (4 wires for motor signals, 2 for power the ESP8266, 2 for power the UNL2003).

Wiring diagram

Wiring is easy. Just use the following diagram to connect the wires between power, ESP8266, UNL2003 and the stepper motor. I power the ESP8266 using 6V (4x1.5V) using the voltage regulator provided by the development board. See the subsections about UNL2003 and ESP8266 for detailed photos.

Mount the UNL2003

Parts:

Put the UNL2003 in their separators, and screw it to them using the small screws. I get these screws from iside a VHS video recorder found in the garbage. Plug in the motor connector in the white connector holder (it has only one valid position to insert it). Last, connect the wires using the following table.

UNL2003 NameColorESP8266 PIN
IN1YellowD1
IN2OrangeD2
IN3GreyD5
IN4  BlueD6
-Whitepower connector black
+Redpower connector red

Mount the ESP8266

Parts:

First of all, connect the wires coming from UNL2003 using the previous table. Connect the power cables to the GND2(black wire) and VIN (red wire) pins, and screw it to the separators. Last, plug all the power wires to the battery holder connector. You shold have all connected and ready to go. Don't forget to plug the Micro-USB cable to the ESP8266 in order to download the filesystem and firwware. The extra, unpluged wire in the photo is due a some test I was doing. Don't take it in mind.

Mount the cap

Parts:

First of all, remove all the support from the top of the cap. Use a sharp cutter. The cap has an axis that fits in the motor axis. This allows the cap to be removed to put the food, clean the inner case, etc. The cap fits easily in the axis holder. You are done!.

How to install the Software

CatFeeder uses FSBrowserNG as webserver. I forked it, to include some new functionality and fix some delay() calls that can't be used. You need the following libraries installed in your Arduino libraries folder.

Then, get the CatFeeder Repo and compile it using the Arduino IDE.

Arduino Board Setup

I use a NodeMCU LoLin v.3 ESP8266 board. You need some things in Arduino IDE in order to work:

Then add ESP8266 aditional library:

Now, You have to configure the Board options:

Configuration options

in catfeeder.h you find the following defines:

in motorstepper.h you find the pin-to-wire mapping:

Download the components to the Board

Check for good compilation

First of all, open catfeedercircular.ino file in Arduino IDE and issue a Verify to check that everything compiles (libraries, and so on). When you have a valid compilation, then you should have a log output like this:







If you have some error, it has been a missing library, probably.

Download the FileSystem to the board

Go to Tools->ESP8266 Sketch Data Upload. This put all the files in the flash partition of the board.









Download the CatFeeder application to the board

After that, you have all the files in the flash, and the last step to get the thing working is Download the CatFeeder sketch. Before this, If you want to comment out the debug output, you should edit FSWebServerLib.h:24 and uncomment the following line:









I recommend you leave the log enabled, so you can check that everything starts, the mac address, etc. Ok, it's time to download the sketch. If you upload the sketch from Arduino IDE, you should see something like this in the output window:









Now, open the Serial Monitor window you will see the debug information and some useful stuff:









This errors are ok the first time:









The interesting lines are:









You have the mac address, if you need to add them to the Wifi MAC filter, and the configured IP for the AP (Access Point).

These mean that the CatFeeder schedule configuration /catfeeder.json file is not found, and the WIFI configuration file /config.json hasn't been found too. This is due that a fresh installation doesn't create this files, and force the CatFeeder to start as Access Point to enable configuration. The board starts in this mode if it can't found the configuration files, or it can't connect to the configured WIFI (see FSWebServerLib.h:27, by default it waits 60 seconds #define WIFI_CONNECT_TIMEOUT_TO_AP 60).

Configure CatFeeder

Connect to the AP

The AP SSID if build using CATF and the CHIPID (e.g. CATF1563415). So search this WIFI in your device (e.g. mobile) and connect to this WIFI. Then point you web brower to <a target="_blank" rel="noopener noreferrer" href="http://192.168.1.1">http://192.168.1.1</a> and you should see something like the following:

Main

If you want to add the CatFeeder to your home network, do the following. Is not required to operate the CatFeeder, but it is easy to manage it. To add CatFeeder to your home network, click on Network Settings

Network

And now, configure the SSID, your password the IP for the CatFeeder (I suggest you not to use DHCP and put a high one, e.g. 250, and the gateway). Remember to add the MAC address in your router table if your filter MAC addresses, beforeadding CatFeeder to the network. If everything goes fine, you should connect to your AP and be able to ping the device from your home network.

Net

CatFeeder connects to NTP server to get the time. If you want to specify a nearby NTP server, go to Network Main Page, then click on NTP Settings and fill the following form:

NTP

Using CatFeeder

Calibration

First time you should calibrate it. After assembly it, the CatFeeder should be calibrated, but you can fine tune it. Go to System Administration, and click on System Calibration

SysAdmin

So in this window, use the arrows to move the cap so the slot 1 is open. Check the marks in the inner case and the cap so they are aligned (centered). Press Start when you're ready. After getting catfeeder calibrated, you can check in the bottom menu if the system moves to the specific slot. After check it, press Restore to move the CatFeeder to the slot #1

Calibration

Configure schedules

In the main page, press Schedule button. CatFeeder has 8 slots, and 7 programs (the first slot is open, so you can leave it with food the first time to your pet, but this doesn't count as program.). The slot number and the programs are not related, but if everything starts on 1, it's easy and clear. Use the Clear button to clear one program, Reset All to clear all at once. To select when the program run, just insert a date and a time using the calendar provided. Note that programs are run in time order, not in schedule order. When you're done, press Save. CatFeeder starts to work, and move to the next slot if it have a program. Easy. If you want to check the logs, click on Stats button in the main page.

Schedule

Hope you enjoy CatFeeder!