I have a dog and I don’t want him to go hungry

Since we got our dog back in 2019, I’ve realised that an automated dog feeder would be beneficial to have. There’s some instances where both my wife and I have been out late and nobody has been home to feed our dog Bear. I looked for solutions I could simply purchased but all of them are simple crappy designs where there’s a plastic hopper on top and on a timer, a certain amount of food would drop into the bowl below. This design would not work for Bear as he would more than likely take on the challenge of destroying the hopper to get the food. Therefore, I decided to design one myself.

The requirements for the feeder are relatively simple:
– It has to be either automated or remote controlled
– It has to be battery powered (not plugged into a powerpoint)
– It can be ‘single use’ – Eg. One feed before having to be refilled and/or recharged
– It can be mounted high enough off the ground that Bear won’t try to destroy it
– It has to be relatively cheap and easy to make (as I’m no design or electronics wizard)

I had some chats with some people far smarter than I am about the design. Although a hopper with a revolving release (like those breakfast bar cereal dispensers) would be a good idea, I don’t want to deal with the design issues of it getting stuck or food getting stuck inside it. This needs to be fairly consistent and reliable.

I decided on essentially 3 physical components – A PVC Pipe (ideally with a screw top), a hinged trapdoor, and a block of wood to mount it to (so that the trapdoor can be square to the pipe).
As for the electronics, I wanted to save costs by reusing an old microcontroller I’d purchased as a kickstarter called NTC CHiP. It’s a really neat design in that it’s very small, has a large spread of GPIO pins, has built in WiFi and can easily run off a battery cell. This would then control a solenoid which would be holding up the trapdoor. Once the solenoid was activated and pulled away from the trapdoor, the trapdoor would swing open releasing the food.

Physical Components

I was able to get most of the physical components in one trip to Bunnings. The block of wood I liberated from a rubbish pile left after some bathroom reno’s. PVC pipe only came in 1M lengths, so I opted to use a PVC pipe fitting instead, which I could get in a smaller length. For the trapdoor I used some craft wood and the hinge is a simple door hinge. There will be a few other components required later on but this should do for a very initial prototype. Taking it home and putting it together, this is what I ended up with.

Getting the old CHiP back on deck

My initial expectation was that this would be the easy part of the project. I have no issues at all working with Linux or writing simple programs, but I found when booting the CHiP for the first time in what must have been 3 or so years, it would no longer boot. As it turns out, this is a common problem where the boot image on the flash degrades requiring it to be reflashed. Unfortunately, the easy flashing tool relies on NTC’s backend servers to pull the images… And when designing it, NTC probably didn’t think about the potential eventuality that they would go out of business.

Thankfully, the online community rallied and there are a number of scripts which make the manual flashing method much easier. Unfortunately, proper documentation around what to do when errors are received are few and far between. I initially tried the method written here but the image download from the US servers was way too slow (~24 hours). So after further searching, I found this method. This one was simpler, and required a linux machine to run it on. Luckily, I have an ESXi server in which I can easily deploy a linux VM and passthrough the USB. Little did I know however this would be the biggest pain point

Each time running the flashing tool, it would reboot the CHiP and wait for it to fastboot before copying over the final image. Frustratingly, at this step, it would fail every single time with a timeout error. Due to this, I move on to try this method as it was tried and tested recently with a specific ubuntu version. However after deploying the VM and loading up the scripts, I hit the exact same issue. I researched and troubleshot the issue for a decent part of a day until finally stumbling across the resolution.

When the CHiP reboots for fastboot, it’s USB ID changes. This means that it is no longer mapped to the VM via ESXi. In order to work around this, once the script shows “waiting for fastboot”, you need to edit settings on the VM and re-map the USB device in to the VM. Assuming it’s done before the timeout, the VM recognises the CHiP again and continues the flashing. This only occurs when the linux box is a VM, not baremetal installs.

With this successfully completed, the CHiP was back in action and I was able to continue with building the circuit.

Electronic Components

I’m certainly no expert with designing and building circuits but I’ve done some fairly simple ones before. Having done some research and having a think about it, I came up with the following circuit (I know it’s bad but it’s all a learning experience).

For the moment, the power supply is just 4x AA batteries in series. It’s not ideal but it makes testing very easy. I purchased the parts online and once they arrived began building it out on a breadboard. I first worked on it without the MOSFET so I could confirm the solenoid worked as expected. Once I had that part down, I moved onto adding the CHiP and the MOSFET. This is where I hit a few snags.