Exploring Smart Home IoT with an Alexa-powered Cat Feeder

Alexa has the power to do so much more than control lights and temperature

Darian Johnson
A Cloud Guru
4 min readFeb 5, 2017

--

Why a cat feeder? Well, my family owns three cats; for the most part, they are well behaved — unless they are hungry.

One of the less explored features of the Amazon Alexa platform is her ability to control our physical world. In Alexa’s first year of existence, most of her interaction with our homes was limited to lights and thermostats. More recently, we’ve started to see new and more relevant Alexa-controlled smart home devices — ovens, refrigerators, washing machines, coffee makers, entertainment hubs, and on and on.

Amazon Alexa’s Smart Home Integration (amazon.com)

As a full time technology consultant, and a part time maker, I wanted to explore this ecosystem myself. To do that, I leveraged the AWS IoT platform to build an Alexa-controlled cat feeder.

Cat Feeder Overview

Why a cat feeder? Well, my family owns three cats; for the most part, they are well behaved — unless they are hungry. When it’s time for them to eat, they get a little crazy — constantly meowing and running under/between our legs, or waking us up at night.

We used to keep extra food in their dishes, but they would just overeat — resulting in cat throw-up (which, without fail, I seemed to step in every morning on my way to the kitchen). My oldest daughter suggested that we (and by we, she really meant me) build an automated cat feeder. I told her that I didn’t have the time to build one… but then, I figured, why not give it a try.

Video demo of the Automated Cat Feeder

The Cat Feeder is built from a number of components:

  1. An Alexa skill that controls the device (by translating my user requests into commands that are sent to the physical device via MQTT)
  2. A dry food dispenser connected to a Raspberry Pi — used to received the messages and control the device
  3. A camera with image comparison logic to determine if the cat food bowl is full or empty.
  4. An ultrasonic range sensor — used to measure the food in the hopper.
  5. A servo — used to turn the paddle wheel and dispense the food
  6. Amazon Dash Replenishment Service (DRS) logic to re-order cat food when my supply was low.

Cat Feeder Interaction Flow

Alexa, ask Cat Feeder to feed the cat four ounces.

Step 1: The user asks Alexa to feed the cat four ounces of food.

Step 2: The Alexa skill is called, which interacts with code/logic in AWS to obtain the specific serial (or topic) ID assigned to the cat feeder.

Step 3: The Skill sends a message using AWS IoT to feed the cat 4 ounces. The Skill also obtains:

  • the amount of food stored in the hopper (using the ultrasonic sensor)
  • The current state of the cat food bowl (empty, 50% full, 100% full) using the camera and image comparison logic

Note: these actions are represented in Step C. State of the hopper and food bowl is updated every 15 minutes.

Step 4: AWS IoT sends a message to the Cat Feeder to dispense 4 ounces of food. The Cat Feeder Raspberry Pi spins the servo for 4 seconds to dispense the food.

Step 5: In parallel, the Skill calls Amazon DRS APIs to send the slot status (the “slot” is the cat food amount). If an order is needed, then the DRS Replenishment API is called as well (to place an order for new cat food).

Step 6: Dash Replenishment takes action if needed (to order more cat food)

Step 7: Alexa responds to the user with confirmation that the food has been dispensed.

  • If the hopper is empty, Alexa tells the user to refill the hopper.
  • If the cat food bowl is full, Alexa asks the user to confirm feeding the cat
  • If a previous DRS order was cancelled, Alexa tells the user that a new order will be placed in 5 days
  • If two consecutive orders were cancelled, Alexa tells the user that a replenishment ordering has been suspended and will not be enabled until the Cat Feeder hopper is refilled.

Summary

As you can see, leveraging IoT logic with Alexa opens the door to a number of smart home capabilities. It will be interesting to see what is developed and released over the coming months.

The details on how to build your own Cat Feeder can be found on Hackster on my project page that includes build instructions and code.

Darian Johnson is a technology consultant with deep experience implementing complex software architectures and leading large-scale software delivery programs. He currently works for Accenture as a member of their Amazon Web Services practice.

Darian has always enjoyed researching new technologies, so he eagerly used the tools and templates provided by the Alexa team to learn about skill development. His first skill combined his passion for fitness with his interest in machine learning. His Mystic Mirror skill won second place in Alexa’s Internet of Voice challenge on Hackster.io.

--

--

Darian Johnson
A Cloud Guru

I’m a Technology Architect. A Husband. A Dad. A Maker. A Music Lover. A Fitness Enthusiast. A Christian. Opinions/posts my own and do not represent my employer.