Sunday, September 20, 2015

Automatic Cat Feeder - Challenges

Below is an overview of the biggest challenges that I had when working on this project. FYI they're not listed in any kind of order.

Challenge #1 - The food dispensing system

My first challenge was what kind of mechanism to make to actually dispense out the food? My father-in-law helped me brainstorm about this and he came up with some pretty good ideas. The one I started pursuing was a system with a 4" diameter polystyrene coupling. I even had a couple of 'discs' laser-cut by Ponoko. They were both shaped like PacMan. One was going to be stationary and the other was going to be rotated by a servo or motor.

If you want to see a video demo of how this was a fail, check it out:
https://www.youtube.com/watch?v=Ic5kBQw_nG8

I did come up with the idea of having a small 'vibrating' motor inside of the cylinder, which is to 'agitate'/move the food so that it keeps dispensing instead of getting stuck. I believe this would have worked, but I was having too much trouble with mounting the motor properly centered, and what hardware to use to keep it mounted/stationary without being in the way of the food.

Shortly after I scrapped the idea, I came across this guy's homemade automatic cat feeder system. I loved it, so I based the dispensing system off of his. The actual dispenser is a commercial cereal dispenser. Oh, 1 more important requirement is that it had to be food safe.

Here it is mounted on my 'canvas':

Food dispenser mounted on the 'canvas'

