Feed Your Pet From Anywhere in the World! a Pi Pico W Powered, Telegram Interfaced Pet Food Dispenser
by Areeeeen in Circuits > Raspberry Pi
113 Views, 1 Favorites, 0 Comments
Feed Your Pet From Anywhere in the World! a Pi Pico W Powered, Telegram Interfaced Pet Food Dispenser


I'm Areen Phaltankar studying in 12th grade at mastermind high school.
Ever dreamt of feeding your pet back at home while on vacation in Venice? Or maybe you were late for work and forgot to feed your cat? Look no further, for i have made just what you are looking for (and you can make it too!)
This Instructable will show you how to make your own dispenser which you can modify based on your size requirements.
the dispenser can be accessed from ANY device that can run telegram regardless of what internet connection it is connected to
Supplies
- anywhere from 100 to 300 grams of 3D printing filament depending on your size requirement
- 1x Airtight container in which a wide slit can be made at the bottom
- 1x Raspberry Pi Pico W or 2W
- 1x SG92R servo motor (or any 3 pin servo which can run on 3.3v)
- 1x USB-A to micro-usb cable
- 8x M2.5 screws
- A device that can run Telegram
- super-glue
Setting Up the Telegram Bot

- Open the Telegram app.
- Search for BotFather.
- Start a chat with BotFather and type /newbot.
- Follow the instructions:
- Give your bot a name.
- Give it a username (must end with bot).
- BotFather will give you a Bot Token.
- Save this token safely – you’ll need it later in code.
To find your Telegram Chat ID,
- Search for userinfobot in Telegram.
- Start the chat, and it will immediately show your Chat ID.
Setting Up Arduino IDE and Uploading the Code
- Open Arduino IDE.
- Go to File → Preferences.
- In "Additional Board URLs," add:
https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
(if there are other links seperate each link with a comma(,))
- Then go to Tools → Board → Board Manager and search for "Raspberry Pi Pico / RP2040".
- Install it.
The Code

when flashing the pico for the first time, press and hold the BOOTSEL button on the pico while plugging it in to the computer
- enter your own WiFi ssid, password, botToken (which you got from botFather), chatID (which you got from the userinfobot)
- download the .zip library file from here → pico RTC library and import it to the code (refer to https://docs.arduino.cc/software/ide-v1/tutorials/installing-libraries/)
- upload the code to the raspberry pi pico W
P.S check the serial monitor while the pico is still connected to the computer in case of errors
Downloads
The Circuit


the electronics part only consists of a Raspbery Pi Pico W and an SG92R servo motor.
PICO→SG92R
3v3 → POWER
GND → GROUND
GP5 → DATA
Modifying the 3D Design

this step shows you how to change the dimensions of the dispenser to fit your needs
Substep 1.1: Open the files provided, in fusion 360
Substep 1.2: Click on the MODIFY button in the ribbon near the top of the screen
Substep 1.3: In the menu pop-up, click on Change Parameters
you will see a table of dimensions and their corresponding values. Change these values as per your need. (refer to the video below)
MAKE SURE THAT CHANGES MADE IN ONE FILE ARE REFLECTED IN THE OTHER
Modifying the Container


the main part of the dispenser is the storage box that will store the pet food. This project uses a container you can get on amazon for pretty cheap.
in the parameters table of the BOX.pet_food_dispenser.f3d you will find dimensions labelled : slot_length, slot_distance, container_width.
based on these dimensions, make the slot at the bottom of the container as per the directions given in the image above
the model i have made uses a container with dimensions 19.5 x 13 x 19 cm.
Assembly







when the parts are all done printing, you need to use super glue to stick a few parts together (printing the entire model in one go would have introduced alot of supports which would have been a hassle to remove all of)
- align the shute/slope part with the slot at the bottom of the box and stick it
- stick the legs parallel to each other at either sides
- fit the servo motor into the holder provided
- screw on the flap to the servo motor. NOTE: let the fit be loose for now
- align the flap inside the gap of the shute and stick the servo holder to the side of the shute (refer to the video)
- place the pi pico into the cavity at the bottom of the shute, and screw it on using 4x M2.5 screws
- screw the top on using another 4x M2.5 screws (I used tape cuz i didnt have the required screws :/ )
Powering the Dispenser


Either a power-bank or a wall outlet with a charger adapter can be used to power the dispenser
First Start Up
go back to the message sent by BotFather on telegram. It should have included a link to access the bot. Click on that link, and it will lead you to a new text channel with the new bot.
Click on start and text it /help to see all commands.
NOTE: The reason i had asked you not to screw the flap too tightly, was because everytime the pico turns on, it will recenter the servo. So let the code run, and when it stops moving after a second, rotate the flap so it fits in the gap of the shute. This way you can center the flap without needing to know which direction the servo is pointing!
ALSO NOTE: I dont own a pet, so i wasnt sure of the correct time the flap should be open to dispense the right amount of food. this can easily be changed in the code i provided to better suit your needs.
the following commands have been implemented
1. /feed small – Dispenses a small portion of food.
2. /feed medium – Dispenses a medium portion of food.
3. /feed large – Dispenses a large portion of food.
4. /schedule [size] HH:MM – Set a schedule for automatic feeding (24 hr clock):
• /schedule small HH:MM – Schedule a small portion at the given time.
• /schedule medium HH:MM – Schedule a medium portion at the given time.
• /schedule large HH:MM – Schedule a large portion at the given time.
5. /schedule pause – Pause the scheduled feeding.
6. /schedule resume – Resume the scheduled feeding.
7. /schedule status – View the current schedule and whether it is active or paused.
8. /help – Display this help message again.
Demonstration

the commands i run in the video are:
- /feed small
- /feed medium
- /schedule small 11:43
How It Works

the priority of mine when i started building this project was to make it usable from anywhere, and not restrict the connectivity to a common WiFi access point. I first took to hosting my own cloud server but soon realized it wouldnt be financially viable. I then thought about using a pre-existing cloud server which specializes in point to point connection with a cloud server intermediary. I was using WhatsApp one day and realized that it was exactly what i needed. After researching about how bots would work on such platforms, i decided to bring my project to telegram since it had a much better support for user-defined bots.
You can access your Telegram pet feeder from anywhere in the world because the Pico W connects to the internet and communicates with Telegram’s cloud servers. When you send a command through the Telegram app, it travels through Telegram’s global network to reach your device, wherever it is, as long as it has an internet connection. Telegram acts as a bridge between you and your feeder, bypassing the need for complicated networking setups like port forwarding.
The telegram bot gets commands from the user, which are sent to the pico W.
I hope you enjoyed my first Instructable and hope you will come back for more soon :)