Sunday, March 08, 2015

Kibble Cannon, Version 1

We play food games with our dog, such as hiding food in toys, or scattering it around the house. The idea is that if you put food in his bowl, it's gone in about 15 seconds. Playing food games makes it last longer, as well as providing entertainment for both him and us. But what if it could be automated? Then we could have the amusement without the effort, and we could also leave it set up for him while we are out. To this end, I propose the Kibble Cannon. It would fire pieces of kibble in random directions and at random times. In an ideal world it would make beeping noises and flash lights as well, though that's just for show.

As a first attempt at this, to see if this idea had any merit, I built little device consisting of a solenoid mounted on top of a servo. The solenoid is this one, driven much like this, with a TIP 120 and 2k2 resistor. I used a 12V supply. The servo is this one. There is a simple Arduino program to control it. It rotates the servo to a random angle, sends a short pulse to the solenoid and then waits for a little while:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Randomly set servo position, then fire, then delay.
#include 

#define FIREPIN 8
#define SERVOPIN 9
#define FLASHPIN 13
#define DELAYMIN 500
#define DELAYMAX 2000
#define FIRETIME 50

Servo servo;
 
void setup() {
  pinMode(FIREPIN, OUTPUT);
  pinMode(FLASHPIN, OUTPUT);
  randomSeed(analogRead(0)); // Read unnattached pin to get a random seed.
  servo.attach(SERVOPIN);
} 
 
void loop() {
  int pos = random(181);
  servo.write(pos);
  digitalWrite(FLASHPIN, HIGH);
  digitalWrite(FIREPIN, HIGH);
  delay(FIRETIME);
  digitalWrite(FIREPIN, LOW);
  delay(random(DELAYMIN, DELAYMAX));
  digitalWrite(FLASHPIN, LOW);
} 

You can see an example of it in action here. I am assisted in this video by my chief test engineer. The mechanical construction is a prototype: I used a couple of paperclips to hold the solenoid to the servo's disc, and slipped a piece of cardboard under the solenoid to make a platform for the piece of kibble. It will fire the kibble 2-3 feet.

Several things need to change. First, I think I need a solenoid with a longer travel or a higher acceleration, to fire the kibble further. A smoother launching platform, say a piece of rigid PVC tubing, would help. Next, I need a way of loading pieces of kibble onto the firing platform automatically. I will aim to address this in a future version.

No comments: