This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com) For this project we were required to build a project using both 3D printing and the Arduino kit that we got at the beginning of class.

A full list of the parts can be seen by going to

http://makecourse.weebly.com/arduinokit.html and http://makecourse.weebly.com/additional-kit-components.html

The requirements of the project were that it needed to use the Arduino to make it move in some way, and that there had to be some interactivity with it, in other words, there had to be some human input in order for the project to do something, nothing that you could just turn on and leave alone without any input. So I decided to make a tank turret that is controlled via an IR remote.

Step 1: Parts and Materials

So for this project several different parts need to printed out in order to build the physical components of the tank. The number of each are as follows:

Axle X 2

Barrel X 1

Base X 1

Turret X 1

Wheel X 4

I've included the .stl files so that they can be printed out.

And these are all the electronic components that you need from the Makecourse kit:

Arduino Rev3 X 1

USB to Arduino connection cable X 1

Mini breadboard w/ power rails X 1

Breadboard jumper wire kit X 1

Stepper motor X 1

Motor drive module X 1

IR receiver X 1

10k ohm resistor X 1

4 pin IIC cable X 1

Any IR remote you have available X 1

Other miscellaneous materials:

Bottle of Krazy glue

60 grit sandpaper (depending on how parts print out)

Something to twist the turret (I used a guitar pick that had a hole through it)


You will need to make sure your computer can run the Arduino software in order to upload the code through. You can download the Arduino software at https://www.arduino.cc/en/Main/Software

Step 2: The Prints

All the .stl files that were included are in inches, so if your 3D printing software requires metric or automatically converts to metric, then you will need to convert (I had issues getting my prints because of this). Once you get the prints, any supports or support strips will need to be removed (usually a fingernail is is good enough to get them off). However, I left the supports on the wheels to give them a look of treads.

Check to make sure all the mechanical parts have enough freedom to move - the turret should be able to rotate freely through the hole in the top of the base, the axles should be able to rotate in the holes on the side, and the axle should be able to fit through the hole in the wheel.

Any assembly of the mechanical components should wait until after the electronics are assembled and mounted.

Step 3: The Electronics

It's a good idea to assemble the electronics before mounting them to make sure everything works. And some of the specific wiring with the Arduino could be changed in your code if you wish. But here's how I did it:

  1. Be sure to connect the USB cable to your Arduino to upload your code.
  2. Connect the 5V and GND pins of the Arduino to the red power rail and blue power rail of your mini breadboard, respectively. This allows you to have multiple wires that can receive 5V and multiple places that you can send the ground of circuit parts to.
  3. Connect the motor drive module to digital pins 8-11 on the Arduino. The module will have pins that stick out, these will fit into the digital pins.
  4. Connect the stepper motor to the motor drive module. The stepper motor will have notches on it that will tell you which way to plug it into the motor module. The module will have grooves on the side where the notches go.
  5. Connect the 4 pin IIC cable to the motor module. The module will have 4 pins sticking out where "5-12V" is printed. The two pins where those are connected will be your power and ground for the motor. The other two pins just need to be wired together.
  6. Connect the other two pins of the IIC cable to the 5V and ground power rails. The first cable where you plugged it in on the module will be your 5V, the 2nd will be your ground. The other two just need a wire to connect them.
  7. Connect the IR receiver to the breadboard so that each of the three pins is on a different line. All the connections with the IR receiver are going to be with respect to the round part facing you.
  8. The left pin of the IR receiver should be connected directly to the 5V rail.
  9. The middle pin should be connected to the ground rail directly.
  10. The right pin needs a resistor connected in series with the 5V rail. Then after that is connected, a wire running after the resistor should be connected to digital pin 2 on the Arduino.

Once you have the code up and running, be sure to check and make sure the wiring was done right! The two most likely mistakes are how you connect the IIC cable and how you connect the IR receiver. Check with the picture to make sure everything's right!

Step 4: Code

