Introduction: Kitty Candy Cannon
Kitty candy cannon
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 candy to your cat. As you can see in the videos Harry is as excited as me to finally see this thing in working order. Ungrateful cat... You'll need a 3D-printer or order the parts printed to make this project.
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.
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.
Step 1: Electronics Box
Glue the servo holder and the axle in place. When the glue is dry, screw the servo in place. The indent with the slots are for holding the trigger button.
Step 2: Base
Glue the servo holders and rotator in place. When the glue has dried you can screw the larger servo in place. When you put this on the axle on the electronics box you can add the wire going from the box's servo to the rotator.
Step 3: Cannon
Attach the motor axle to the motor and slide it in place. Put the spring on the firing pin guide and add shims if necessary. Insert the guide in the firing pin, compress it and push it in place. Hold the trigger axle in place, add some glue and push the axle studs in. Also glue the lifter anchor in place. You'll need a piece of at least 1,5mm thick wire to attach the lifter servo to the anchor on the cannon.
Step 4: Reloader
Slide the magazine in place and attach a rubber band from the magazine to the reloader base. Push the magazine catch in place. The catch will keep the magazine in position when the servo moves back to reload. Insert the magazine pusher in the servo attachment and screw that onto your servo. Then screw the servo in place
Step 5: Lego Wiring
- GND: Ground wire – 0V
- C1: Control 1 - 9V when in forward
- C2: Control 2 – 9V when in reverse
- 9V: Power wire – 9V always
If you've got an extension wire, just cut it in half and solder breadboard connectors to both. You'll need one for connecting the battery box, and one for the motor.
For the battery box you use the 9V (red) and GND (blue) wires, so insulate both control wires (green).
For the motor you'll use the control wires so insulate the GND (blue) and 9V (red) wires.
Step 6: Arduino Wiring
I used a motor shield so the motor goes to the shield's A1 and A2
connectors. The battery box goes both to the motor shields power input and the power rail on the breadboard to feed the servos. Make sure the motor shield jumper is set to use external power.
The 4xAA battery box goes in the arduino
Step 7: Code
The only thing you'll have to modify in the code is the positions of the servos. All positions are set at the top of KittyCandyCannon.ino. The positions will need a little triming in when you attach the servo arms.
My cannon was placed on a shelf so it only shot to the left. You can alter that setting to your preference.
I hope you enjoy this little project, it was a fun construction! Sadly my cats does not care :D