Introduction: Automated Pet Feeder

Today we're going to make an automated pet feeder so you no longer have to worry about them starving when you're outside the house for extended periods of time

We will be using python with nodemcu(esp8266)

Step 1: Material

What you will need:

  • Cardboard
  • Hot glue gun + Glue
  • Exato knife
  • Ruler
  • 3D printer
  • Cat food or skittles
  • breadboard (optional)
  • sparkfun sx1509
  • nodemcu (esp8266)
  • soldering iron
  • Wires
  • Buttons (x4)
  • LED (x6)
  • Servo (x1)
  • 9 Volt battery (x1)

Step 2: Construction:

The 3d model files for all of the components are provided along with the .stl versions for easy printing, but you can make almost all of them without a 3d printer.

Container (holds the food):

  1. Download our fusion file: there are two versions of each file, stl and f3d, use one or the other doesn't matter, stl is compatible with cura which is the 3d printing program we had to use to 3d print the tunnel part.
  2. While the hot glue gun is heating up, take the cardboard and measure out four trapezoids, cut 4 of them according to the measurements provided in the image above
  3. Glue the 4 trapezoids together from the sides so they form a square 2x2in opening in the bottom, refer to the 3d image of the final product at the top for a reference.

Keep in mind the container's shape and size doesn't matter as long as you have a 2x2in opening at the bottom to lead to the tunnel. So you can be creative with it.

Tunnel (allows the food to drop down and get dispensed):

  1. Download the tunnel.stl file and print it with a 3d printer
    1. keep in mind the stl file is in inches, so if your 3d printer software doesn't auto adjust the measurements to mm, the file will appear super small inside the program and you will have to select it and scale it up by 2540x to get it to appear in mm accurately in say cura for example

Slope (let's the food roll down into a bowl after the door opens):

  1. The slope can be made with cardboard, the measurements may be obtained by opening the 3d model files.
  2. you may make them with a 3d printer or with other materials by hand.

Door (attached to the servo, blocks the food from falling out until needed):

  1. You may make one yourself or download the 3d file and print it.
  2. the measurements for door are provided in the door image

legs (optional, supports the whole thing):

You make make the supporting legs however you'd like, they can be constructed after everything's put together so you may measure them how ever you like, the default measurements can be obtained by opening the 3d leg file in a 3d modeling program and using the measuring tool.

servo:

use the provided images to attach the servo to the tunnel and the door to the servo using hot glue.

Now hot glue everything together, use the main image of the finished product as a reference.

Step 3: Circuit

The LED's are used to signal which time setting the feeder is on, you may place them anywhere you'd like.

There are a total of 6 LED's, 3 are used for the amount of food that is dispensed, and 3 are used for setting the interval between feeding times

The buttons are used to adjust those settings, there are a total of 4 buttons, 2 increase and 2 decrease buttons.

The circuit must be wired as shown in the schematic picture provided in this section. Otherwise device won't function because the code is written for those pins specifically.

Step 4: Code

Download the python files provided.

To customize the 3 different time settings for each function open the final.py file and at the top of the file you should see where you can edit those, use the image provided as reference to find the respective lines.

Programming NodeMCU:

  1. install the ampy pyton plugin, follow the instructions in this link: https://learn.adafruit.com/micropython-basics-load-files-and-run-code/install-ampy
  2. put all of the files in a folder, call it "petfeeder" or something
  3. connect node to your machine (mac or pc) with a usb cable
  4. if youre on mac:
    1. open terminal
      1. navigate to the petfeeder folder inside of terminal using the cd command
      2. use these commands to put the files onto your node and run them once
        1. ampy -p /def/tty.SLAB_USBtoUART put io.py
        2. ampy -p /def/tty.SLAB_USBtoUART run io.py
        3. ampy -p /def/tty.SLAB_USBtoUART put crimsonbot.py
        4. ampy -p /def/tty.SLAB_USBtoUART run crimsonbot.py
        5. ampy -p /def/tty.SLAB_USBtoUART put final.py
        6. ampy -p /def/tty.SLAB_USBtoUART run final.py
        7. ampy -p /def/tty.SLAB_USBtoUART put final.py /main.py
    2. if you're on pc:
      1. open command prompt
      2. navigate to the petfeeder folder using the cd command
      3. use these commands to put files onto your node and run them once, CHANGE COM4 TO THE RIGHT COM
        1. ampy -p COM4 put io.py
        2. ampy -p COM4 run io.py
        3. ampy -p COM4 put crimsonbot.py
        4. ampy -p COM4 run crimsonbot.py
        5. ampy -p COM4 put final.py
        6. ampy -p COM4 run final.py
        7. ampy -p COM4 put final.py /main.py
    3. once the code is in there you will have your working pet feeder.
    4. to have it run independently of a computer, connect another wire from the positive (+) side of the battery to the 'vin' pin on the nodemcu, use the images provided as reference.
    5. then you will be able to disconnect the usb cable from the nodemcu and it will still run by itself.
First Time Author

Participated in the
First Time Author