One of our friends recently adopted a senior dog called Jelly who suffers from separation anxiety. To help with training him when he needs to be left on his own, they asked us to make a wireless treat dispenser to go with the pet camera they already own. In the video, we demonstrate the principle with the help of Timothy, our rabbit.
Overall designThis treat dispenser is designed to hang from a wall hook and is controlled wirelessly over WiFi, via an app on the user's phone. There are 8 slots for treats, dispensed using a servo. These compartments might be large enough to hold food for a couple of days for smaller pets, such as hamsters or fish, especially with modifications. However, for our purpose, we only wanted to hold a few small dog treats.
YouTube VideoWatch how we built the device and see it in action in our video:
Case construction:Check out our Instructable for info on how we made the case: https://www.instructables.com/An-IoT-Pet-Treat-Dispenser-Using-the-Arduino-Nano-/
Our design involves a wider variety of manufacturing techniques than many readers will have access to, so we recommend altering the design to fit your experience and equipment.
Arduino wiring:The circuit in this project is very simple - connect the servo wires as follows:
- Red = Vin
- Brown/Black = GND
- Yellow/White = D9
In our case, we soldered these through to the Arduino via a piece of stripboard.
On your computer:Create an Arduino IoT Cloud account at https://create.arduino.cc/iot/
Create a new “Thing”.
In the Setup tab:Create the following 4 Cloud Variables:
- bool drop_treat - Read & Write - On Change
- int position - Read & Write - On Change
- CloudColoredLight rgb_light - Read & Write - On Change
- int treats_left - Read Only - On Change
Attach the Arduino Nano RP2040. If you haven’t used Arduino IoT Cloud before, you’ll need to follow the instructions to install the Create Agent software.
Set up your WiFi Name & Password.
In the Sketch tab:Copy the script from https://github.com/ChronovaEngineering/NanoRP2040_Pet_Feeder/blob/main/IoTCloud_Sketch
Paste this into the script editor, replacing any existing code, then click on the tick icon in the top left to verify the script.
In the Dashboards tab:Create a new dashboard & name it.
Check that you’re in edit mode (top left).
Click the Add button, then “Widgets” and create each of the following widgets, with the associated variable:
- Push Button: drop_treat
- Slider: position (Value range: Min = 0, Max = 180)
- Colored light: rgb_light
- Gauge: treats_left (Value range: Min = 0, Max = 8)
- [Optional] Sticky note for instructions
Rearrange the widgets as desired.
In Things -> Pet feeder -> Sketch:Plug the Arduino Nano RP2040 Connect into your computer USB port and click the Upload button.
Installation:Hang the treat dispenser in an appropriate location for dropping treats for your pet. Connect the Arduino to a power source using a MicroUSB cable.
On your phone or tablet:Download the Arduino IoT Remote app & sign in to your account.
Open the Nano Pet Feeder Dashboard and test that each widget is working as expected.
How to use:Press the "Drop treat" button to dispense a treat.
If a treat gets stuck, you can use the "Servo position" slider to manually rotate the servo.
The RGB light widget can be useful for debugging connection issues. It will change the colour of the LED on the Arduino to match whatever colour you select on the colour picker.
Comments