(Note - I'm using the word 'canvas' to refer to the big piece of plywood)
(Note 2 - I use the word 'canvas' very loosely - I am in no way any kind of artist)




Challenge #2 - The food delivery system

This one was probably the 2nd most difficult (the first one was above) part of the project. If you saw the video in my Overview/Introduction post about this project, you may have noticed that I have 3 different food delivery systems in place. The first one was made of regular cardboard. I 'scored' the cardboard and bent/folded wings or rails. I had to play with different angles to make sure that the food doesn't 'bounce' out of the track. It seemed like no matter what I tried, food kept bouncing out. To prevent this, I made a cover much in the same way that I made the base part of the track. Here's what I started with:

Beginning of the first food delivery vehicle - before the cover

I have a generic 'L' bracket attached to the 'canvas' and one of the cardboard 'tracks' is resting on it, and I have a single machine screw with nuts to hold it securely on the bracket. The other track is attached directly to the 'canvas' with a couple of wood screws.

My 2nd method is utilizing a 'core' from a roll of vinyl that I brought home from work (I work at a sign shop so we are always tossing these cardboard tubes).

Vinyl core cardboard tube

As you can probably see, I attached this to my 'canvas' using a couple of carriage bolts (and accompanying hardware of course). On top of the tube is just a cut up plastic Listerine bottle, which just acts as a 'funnel'.

Side view to show a little more of the hardware

The last dispensing 'system' was done out of paper towel tubes, and the chopped-off/top part of a 2-liter soda bottle. The cut-up bottle also acts as a 'funnel' to catch all the food from the dispenser.

Paper towel tubes duct-taped together

I was a little weary about using these cardboard tubes as they're so small and thin, but it actually ended up working quite well. I probably didn't have to use any hardware to 'mount' it to my 'canvas' but I did anyway just to be safe. You see, it fit so tightly behind the 1st chute (the cardboard track), that it doesn't really move. However, I did use a couple of screws anyway:

Can you see the screw through the top hole? (It's too dark to see the bottom one, but there's one in there too)

The way I used screws was just cut a couple of holes out of the tube, drilled a small 'pilot' hole in the cardboard (and canvas of course), and screwed it in. Then I just put duct tape over the holes to cover it to make sure no food comes out:

Holes covered up with duct tape

The only other thing to show as far as the food delivery system is the bottom 'mouth' attachments:

End of the left and center tubes

You probably can't really tell, but for the one on the left, I took a piece of cardboard from a box of Mountain Dew Voltage, rolled it, cut it, duct taped it to the bottom of the vinyl core cardboard tube. For the one on the right in the picture (actually my center one), I just used more paper towel tube, cut a hole in it, duct taped it to the bottom of the chute.

I'm actually not finding any good pictures for the bottom 'mouth' part of the chute on the far right. I just made it out of the same standard cardboard, which I scored, folded, and duct taped.

One of the biggest challenges for all of these was getting it the right angle and the right length. I wanted to make sure that food won't get stuck in there, but didn't want the food to come flying out so fast that it wouldn't stay in the bowl. Additionally, I didn't want it to go too far over the bowl and get in the way of the kitties' heads. So it took some adjusting and testing, gut I finally got it working pretty well.




Challenge #3 - Stationary Bowls

Our cats tend to move their bowls all over the place...sometimes all the way off of the little platform. So my first idea of making the bowls stationary was to 'bolt' them down with a few holes in the bowls, a piece of plywood and some basic hardware:

1st method of keeping bowls stationary


A closeup:

Simple hardware - bracket, screws, washers, wingnuts

I used wingnuts because this is obviously a lot easier to unscrew by hand (as opposed to regular nuts). If nothing else, I knew this would be fairly easy to release the bowls so that we can wash them. Oh, and in case you're wondering why I am using a flathead screw (wrong kind of screw in this application), it's because I didn't have 'panhead' of the right size/length on hand.

Anyway, this seemed to work for a bit, but the screws got loose pretty quick (kind of like my head). I had to come up with something else. I'm not sure where I got the idea, but I thought if they had round (and tapered) bowls, I could make another little platform that would allow them to just 'drop in', so I headed to our local pet store, Petsmart. Found some nice round stainless bowls, so I got to measuring, measuring, then cutting. (Remember - always measure twice, cut once!)

This is what I came up with:

New platform


Side view with it propped up a bit:

Just showing how the bowl sticks down below the main piece of plywood,
but barely just under the entire 'height' of the plaform
I'm much happier with this - better bowls, stays stationary with no hardware, and very, very easily removable (and put-back-able)




Challenge #4 - Button issues

Below are the original buttons that I had put in place. I chose them because they're cheap, and easy to mount:

Original buttons

Well, I had major problems trying to get them to do 'double-click'. You see, I was wanting to have the buttons perform multiple actions - single-click to give the cats a 'snack', double-click to give the cats a bigger snack, and a 'hold' to continuously dispense food until letting go of the button.

I actually had already mounted the buttons before I got to that specific portion of the code. I tried other kinds of buttons and the double-click would work just fine in the code. The Arduino forum came to the rescue again. Someone suggested try using a different 'button handler' (my words, not theirs) - the 'OneButton' library. Well I did some tests with this library and the buttons worked a lot better. However, I had already implemented the 'other' button-handling code, and would have been a huge pain to re-implement the new code. (Remember, I'm a beginner at all of this)

Instead, I bought a couple new buttons and tested them out - they worked a lot better, so I decided to replace the really cheap buttons with not-as-cheap (but still pretty cheap) buttons since they work a lot better:

New/better/current buttons




Challenge #5 - Transferring the DS1307 chip

This was a bit of a strange one. It is purely an electronics problem. The problem is that, during development, I had connected everything up on a breadboard, so it looked something like this:

Circuit on a 'breadboard' (not the circuit for this project...just an example)


The main white rectangular with all the holes is called a breadboard. It allows you to build/prototype circuits, and is a common practice to use them while developing. During the creation of this project, I used a breadboard to build the different parts of the circuit (then finally combining them all).

Ok, so nothing unusual so far, everything worked great on the breadboard. The next step (for me) (I did not want to design an actual circuit board as I was not going to make multiple boards, or sell them.) is to 'move' (or recreate) the circuit on 'protoboard' (a more permanent substrate). An example of protoboard:

One kind of protoboard


Again, no problem, I've done this several times before. But wait a minute...the small chip (the DS1307 - the one that keeps the time) is going to lose power when I move it from the 'breaboard' and onto the 'final' circuit on the protoboard. Uh oh...we have a problem!

How do I move the chip from the breadboard to my actual board:

The eagerly awaiting chip holder on the actual board


Above you can see my mostly complete protoboard without the time-keeping DS1307 chip. Searching on Google gave me nothing. It's probably the search terms I was using. I did have a couple of ideas though. The first one was to build more onto my circuit - the parts that I would need to actually program the microcontroller directly on this board. You see, the way you 'program' the DS1307 chip is through another microcontroller...in my case, the Arduino. However, this seems like a waste of time and materials as I'll probably only ever do this 1 time (with this circuit). My 2nd thought was very 'hacky' but would be quick and fairly easy. The idea was to solder 2 wires directly to the chip (sitting on/in the breadboard), hook up a battery (temporarily) to the other end, remove the chip (with the wires and battery in-tow), insert the chip into the 'chip holder' (on the protoboard), desolder the wires, be done.

There was at least 1 possible problem with this approach, so I had to do a test. I was worried that if I had 2 coin cell batteries hooked up at the same time, the voltage would double and fry the chip. However, I was pretty sure that doing that would be fine because they would be hooked up in parallel (as opposed to series), which means that voltage would stay the same, but the run-time would double, which is fine. I did my little test with a couple batteries and my multi-meter, and confirmed my thoughts - it should be safe for the little guy to be transplanted!

Immediately after moving the chip from the breadboard to the proto board:

The chip still has the 2 wires soldered to it after moving the chip to the final board


A closeup:

The 2 wires still soldered to the 2 pins on the little chip


The completed transplant, wires removed:

The 2 wires have been desoldered


As you can see from the above 3 images, I followed the steps I outlined. Then I confirmed that the chip kept the time during this silly process - so we have a successful transplant! Now you can call me Dr. Nerd!

There you have it folks...my biggest challenges with this project and how I was able to overcome them. Hopefully this may help someone out there doing something similar.

Next up (and probably lastly for this project) we'll talk about the electronics.

Automatic Cat Feeder - Introduction/Overview



Completed Automatic Cat/Dog Feeder



Above, you will see my latest project - the Automatic Cat Feeder. It is Arduino-based, and built with various off-the-shelf hardware, and some parts that I modified.

How does it work? The Arduino is programmed to dispense food @ 5:15AM and 5:15PM for our cats' daily meals. The Arduino basically turns on the motors (1 at a time) to turn the food-dispensing paddle for a pre-determined amount of time to dispense the right amount of food. The food drops out of the dispenser and down the various chutes you see, and into the 3 bowls.

Before I go any further, I must give credit where it is due. First, I borrowed heavily from this guy for the actual dispensing system. Second, I had a couple of issues on the electronics side of things, but the great Arduino community over on the Arduino forums offered great advice to help get past the hurdles. Lastly, driving the motors was made very simple thanks to Sparkfun's motor driver board

Why I created it
Our cats like to be fed at consistent times of the day, and that's not always easy to do. For various reasons, we can't always feed them at the exact same times daily. Sometimes they may be fed hours later for dinner, and we feel really bad about this.

Now why didn't we just buy an off-the-shelf product? We looked into this and found that they were just too expensive, not very flexible, or were easily defeat-able, allowing the cats to gorge on the food whenever they please. I don't like the idea of an inflexible system that I have little to no control of (yes, I may be a bit of a control-freak). If I build my own, then I have complete control of it, so I can change it, add features, etc. myself.

Requirements
Before starting this project I had a few requirements in mind:

  • Must be food safe!
  • Must be reliable
  • Must cost less than comparable commercial feeders
  • Must be customizable
  • Must have some kind of audio notification to inform the cats that it's breakfast/dinner time

Is that asking too much? Nah

Ok, ok, I know you want to see a video of it in action, so here you go:




I had in my mind that I would build this with network connectivity to give us the ability to monitor/feed them remotely, but for a couple of reasons I didn't. First, this project already took me a long time to get everything worked out, and just wanted to get it installed for them. Second, an Ethernet Shield or Wi-Fi shield are fairly expensive ($35-$45), especially compared to the new ESP8266 (around $4) that's come out recently. I say recently because I actually started this project a couple of years ago. So why didn't I incorporate the ESP8266? I don't know how to use it just yet.

Ok, I'm sure some of you want to know just how much everything costed me. Price breakdowns are in the Bill of Materials (linked above), but the cost of everything was $190. Yes, that's expensive, and a lot more than I was anticipating. The 2 most expensive items were the motors (about $25/ea) and the cereal dispensers (also about $25/ea). That's $100!. Originally, I was going to come up with my own food dispensing system, which would have saved me over $50. Additionally, I feel that if I would have shopped around and done more research I could've cut the cost of the motors in half. As I'll talk about a bit in future posts, I got impatient and decided to just go the route I did.

Also remember that I'm feeding 3 cats with 2 different kinds of food...your situation may not be as complicated.

In conclusion, I wanted to let you know that there will be more info coming. In the next couple/few posts, I will go over some of the challenges I had with this project, hopefully saving you time in the future. I will also talk about the individual components in more detail (yes there will be videos). I'm not going to do a full tutorial like I did for my Garage Door Controller, but there will be some pretty good detail, hopefully enough for you to replicate if you want to.

Below are some links for you to use if you want to replicate this system, or parts of it.

Arduino code on GitHub
Fritzing file (actual .fzz)
Fritzing file, exported to .png image
Fritzing file, exported to .pdf file
Bill of Materials (Excel)
Bill of Materials (Open Office)

I haven't created a 'digital' schematic yet, but if/when I do, I'll update this post with the link to it.


Well, I hope you've found this post/project useful and/or interesting. Feel free to leave a comment if you have any questions/ideas/suggestions.


Want to know what the challenges I encountered, and how I overcame them? Well, that's exactly what my next article is about