Arduino code is all based on the C++ language. In order to use both the stepper motor and the IR receiver, you will need to download the two included libraries and put them in the "libraries" folder under your Arduino programs. Once you do that, you can then use this code to operate your tank.

#include "StepperAK.h" //includes library for Stepper motor<br>#include "IRremote.h"  //includes library for ir remote use
#define gearratio 64   // gearratio of the stepper motor
const int stepsPerRevolution = 2048;  //how the stepper motor is geared down
int recvpin = 2;        //defines output pin of the ir remote to be digitialpin 2
IRrecv irrecv(recvpin); //IRrecv class comes from IRremote.h library
decode_results results; //allows Arduino to decode results from remote to simple numbers
Stepper myStepper(stepsPerRevolution, 8,9,10,11);  //starts 4 wire stepper on digitalpins 8-11
                                                   //Stepper class comes from StepperAK.h library
void setup() {
irrecv.enableIRIn(); //start receiver
Serial.begin(9600); //begin serial communication so you can see what your remote puts out with certain buttons
myStepper.setSpeed(0.15*gearratio);  //sets the speed so that stepper works without locking up, which happens with higher speeds
void loop() {
  if (irrecv.decode(&results)){     //IR remote decoding
    Serial.println(results.value);  //prints the results of the IR decoding so you can see numbers
    irrecv.resume();                //which is how your change it to fit your remote
      if (results.value == 1168){ //This is the volume+ on my remote
        myStepper.step(12);       //You can change this to fit different buttons or different remote
      }                           //using the serial monitor
      if (results.value == 3216){ //This is the volume- on my remote
  delay(20);                      //Delay helps the motor not freeze up from too much input at once

You will have to change the parameter of the if statements in order to use whatever IR remote you have available. All you have to do is open the serial monitor and choose buttons. The serial monitor will display the value the remote inputs. Then just swap those values you obtain for the ones in the if statements in the code. Then your IR remote will work too!

Step 5: Assembly

The steps for this process might take a little bit to figure out the wiring and the configuration. You might have to do things slightly differently depending on how your prints turned out. But here's how I did it.

  1. The breadboard is the first thing to be mounted into the base of the tank. Put some of the Krazy glue on the bottom, and make sure the breadboard is centered around the hole at the top where the turret goes, this is where your stepper motor will be mounted!
  2. All the wires coming from the breadboard to the Arduino should be fed up through the hole where the turret goes so they don't mess with the rotation of the wheels.
  3. Same goes for the wires for the stepper motor, feed them up through the turret hole.
  4. The rotating rod of the stepper motor should go squarely in the middle of the hole for the turret. Put some Krazy glue on the bottom and make sure it sticks to the top of the breadboard.
  5. Find your item for catching the stepper motor. Mine was a guitar pick, and I just glued it onto the bottom of the turret so that the center was right where the stepper motor.
  6. Glue the barrel into the turret using the Krazy glue. Be sure not to use too much glue or it'll get pushed out and dry up on the outside plastic and will be hard to remove.
  7. Fit the turret onto the stepper motor. No gluing was necessary for me, but if the object you picked to catch the motor is too big, then gluing may be necessary.
  8. Connect all the wires coming from the breadboard into their proper places on the Arduino or motor module.
  9. Check and make sure that the turret rotates before continuing.
  10. If not then check your connections. If so, then feed the axles through the holes in the side of the base.
  11. Attach the wheels to the axle using the Krazy glue.
  12. The Arduino will sit on the back of the tank, the turret should still be able to clear it all the way round.
  13. Check and make sure everything works on the tank.

If everything works then you should have a fully functional tank! Congratulations!

Ok, from a veteran tanker, you need to make whole of the tank larger, (1st one is ok, but all parts need to be inside), ... so that this could be a real possibility of becoming a warfare option, ... &amp; I love stuff that has the capability of making other stuff go B O O M !
<p>This is fun! I'd love to see a video of it operating once you put it together :)</p>

About This Instructable




More by jtsjr5086:Automated Tank Turret 
Add instructable to: