Software apps and online services
Hand tools and fabrication machines
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:
- The fabrication of the container. You 3D print the parts using the STL provided.
- The software to control the feeder.
- The electronics schemas to connect all the parts.
- 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.
- Managed using web interface. CatFeeder provides a WWW server that provides the following capabilities:
- Network configuration. DCHP / Static / AP operation
- 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).
- 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
- 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.
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:
- Layer Height: 0.2
- Wall Thickness: 0.8
- Top/Botton Thickness: 0.8
- Top Layers: 4
- Bottom Layers: 4
- Infill: 20%, Lines
- Printing temperature: 195 ºC (for your PLA brand, may vary)
- Build plate temperature: 70 ºC
- Speed: 40 mm/s
- Cooling: Enable
- Fan Speed: 100%
- Enable supports: Everywhere
- Build Plate adhesion: None
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:
- 6 female-female pin-to-pin cables (4 for motor wires, 1 for vcc, 1 for ground)
- 4 AA batteries
- A battery holder with two male pin soldered (to enable the connection)
- A ESP8266 Board
- Mini-USB Cable (to power the ESP8266 and check the serial debug)
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.
You need to print this files (included in the Repo):
part namecuantitycolorprinting timemotor axis1white00:45base1green02:30cap1white14:38inner case1green16:15motor support1white00:30separator_battery2grey00:05separator8grey00:10Assembly
To assemble the CatFeeder, you need the following:
- All the parts printed
- ESP8266 Core on an NodeMCU LoLin v3 development board
- Stepper motor: 28BYJ48
- Stepper motor driver: ULN2003
- Some wiring cable (10 wires)
- 4 allen screws (13mm)
- 2 allen screws (6mm)
- 4xAA batteries (6V)
- 1 4xAA battery holder
- 1 Micro USB cable to download the firmware
- An allen driver to screw the allen screws (nº 3)
- An Iron to solder the battery holder wires and build the 90 degree wires
- 4 small screws to support the boards to pins
- Separators (8 big, 2 small)
- Inner Case (bottom side)
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.
- Inner Case
- 4 Screws (10mm, allen)
Using the 4 long screws, screw the base to the inner case. File lightly the holes to ensure smooth fit.
- Motor Axis
- Motor Support
- 2 Screws (6mm, allen)
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.
- Battery Holder
- Two wires (about 10cm each one)
- 4 pins to build the connector
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 (-).
- Simple female-female connection wires (10)
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 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.
- Inner case
- UNL2003 Motor Driver
- 6 wires (4 for signals, 2 for power)
- Motor connector
- 2 small screws
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 PININ1YellowD1IN2OrangeD2IN3GreyD5IN4 BlueD6-Whitepower connector black+Redpower connector red
- Inner case
- 4 wires coming from UNL2003
- 2 wires for power
- 2 small screws
- Micro-USB cable
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.
- Inner case fully assembled
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!.
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
- my FSBrowserNG's fork. See the original page for more info. Depends on:
- ArduinoJson-5.x (the 5.x branch)
- my Universal-Arduino-Telegram-Bot's fork. See the original page for more info.
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:
- First install the serial driver, if not installed before, for your platform CH340G Driver
Then add ESP8266 aditional library:
- Go to
Preferences, add in
Additional Board Manager URLsthe following URL: http://arduino.esp8266.com/stable/package_esp8266com_index.json
- Restart The Arduino IDE.
- Go to
Tools->Board->Board Managerand search
ESP8266 by ESP8266 Communitylibrary and install it (I use version
- Install the ESP8266FS Flash filesystem tools form Arduino. Uncompress package inside
- Install Exception Decoder ESP8266. Not really needed to install the software, but can help you to troubleshoot some things if fail. Uncompress package inside
- Restart the Arduino IDE.
Now, You have to configure the Board options:
NodeMCU 1.0 (ESP-12E Module)
- Upload Speed:
921600(If you can't connect at this speed, check the cable or select a lower speed)
- CPU Freq:
- Flash Size:
4M (2M SPIFFS). This is importart. If you don't do select that, you can't flash the FileSystem.
- Debug port:
- Debug Level:
- IWIP Variant:
v2 Lower Memory
- Erase Flash:
- Port: Your USB port.
catfeeder.h you find the following
#define CATFEEDER_SLOTS 8number of slots. If you use the provided STL, leave in
String CATFEEDER_CONFIG_FILE = "/catfeeder.json". The configuration options.
- `String LOGGER_FILE = "/catfeeder.log". The log file where things are stored.
motorstepper.h you find the pin-to-wire mapping:
const int motorPin1 = D1; // D1 (GPIO14) IN1 black
const int motorPin2 = D2; // D2 (GPIO12) IN2 white
const int motorPin3 = D5; // D5 (GPIO13) IN3 blue
const int motorPin4 = D6; // D6 (GPIO15) IN4 red
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
Tools->ESP8266 Sketch Data Upload. This put all the files in the flash partition of 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).
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
http://192.168.1.1 and you should see something like the following:
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
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.
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:
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
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
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.
Hope you enjoy CatFeeder!