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:
- Hot glue gun + Glue
- Exato knife
- 3D printer
- Cat food or skittles
- breadboard (optional)
- sparkfun sx1509
- nodemcu (esp8266)
- soldering iron
- 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):
- 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.
- 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
- 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):
- Download the tunnel.stl file and print it with a 3d printer
- 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):
- The slope can be made with cardboard, the measurements may be obtained by opening the 3d model files.
- 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):
- You may make one yourself or download the 3d file and print it.
- 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.
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.
- install the ampy pyton plugin, follow the instructions in this link: https://learn.adafruit.com/micropython-basics-load-files-and-run-code/install-ampy
- put all of the files in a folder, call it "petfeeder" or something
- connect node to your machine (mac or pc) with a usb cable
- if youre on mac:
- open terminal
- navigate to the petfeeder folder inside of terminal using the cd command
- use these commands to put the files onto your node and run them once
- ampy -p /def/tty.SLAB_USBtoUART put io.py
- ampy -p /def/tty.SLAB_USBtoUART run io.py
- ampy -p /def/tty.SLAB_USBtoUART put crimsonbot.py
- ampy -p /def/tty.SLAB_USBtoUART run crimsonbot.py
- ampy -p /def/tty.SLAB_USBtoUART put final.py
- ampy -p /def/tty.SLAB_USBtoUART run final.py
- ampy -p /def/tty.SLAB_USBtoUART put final.py /main.py
- open terminal
- open command prompt
- navigate to the petfeeder folder using the cd command
- use these commands to put files onto your node and run them once, CHANGE COM4 TO THE RIGHT COM
- ampy -p COM4 put io.py
- ampy -p COM4 run io.py
- ampy -p COM4 put crimsonbot.py
- ampy -p COM4 run crimsonbot.py
- ampy -p COM4 put final.py
- ampy -p COM4 run final.py
- ampy -p COM4 put final.py /main.py