Anyone who has ever had the honor of serving a feline overlord knows how important it is to keep your master properly fed. One of the most important issues when dealing especially with cats that choose not to leave their mansions is to provide them with just enough nutrition. Not too little and not too much. SmartBowl allows every modern cat servant to monitor the food consumption of their overlords. This is important as a fat overlord may quickly turn into an overlord with diabetes or even a dead overlord... And the life of a servant without their master is, well... Pointless... The additional SmartBowl Refiller makes sure that your master will not starve to death when you go to work and forget to fill the Bowl with food. So all in all, it's a life-saving gizmo.
SmartBowl could also be useful for dogs although due to its size, it is currently more suited for cats.
The SmartBowl is basically a load cell with an HX711 amplifier and a ESP8266 that constantly measures the weight of the contents of the bowl and periodically reports the amount remaining, consumed and added to a special web service via WiFi. The Service is a RESTful service, written in Java 8 with Jersey and the Mustache template engine. It runs on a Tomcat 8 application server hosted on Amazon Elastic Beanstalk. The data can be retrieved from the Service either as raw CSV data or visualized on a HTML dashboard page that contains a mixed line/bar chart created using D3 JavaScript library. The SmartBowl can work without the Refiller. Then it serves only as a monitoring tool.
The Bowl's enclosure is a plastic food container placed on its lid. I've cut open a circular(ish) opening in the container's bottom just big enough to let in a metal bowl. The bowl rests on one end of the load cell, while the other end is mounted to the container's lid. I've used a metal angle bar from an Eitech construction set to stabilize the load cell as the lid is made from a rather soft plastic and tends to bend.
The load cell is a slightly over-sized aluminum bar with the weight range between 0 and 1 kg. I couldn't find a smaller one which is a bit unfortunate as this project does not need such a broad weight range and the measurements would surely be more precise if the cell's range was between 0 and 100g, for example. The load cell is connected to the SparkFun Thing via a HX711 amplifier. I've soldered both the Thing and the amplifier to a small perforated board that I have later attached to the lid with small screws.
The SparkFun Thing is powered from a 3.7V LiPo battery. The Thing is well suited for working with this kind of batteries so I only needed to solder a pair of right-angled gold-pins to connect the power source. The board has its own power switch so I didn't even had to connect my own switch (although a switch on the Bowl's enclosure would be quite useful).
SmartBowl Refiller is an add-on to the SmartBowl that stores cat food and can refill the Bowl when it is empty. The Refiller is controlled by the SmartBowl. It's basically a simple valve mechanism driven by a small servo. The food is stored in an inverted sports drink bottle. The transparent housing is an inverted plastic food container. Its relatively thick walls make it a rigid structure and allowed me to easily install various components of the device, like the on-off switch, by simply drilling holes in the walls and mounting the components with screws.
I have cut a circular opening in the top of the container and glued the cap of the bottle into it. Next, I have cut an opening in the cap itself. This way, the bottle can be easily attached and detached by simply screwing it onto the top of the container.
The slide that makes the food fall out of the side of the container instead straight down was made of another sports drink bottle. I've cut an opening in the side of the container and mounted the slide using a piece of metal from an Eitech construction set and some screws. The valve is simply a metal axis from Eitech with a PET "flower" at the top that blocks the food from falling through the opening and onto the slide. The servo pushes the axis up via a simple leverage mechanism and thus opens the valve.
The servo is a standard Tower Pro SG-90. It is powered from a single-cell LiPo battery with a capacity of 2500mAh. The battery delivers a voltage of 3.7V which is not enough to power the servo reliably so I've used a 5V step-up voltage regulator to provide reliable power.
Setting up the device is rather straightforward:
- Fill the Refiller's bottle with cat food
- Attach it to the body
- Put the Refiller besides an empty SmartBowl
- Connect the two devices with a two-wire cable
- Turn on the Refiller
- Turn on the SmartBowl
- Hope that nothing blows up...
Of course, the SmartBowl has to be first programmed to connect the the local WiFi network and send data to an existing SmartBowl Servce. The Service can support a number of devices, hence every SmartBowl needs to have a device ID and use it whenever it sends or retrieves any data to or from the Service. The device ID, the Service URL, the local WiFi SSID and password are currently hard-coded into SmartBowl's firmware.
The Service provides access to three resources:
- Data Sets
- Dashboards
- Configurations
The Data Set is simply a time series of data uploaded by a single SmartBowl device. It can be downloaded in full as a CSV file. The file will contain five columns:
- time - a time-stamp with date for a given data entry
- amount - grams of food remaining in the bowl at the time of data upload
- consumed - grams of food consumed since the last data upload
- added - grams of food added since the last data upload
- refills - the number of refills since the last data upload
Dashboards are HTML pages with D3 charts that depict last 24 hours of data from a given data set in a graphic manner. They also contain some aggregate values like total amount consumed and total amount added.
Configurations are data entities that describe different SmartBowls. Every Bowl has an ID, a display name, a timezone and a daily food ration in grams. After every data upload, a SmartBowl will query the Service for the amount of food that it can release before the end of a given time period (currently, 24 hours: midnight to midnight). It will receive the amount in grams and a number of seconds till the end of the current time period.
SmartBowl is still in a prototype stage, has many shortcomings and is undergoing constant modifications. However, it does have a potential for becoming a useful gizmo. Brace yourselves, the Internet of Cats is coming...
Future improvements:- Make the Refiller wait for the cat to leave before releasing another dose of food - the release is rather abrupt and scares the animal
- Improve the transmission of servo's torque - currently the force applied to the valve is insufficient if the bottle is more than half-full
- Create a database persistence layer - storing data in memory is good only for the prototype phase
- Create a UI for device and data set administration
- Add support for HTTPS
- Add notifications when both the SmartBowl and the Refiller are empty
- Add a battery level indicator
- Make it possible to recharge the batteries inside the devices
- Replace the Thing with a slower MCU and a breakout WiFi module - this should allow better power management
- Add a third wire from the SmartBowl to the Refiller that will make it possible to control power delivery to the servo.
- Improve weight scale precision and reliability.
Comments