Kitty Candy Cannon

Kitty Candy Cannon

myminifactory

An introduction First off, I'm a novice at both CAD and Arduino. This was a project for me to learn a little of both. It's probably faster (definately cheaper) to just throw a candy to your cat.As you can see in the videos below, Harry is as excited as me to finally see this in working order. Cats... Test firing 1 Test firing 2 Instructions There's an attached pdf with the build instructions, and I tried including zipped files with the freecad documents but wasn't able to upload it. Find this thing on thingiverse if you want the source cad files :) The cannon The cannon has a magazine holding 9 candies. When the button is pressed a servo pushes the magazine forward, dropping a candy down to the trigger. Then it moves to a random horizontal and vertical position. When in position the motor rotates the axle pushing the trigger back until it fires. After firing it goes back to it's original position. Printed parts All stl:s are placed in the way they need to be printed for strength, detail and so on.I've tried to minimize the need for supports but some of the parts have to have them, and a few of the taller parts need a brim to stick to the build plate.The Reloader base has supports included in the stl so you'll only have to add a brim for that part. Just break them off when you're finished printing. Hardware What you'll need other than the printed parts are: ⦁ Arduino + wires⦁ Motor/servo shield⦁ Breadboard⦁ Lego 8881 battery box⦁ Lego 88003 L-motor⦁ Lego 8886 extension wire (for not cutting the original wire)⦁ 2 x micro servos (800g)⦁ 1 x standard servo (>4kg)⦁ 4 x AA battery holder⦁ Wire for servos⦁ Rubber band (for the magazine)⦁ 2 x 4mm nuts & bolts (for the cannon hinge)⦁ 10 x AA batteries⦁ Glue Arduino code #include <Button.h>#include <Servo.h>unsigned int buttonPin = 13;Button startStop(buttonPin);unsigned int motorPwm = 3;unsigned int motorDirection = 2;// Servo settingsServo vertical;unsigned int verticalPrevious;unsigned int verticalServoPin = 6;unsigned int verticalMin = 10;unsigned int verticalMax = 35;Servo horizontal;unsigned int horizontalPrevious;unsigned int horizontalServoPin = 5;unsigned int horizontalReset = 90;unsigned int horizontalMin = 10;unsigned int horizontalMax = 90;Servo reload;unsigned int reloadServoPin = 9;unsigned int reloadStart = 47;unsigned int reloadEnd = 5;void setup(){ startStop.begin(); pinMode(motorPwm, OUTPUT); pinMode(motorDirection, OUTPUT); // Attach and move servos to starting position horizontalPrevious = horizontalReset; verticalPrevious = verticalMin; vertical.attach(verticalServoPin); moveServo(vertical, verticalMin, verticalMin, 15); horizontal.attach(horizontalServoPin); moveServo(horizontal, horizontalPrevious, horizontalPrevious, 15); reload.attach(reloadServoPin); moveServo(reload, reloadStart, reloadStart, 15);}void loop(){ if (startStop.pressed()) { repositionAndFire(); }}void repositionAndFire(){ reloadCannon(); verticalPrevious = moveServoRandom(vertical, verticalMin, verticalMax, verticalPrevious, 15); horizontalPrevious = moveServoRandom(horizontal, horizontalMin, horizontalMax, horizontalPrevious, 5); fireCannon(); resetPosition();}void resetPosition(){ moveServo(vertical, verticalPrevious, verticalMin, 15); moveServo(horizontal, horizontalPrevious, horizontalReset, 15);}void reloadCannon(){ moveServo(reload, reloadStart, reloadEnd, 5); delay(1500); moveServo(reload, reloadEnd, reloadStart, 10);}void moveServo(Servo servo, int oldPosition, int newPosition, int speed){ moveServoWithDelay(servo, oldPosition, newPosition, speed);}int moveServoRandom(Servo servo, int start, int end, int oldPosition, int speed){ unsigned int newPosition = random(start, end); moveServoWithDelay(servo, oldPosition, newPosition, speed); delay(1000); return newPosition;}void moveServoWithDelay(Servo servo, int oldPosition, int newPosition, int speed){ newPosition = mapPosition(newPosition); oldPosition = mapPosition(oldPosition); if (oldPosition <= newPosition) { for (; oldPosition <= newPosition; oldPosition++) { servo.write(oldPosition); delay(speed); } } else { for (; oldPosition >= newPosition; oldPosition--) { servo.write(oldPosition); delay(speed); } }}void fireCannon(){ // Run motor to pull spring back and fire digitalWrite(motorDirection, LOW); analogWrite(motorPwm, 255); // Approximately one revolution of the trigger wheel delay(4100); analogWrite(motorPwm, 0);}int mapPosition(int position){ return map(position, 0, 180, 0, 254);}

Download Model from myminifactory

With this file you will be able to print Kitty Candy Cannon with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on Kitty Candy Cannon.