If you don't control the amount of food that your cat eats this may lead to overeating and overweight problems. This is especially true if you are away from home and leave extra food for your cat to consume on her own schedule. Other times you may realize that you forget to put her feed on time and impossible to go back home.
Diy automatic cat food dispenser can operate and dispense a precise amount of dry food any time you preset and can be controlled with your mobile phone anywhere in the world.
This project is a complete learning project from 3d printing to design in fusion360, from arduino programming to iot basics, electronics design in eagle to diy two sided pcb production.
Main chapters of this instructable are
Workshop: This part is not directly related to the actual production however may inspire readers with small real-estate. All design, 3d printing, pdb production, prototypes, electronic design, and manufacturing are done in a 2x2m workshop.
Prototypes: Perfect design is almost impossible to achieve. However, every -failed- design iteration brings new ideas, solves problems and carries design to a higher level. So, while an instruction set doesn't typically, include failed attempts, I included them briefly because they show the progress and rationale behind the final design.
Mechanical Design: Design of mechanics and container.
Electronics Design: This project is based on Arduino Mega board. A power unit, a clock unit, dc motor control unit, and ESP8266 wifi unit is assembled on a custom designed pcb board. You can find related Instructable here
Programming: Some basic Arduino programming. A little bit ESP8266 programming. A small web server has been created with the help of Arduino and esp8266.
Production: 3d printing all fusion360 designed parts and assembling them. Most of the parts are 3d printed. other then plastic there is one metal rod and several metal screws. Rest is electronics and a dc motor.
Step 1: Workshop
The workshop contains all the necessary tools for producing electronic circuits, pcb manufacturing, 3d printing, model painting, and some other small production works. There is a windows desktop computer which is connected to a 3d printer and also used for electronic music making.
Of course, more space is always better for a hobbyist. However, dense placement of tools and some clever tricks such as placing 3d printer above the computer monitors can create a workable and enjoyable workspace.
Although a workshop may never be the direct part of an Instructable It is worth to mention about it here as the main stage of the process.
Step 2: Prototypes
Duration of this project was completely underestimated. It started with an estimation of three to five weeks. It was completed in more than 40 weeks. Since I couldn't invest continuous time for this project I can not sure about the actual time spent on the project however I'm sure that every part of this project took more than expected.
I've spent a considerable amount of time on prototypes.
Prototyping started with Archimedes screws. This was also my first Fusion 360 project. I made and print at least 8 different screws while learning the great software called Fusion 360. (Fusion 360 is free software for hobbyists and while you can make fairly sophisticated things learning curve is not that steep) First ones were cut from the middle into two. I could not find a way to 3d print one vertical piece of screw. After printing two half, I glued them together which is a very inefficient and stalky way of making a archimedes screw. Then, I realized that if I add "fan ducks" to the printer, vertical printing quality improves. There are many different types of "fan ducks" so I had to find the best combination by trial and error. Finally, I ended up almost perfect archimedes screw printed as a one piece.
Another challenge was the design of the feed container. Liquids can be transferred by the screw without any problem. However, solid materials like dry cat food was a problem because of jams. I tried to create some safety space to prevent jams and also realized that addition of backward movement for every forward movement of the screw was decreased jams significantly. Half tube shape of final design and software controlled backward movement completely removed the risk of any jamming.
At the beginning of the project, I printed the whole box in the printer. Since the size of the printer was smaller than the size of the box, I had to divide it into pieces which made the box very weak and ugly. Then I considered a wooden box. Second prototype's walls were wood. Some production difficulties (I had no proper place and tools to cut and reshape wood) I decided to reconsider fully printed box for the third prototype (or final design). I made the design more efficient and smaller so that I could print it as one piece. Theoretically this approach was worked. In practice, printing big objects take too much time and any problem with the printer can destroy the end product any time even at the 14th. hour of the printing. In my case, I had to stop printing before it finished and had to design and print missing segment as an additional part. For the next prototype, I'm thinking to use plexi for the walls of the box.
I started with Uno. It was smaller and looked enough for my purposes. However, I underestimated software development complexity. Uno has only one serial output and since I was using that output for esp8266 communications I had no debug port for logging watching variables etc. and it turned out that without real-time debugging it was almost impossible to code even a small web service. I switched to Arduino Mega. (which changed the design of the box)
During development of the project, I tried almost every type of displays on the market including a small oled display. Each of them had advantages and disadvantages. Oled was nice but looked small and was expensive compared to overall design. 7segmet led displays were bright but little present little information. So, I used 8x2 lcd display for the final design. The future designs may contain no display or a bigger oled display which looks nice.
I put three buttons for controlling the device in the first prototypes. Then, I decided not to use them in the following designs because assembling them take time, I couldn't make them sturdy enough and they were adding extra complexity to the usability of the device.
I made several electronics prototypes. Some of them were on the breadboard, some of them on a copper breadboard. For the final design, I made a custom pcb using a modified 3d printer. (here is the instructable for that project)
Step 3: Design the Plastic Parts
Step 4: Print the Parts
All 3d printer parts can be found here: https://www.thingiverse.com/thing:3269269
Be aware. Printing takes time. The outer box which is the biggest part may take up to the 14 hours to complete.
Archimedes' screw is the special part that you have to print vertically. You may need a good air blower (fun duck) in order to cool down melted filmanet as it flows out from the nozzle.
Step 5: Design Circuit and Make Pcb
PCB making for this project is described here.
EAGLE circuit design files are https://github.com/byucelyigit/catfeed
Most of the parts are electronics modules such as :
- dc motor control,
- display control,
- arduino mega
- power converter
There many different varieties of these modüles. Most of them have similar inputs/outputs so it will be easy to adapt current eagle design. However, some modifications may be needed.
Step 6: Write Software
You can find the complete code here.
This code may not work on some Arduino board definitions. I used Arduino AVR Boards 1.6.15. Newer ones did not work (or worked with some minor or major problems)
I also added some html sample code. Html pages can be used to test wifi connection capabilities of the device.
The device accepts simple html url commands. For example: to start feeding you can simply send "http://192.168.2.40/?pin=30ST" from the browser. (IP may change according to your local network settings) ın addition to starting and stopping the device, you can set time and set alarm using the same format with different params.
This html command is received by esp8266 and parsed by the software. Software acts as a simple web server. It executes commands and returns 200 if it is successful.
This method of control is not the most elegant way of controlling iot devices. Here you can find better ways of IOT communications such as MQTT. I'm planning to revise software to include a better protocol.
I used Microsoft Visual Code as editor. I started with Arduino IDE but switched to VSCode. I strongly advise that if you are to write code for more than 100 lines don't even think about using Arduino IDE.
Step 7: Assemble
Detailed assembly video and working prototype video is here