Recently while on vacation, we realized the lack of connection with our pet Beagle. After some research, we found products that featured a static camera that allowed one to monitor and communicate with one's pet. These systems had certain benefits but lacked versatility. For example, each room required a unit to keep track of your pet across the house.
Therefore we developed a robust robot that can maneuver around the house and can monitor one's pet using the power of the internet of things. A smartphone app was designed to interact with your pet via a live video feed. The chassis of the robot is digitally fabricated as several parts were created using 3D printing and laser cutting. Finally, we decided to add a bonus feature that dispensed treats to reward your pet.
Follow on to create your own pet monitoring system and maybe even customize it for your requirements. Check out the video linked above to see how our pet reacted and to get a better understanding of the robot. Do drop a vote in the "Robotics Contest" if you liked the project.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Overview of the Design
To conceptualize the pet monitoring robot, we first designed it on fusion 360. Here are some of its features:
- The robot can be controlled via an app through the internet. This allows the user to connect to the robot from anywhere.
- An onboard camera that live streams a video feed to the smartphone can help the user to maneuver around the house and interact with the pet.
- An add-on treat bowl that can reward your pet remotely.
- Digitally fabricated parts that allow one to customize their robot.
- A Raspberry Pi was used to connect to the internet as it features an onboard wifi mode.
- An Arduino was used along with a CNC shield to give commands to the stepper motors.
Step 2: Materials Needed
Here is the list of all the components needed to make your very own Arduino and Raspberry Pi-powered pet monitoring robot. All parts should be commonly available and easy to find.
- Arduino Uno x 1
- Raspberry Pi (flashed with latest raspbian) x 1
- CNC Shield x 1
- A4988 Stepper Motor Driver x 2
- Picamera x 1
- Ultrasonic Distance Sensor x 1
- 11.1v Lipo Battery x 1
- NEMA 17 Stepper Motor x 2
- 5v UBEC x 1
- Wheels x 2 (the wheels that we used were 7cm in diameter)
- Castor Wheels x 2
- M4 and M3 nuts and bolts
The total cost of this project excluding the Arduino and Raspberry Pi is around 50$.
Step 3: Digitally Fabricated Parts
Some of the parts that we used in this project had to be custom made. These were first modeled in Fusion 360 and then were made using a 3D printer and a laser cutter. The 3D printed parts don't bear much load so standard PLA with a 20% infill works great. Below is a list of all the 3D printed and laser-cut parts:
3D Printed Parts:
- Stepper Holder x 2
- Vision System Mount x 1
- Electronics Standoff x 4
- Vertical Spacer x 4
- Chassis Reinforcement x 2
- Treat Bowl Lid x 1
- Treat Bowl x 1
- Rear Stepper Mount x 1
- Winding Disc x 1
- Bottom Panel x 1
- Top Panel x 1
A zipped folder containing all the STLs and laser cutting files can be found attached below.
Step 4: Attaching the Stepper Motor
Once all the parts are 3D printed, begin the assembly by mounting the stepper motor into the stepper holder. The stepper motor holder that we designed is meant for the NEMA 17 model (if one uses different steppers it will require a different mount). Pass the shaft of the motor through the hole and secure the motor in place with the mounting screws. Once done both motors should be securely held to the holders.
Step 5: Mounting the Steppers to the Bottom Panel
To mount the holders to the laser-cut bottom panel we used M4 bolts. Before securing them with the nuts, add the 3D printed chassis reinforcement strips and then fasten the nuts. The strips are used to distribute the load evenly on the acrylic panel.
Finally, pass the wires through the respective slots provided on the panel. Make sure to pull them all the way through to avoid them getting entangled in the wheels.
Step 6: Fitting the Wheels
The acrylic panel has two sections cut out to fit the wheels. The wheels that we used were 7cms in diameter and came with set screws that attached onto the 5mm stepper shafts. Ensure that the wheel is secured properly and isn't slipping on the shaft.
Step 7: Front and Back Castor Wheels
To allows the chassis to move about smoothly, we decided to place caster wheels at the front and back of the robot. Not only does this prevent the robot to tip over but it also lets the chassis swivel freely in any direction. Caster wheels come in all sizes, ours in particular came with a single pivoting screw that we mounted to the base and used 3d printed spacers to adjust the height so that the robot was perfectly horizontal. With this the base of the chassis is complete and has a good stability.
Step 8: Electronics
Once the base of the chassis is fully assembled, it's time to mount the electronics onto the acrylic panel. We have made holes in the acrylic panel that align with the mounting holes of the Arduino and the Raspberry Pi. Using 3D printed standoffs we elevated the electronics slightly above the acrylic panels so that all the excess wiring can be tucked away neatly underneath. Mount the Arduino and the Raspberry Pi to their corresponding mounting locations using M3 nuts and bolts. Once the Arduino is fixed attach the CNC shield to the Arduino and connect the stepper wires in the following configuration.
- Left stepper to CNC shield X-axis port
- Right stepper to CNC shield Y-axis port
With the stepper motors attached, connect the Arduino to the Raspberry Pi using the Arduino's USB cable. Eventually the Raspberry Pi and Arduino are going to communicate through this cable.
Note: The front of the robot is the side with the Raspberry Pi
Step 9: Vision System
The primary environment input for our pet monitoring robot is vision. We decided to use the Picamera which is compatible with the Raspberry Pi to feed a live stream to the user via the internet. We also used an ultrasonic distance sensor to avoid obstacles when the robot is functioning autonomously. Both sensors attach onto a holder with the help of screws.
The Picamera slots into its designated port on the Raspberry Pi and connect the ultrasonic sensor in the following manner:
- Ultrasonic Sensor VCC to 5v rail on CNC shield
- Ultrasonic Sensor GND to GND rail on CNC shield
- Ultrasonic Sensor TRIG to X+ end stop pin on CNC shield
- Ultrasonic Sensor ECHO to Y+ end stop pin on CNC shield
Step 10: Top Panel Assembly
On the rear of the robot is mounted the lid opening system for the treat bowl. Attach the mini stepper motor to the rear holder component and mount both the vision system and the winding system with M3 bolts to the top panel. As mentioned make sure to mount the vision system in front and the winding system at the back with the two holes provided.
Step 11: Top Panel Assembly
We 3d printed vertical spacers to support the top panel at the right height. Start by attaching the four spacers to the bottom panel to form an "X". Then place the top panel with the treat bowl making sure their holes align and finally secure it to the spacers as well.
Step 12: Lid Opening Mechanism
To control the lid on the treat bowl, we used a smaller stepper motor to wind a nylon string attached to the lid, pulling it open. Before attaching the lid pass the string through the 2mm hole on the lid and make a knot on the interior side. Then cut the other end of the string and slip it through the holes provided on the winding disc. Push the disc on the stepper then pull the string till it's taut. Once done snip the excess and tie a knot. Finally using a bolt and nut attach the lid to the bowl and make sure it pivots. Now as the stepper rotates the string should wind on the disc and the lid should gradually open.
Step 13: Setting Up the Cloud Database
The first step is to create a database for the system so that you can communicate with the robot from your mobile app from anywhere in the world. Click on the following link (Google firebase), which will lead you to the Firebase website (you will have to log in with your Google account). Click on the "Get Started" button which will take you over to the firebase console. Then create a new project by clicking on the "Add Project" button, fill in the requirements (name, details, etc) and complete by clicking on the "Create Project" button.
We just require Firebase's database tools, so select "database" from the menu on the left-hand side. Next click on the "Create Database" button, select the "test mode" option. Next set the database to a "realtime database" instead of the "cloud firestore" by clicking on the drop-down menu at the top. Select the "rules" tab and change the two "false" to "true", finally click on the "data" tab and copy the database URL, this will be required later on.
The last thing that you will need to do is to click on the gear icon next to the project overview, then on "project settings", then select the "service accounts" tab, finally click on "Database Secrets" and note down the security code of your database. With this step complete, you have successfully created your cloud database which can be accessed from your smartphone and from the Raspberry Pi. (Use the pictures attached above in case of any doubts, or just drop a question in the comment section)
Step 14: Creating the Mobile App
The next part of the IoT system is the smartphone application. We decided to use MIT App Inventor to make our own customized app. To use the app that we created first open the following link (MIT App Inventor), which will lead you to their webpage. Next click on "create apps" towards the top of the screen, thenlog in with your Google account.
Download the .aia file that is linked below. Open the "projects" tab and click on "Import project (.aia) from my computer" next select the file that you just downloaded and click "ok". In the components window, scroll all the way down till you see "FirebaseDB1", click on it and modify the "FirebaseToken", "FirebaseURL" to the values that you had kept a note of in the previous step. Once these steps are complete you are ready to download and install the app. You can download the app directly onto your phone by clicking on the "Build" tab and clicking on "App (provide QR code for .apk)" then scanning the QR code with your smartphone or clicking "App (save .apk to my computer)" you will download the apk file onto your computer which one can then shift to your smartphone.
Step 15: Programming the Raspberry Pi
The Raspberry Pi is used for two primary reasons.
- It transmits a live video stream from the robot to a web server. This stream can be viewed by the user using the mobile app.
- It reads the updated commands on the firebase database and instructs the Arduino to perform the required tasks.
For setting up the Raspberry Pi to live-stream, a detailed tutorial already exists and can be found here. The instructions boil down to three simple commands. Switch on the Raspberry Pi and open the terminal and enter the following commands.
- git clone https://github.com/silvanmelchior/RPi_Cam_Web_Interface.git
- cd RPi_Cam_Web_Interface
Once the installation is complete, restart the Pi and you should be able to access the stream by searching http://your Pi's IP address on any web browser.
With the live streaming set up, you will need to download and install certain libraries to be able to use the cloud database. Open up a terminal on your Pi and enter the following commands:
- sudo pip install requests==1.1.0
- sudo pip install python-firebase
Finally, download the python file attached below and save it on your Raspberry Pi. On the fourth line of the code change the COM port to the port the Arduino is connected to. Next, change the URL on line 8 to the firebase URL you had kept a note of earlier. Finally, run the program through the terminal. This program fetches the commands from the cloud database and relays it to the Arduino through the serial connection.
Step 16: Programming the Arduino
The Arduino is used to interpret the commands from the Pi and instructs the actuators on the robot to perform the needed tasks. Download the Arduino code attached below and upload it onto the Arduino. Once the Arduino is programmed, connect it to one of the Pi's USB ports using the dedicated USB cable.
Step 17: Powering the System
The robot will be powered off a 3 cell lipo battery. The battery terminals need to be split into two, where one goes directly to the CNC shield to power the motors, while the other gets connect to the 5v UBEC, which created a steady 5v power line which will be used to power the Raspberry Pi through the GPIO pins. The 5v from the UBEC is connected to the 5v pin of the Raspberry Pi and the GND from the UBEC is connected to the GND pin on the Pi.
Step 18: Using the App
The interface of the app allows one to control the monitoring robot as well as stream a live feed from the onboard camera. To connect to your robot make sure you have a stable internet connection and then simply type in the Raspberry Pi's IP address in the provided textbox and click the update button. Once done, the live feed will appear on your screen and you should be able to control the various functions of the robot.
Step 19: Ready to Test
Now that your pet monitoring robot is fully assembled one can fill the bowl with some dog treats. Open the app, connect the camera and have fun! We've currently been playing around with the rover and our Beagle and have captured pretty hilarious moments.
Once the dog overcame the initial fear of this moving object, it was chasing the bot around the house for treats. The onboard camera provides a good wide angle view of the surroundings which makes it fairly easy to maneuver.
There is room for improvement to make it function better in the real world. That said, we have created a robust system, to which one can further build and expand upon. If you liked this project do drop a vote for us in the "Robotics Contest"
Finalist in the