Intro: Dog Treat Dispenser
This project is made using an Arduino and a Raspberry Pi controlled by Cayenne (cayenne-mydevices.com).
Basically, the raspberry pi sends a HIGH or LOW signal corresponding to the button state in Cayenne to the Arduino which reads the signal as HIGH or LOW. If the signal is HIGH it sets the servo to push toward the treats. If it reads LOW, then it will go back to the default position allowing more treats to fall down taking the place of the last one.
Step 1: What You Need and Connections
You will need the following items:
- Arduino R3
- raspberry pi 3
- servo motor
- 10k resistor (I used ten 1k resistors in a series because I didn't have a 10k on me)
- female and male wires
- some type of mechanism to dispense treats that uses a servo motor (3d printer would be VERY useful for this, or you could do my low budget design). Please feel free to make your own (and better) one.
The connections are pretty basic:
- GND -> Raspi GND
- GND -> Servo (brown wire)
- 5V+ -> Servo (red wire)
- D9 -> Servo (orange wire)
- D8 -> 10k Resistor (mine are ten 1kresistors in a series) -> Raspi GPIO 22
From Raspberry Pi
- GND -> Arduino GND
- GPIO22 -> 10k resistor -> Arduino D8
The Settings in Cayenne are in the picture above
And finally the code
For Arduino - http://pastebin.com/MXx3y6s6
Step 2: Finish
Now all you gotta do is load the treats and press the button!
The hardest part of this was getting a design to dispense the treats using a servo motor. I finally came up with one, but it isn't optimal. A 3d printer would be very useful in creating this project.