Close

The story so far...

A project log for Recycled IoT pet feeders

Upgrading 10 year old automated pet feeders with IoT functionality using an ESP32 microcontroler

bradley-austin-davisBradley Austin Davis 02/17/2022 at 21:120 Comments

As soon as I opened up the device I saw that this would be a relatively simple problem to solve.  The core functionality of the device is a motor that is connected via a drive band to some gears that turn the feeder mechanism and also open and close a simple switch, which provides logical feedback into how many scoops have been delivered.  

I only really had to worry about 4 wires... the two leads coming from the DC motor and the two leads coming from the sensor switch.  I spent a bit of time soldering new wires to the leads with pin ends so I could plug them into a prototyping breadboard and mess around with them.

I encountered some issues because I'm an electronics novice.  It took me a while to figure out that I was getting noise on the sensor GPIO input on the board because I needed a pull-down resistor to keep the pin from floating when the switch wasn't closed.  I also didn't really understand that you can't drive DC motors directly from logic pins and managed to partially fry the first ESP32 I was using.

The motor issue was frustrating because although I had quite a few stepper motor driver boards and a few servo driver boards, I didn't have anything for a single simple 2-wire DC motor.  I had to order those and they didn't arrive until today.  However, until now I've been settling for having the "enableMotor" function in my code turn on the built-in LED on the board and manually pressing the switch to simulate turns of the gear.  So I spent the time since starting and today working on getting the board to work with the AWS IoT services.  

The ultimate goal is to be able to say "Alexa, feed <PetName> 2 scoops" or "Alexa, feed <PetName> 3 scoops every day at 8 am" and have the correct one of the 3 devices spin the motor to deliver the correct amount of food at the correct time.

This morning for the first time I was able to actually wire everything together.  The motor is being driven by the 3 C batteries in the base on the right side.

I haven't yet wired it up to Alexa, but the device has it's own identity on my AWS account and after boot I can both send and receive messages from the AWS MQTT console.  Sending a message with a scoop count caused the device to turn the desired number of times.

Unfortunately my current approach requires that I create an explicit device in the AWS for each of the feeders and build a custom binary for each of them so that they would have individual certs and private keys.  Ideally I'd rather just have a single binary and have AWS automatically differentiate them based on something like the MAC address of the WiFi chip in them.  So I'm researching the AWS IoT functionality to see if that's possible and how to do it.

Additionally I've ordered some other ESP32 boards that come with cameras to see if I could set up remote monitoring functionality.  But getting closer to a working prototype.

Discussions