Introduction: Arduino Button Activated Treat Dispenser

For my Digital Multimedia class final, I created a treat dispenser that is activated by pulling a chain, which starts a servo motor that spins a wheel to dispense treats to my to African Grey parrots.

Step 1: Gather Materials

Materials you will need:

Order Online:
  • Creative Foraging SystemsGeneration II Wheel (Link here)
  • Servo - Generic High Torque Full Rotation, Standard Size (Link here)
Purchase at Radio Shack:
  • Arduino Uno
  • Standard wire
  • Button
  • Wire shrink tubing (optional)
  • Break away strip male headers
  • Soldering iron
Purchase at Home Depot:
  • Toilet flush lever
  • (1) 5/16in hex nut
  • (1) 5/16in hex head bolt
  • (1) 5/16in hex lock nut
  • (4) 5/16in washers
  • Spacers
  • Epoxy
  • Screen door rollers
  • Plastic box to contain everything
  • Some spare wood
  • Drill
  • Forstner drill bits
  • Saw

Step 2: Construct Button

1. Cut two strands of wire around 6in long.
2. Solder one of the ends of the wire to the connection points of the button.
3. Cover the soldering points with wire shrink tubing to protect the circuit from becoming accidentally crossed and shrink them using the side of your soldering iron.
4. If you're using the shrink tubbing, cut two more pieces and add them to each of the wires.
5. Solder the remain ends of the wires to a break away male strip header.
6. Shrink the tubing around your soldering points using heat from the side of the soldering iron.

Step 3: Construct the Servo Connector

Since the servo connector is a female wire connector with three inputs, you will need to construct a male wire connector with three outputs or you can buy one.

1. Cut three strands of wire around 6 inches long. Using three different color wires (black, white, and red) will help you later to tell each wire a part (ground, power, etc.)
2. Solder three ends of the wires to break away male strip headers.
3. Apply shrink tubbing to these connections.
4. If you're using the shrink tubbing, cut three more pieces and add them to each of the wires to be heated later.
5. Solder the rest of the ends of the wire to break away male strip headers and shrink the tubbing abound the soldering points.

Step 4: Connecting and Testing the Code

1. Connect your Servo ground wire to the ground (GND) on the Arduino board, the power wire to the 5V, and the control wire to pin 7.
2. Connect one end of the button to pin 4 and the other to another ground (GND).
3. Upload the code below to a new Arduino sketch and upload it to your board.

int button1 = 4; //button pin, connect to ground to move servo int press1 = 0; Servo servo1; void setup() { pinMode(button1, INPUT); servo1.attach(7); digitalWrite(4, HIGH); //enable pullups to make pin high } void loop() { press1 = digitalRead(button1); if (press1 == LOW) { servo1.write(1000); } else { servo1.write(1500); } }

Step 5: Building Instructions


1. Create a drive shaft by epoxying a 5/16in hex lock nut into the center of the wheel. Let the epoxy sit until it's COMPLETELY dry!
2. For the center pin, take the 5/16in hex bolt into the large black spacer and secure it with a nut. Then add a washer and another nut to the bolt.
3. Epoxy the six point servo horn to the top of the large black spacer and let it completely dry. This is how you will connect the servo to the bolt.
4. Now screw everything together and attach the servo.


1. While the epoxy is drying on the wheel parts, drill holes into the container box centered to where the wheel grips and servo will come through.
2. To make sure the servo is secured down, cut a piece of wood to sit inside the box with a gap cut through for the servo to sit in.
3. Secure down the Arduino board to the inside of the lid for easy access. I used Velcro stickers so the board could be removed and placed back easily.


1. Drill a small hole through the lever to run your button through and secure it.
2. Drill a hole into the lid of the box for your flusher to come through and secure it tightly. Make sure the button side is in the inside of the box.
3. When the lever is pulled up, the button will be pushed into the side of the box starting the servo. Once the lever is released, the servo stops.


1. I used a small, skinny scrap of wood with two screen door rollers screwed to each end to guide the pull rope.
2. On the end of the rope that will be on the inside of the cage I attached chew-proof wire and some whistles, which my birds like to play with. The other side of the rope os attached to the pull lever with a counter weight.

Step 6: Let Your Pet Enjoy

With some training, your parrot or pet should be able to learn that by pulling the the chain, they will receive treats!