Top Logo Sp Logo
Smart Pet Bowl: a Raspberry Pi 4 Beginners Guide | Vilros

Smart Pet Bowl: a Raspberry Pi 4 Beginners Guide | Vilros

Smart Pet Bowl: a Raspberry Pi 4 Beginners Guide | Vilros

Do you have a pet? If so, this is the perfect project for you! With just a Raspberry Pi and some simple electronics, you can make your own smart pet bowl. This project is easy to do and will make your life as an owner much easier. In this blog post our Guest Blogger Sim Bhamra will discuss how to build your own smart pet bowl using the Raspberry Pi 4!

Building a product from scratch can be daunting. The idea of creating something that will enhance the lives of others is both inspirational and terrifying at once, with no clear path to follow. I found this experience refreshing because it was my first time building an app like this in every aspect: design up to the front-end presentation for users! In today's blog post, I'll outline how you too could make your own version of my smart pet bowl project using some resources readily available online!

 

Project Overview 

So, what exactly is the smart bowl? 

The smart bowl is a device inspired by my own two dogs, it tracks the dogs eating habits as well as when you fill up the bowl to provide comprehensive data about when your dogs eat and how much your dog eats.


Outline

The general technical outline to the smart bowl includes four primary modules: (1) the physical device, (2) the worker and driver, (3) API/ REST interface, (4) the front-end web interface. See below for a high-level architecture diagram:


The physical device consists of a Raspberry Pi 4, HX711, 5kg load cell, breadboards, jumper wire, two wood planks, nuts, bolts, screws, a thick plastic box, and a steel bracket. The steel bracket, nuts, bolts, screws, wood planks, and plastic boxes were used to create the actual body of the smart bowl. 



The HX711 microcontroller converts the analog stress signal (weight) from the load cell into a stream of bytes which the Pi receives on pins 5 and 6. The second portion of this project takes the reading from the HX711 microcontroller and creates something readable to use for the API in the third portion. For this portion, I used HX711 driver code provided by Tatobari to read in data from the load cell into the Pi. With this read-in data I created a worker.py file which calibrates, scales, interprets, and records data to achieve this I used Scipy and MatPlotLib. The now interpretable data is then ready to be sent off to my SQLite database. 

The SQLite database along with the Flask app make up the third portion of the project, which creates a simple REST API to serve the web client. For this, I used Flask, SQLAlchemy, Marshmallow, and CORS to create a basic Flask application. The Flask app I wrote then creates classes to share with the SQLAlchemy ORM which is turned into JSON by Marshmellow and is ultimately exposed as an event endpoint API for my frontend web interface to get data from. 

The front-end web interface is created using React along with Chakra UI and Plotly to provide the user something friendly and easily interpretable to look at. 






Conclusion

In short, this was an exciting project and it certainly allowed me to explore areas that I had not before.  Now you have the roadmap on how to build a smart bowl. Try to build your own and make sure to tag me in the results on Instagram (@simkbhamra)!  Before you get started, leave a comment and let me know what you think and feel free to reach out with any questions. 


Happy building. 


Open Source Tools and Libraries Used 

HX711 driver code: https://github.com/tatobari/hx711py

Numpy: https://numpy.org/

MatPlotLib:https://matplotlib.org/

Scipy:https://www.scipy.org/

Flask: https://flask.palletsprojects.com/en/2.0.x/
SQLAlchemy: https://www.sqlalchemy.org/

Marshmallow: https://marshmallow.readthedocs.io/en/stable/

React: https://reactjs.org/

Chakra UI: https://chakra-ui.com/

Plotly JS: https://plotly.com/javascript/

Leave a comment

* Required fields

Please note: comments must be approved before they are published.