In this Instructable I'll show you how to make a very small smartphone controlled arduino tank.

I tried to make the TinyTank as small as possible, I also wanted to control it with a smartphone.
At least I wanted to make it easy to disasemble so I can try out other controls like IR and 2.4GHz.
I will explain stap by stap how I made it and I will share the code and schematics so you can make it to.

I came up with the design myself.

Step 1: What You Will Need

2x 9g fullyrotational servo. Here is my Instructables for that: Fullyrotational-Servo
1x Bluetooth module (hc-06)
2x 5mm white LEDs
2x 5mm red LEDs
1x Arduino nano
1x Perfboard (at least 31x24holes or 15x49 holes)
3x aaa batterys to power the TinyTank
1x Boost module (3,5/4,5volt - 9 volt)
1x A little gun or something simular(optional) I have mine from an old rc helicopter I think.
2x 100 ohm resistors
1x 1K ohm resistor
1x 47 ohm resistor
1x BC547 (NPN) Transistor or simular
about 56x small lego tracks
4x 26 tooth LEGO gears
2x lego part: 4526985
2x lego part: 4512363
2x lego part: 4142865
2x lego part: 4206482
1x small switch
3x little springs
1x passive buzzer
Some wires
A lot of female headers
A lot of male headers
Some pieces of headschrinktube
A little thin piece (about 4 cm x 4 cm) of sheet metal (you have to be able to solder it)

Soldering iron
Pc with Arduino IDE
Glue gun
Helping hand
A smartphone with Android
Double sided tape
Duct tape

Step 2: Prepairing the Headers and the Perfboard

Cut your female headers in to pieces of:
2x 15 Pins
2x 24 Pins
2x 4 Pins
1x 2 Pins
2x 13 Pins
4x 1 Pin

Cut your male headers in to pieces of:
2x 9 Pins
2x 24 Pins
2x 4 Pins

Cut your Perfboard in to two pieces of 15 By 24 Holes

Now solder a female header of 4 pins to a male header of 4 pins in a 90 degree angle and a 4 pins female to a 4 pins male without an angle and put some heatschrinktube around it like the pictures.
I will tell you later where this is for.

Step 3: Making the Battery Parts

Now we are going to make the little springy things that will hold the batterys in place.

Take your sheet metal and cut two pieces of 2 cm by 0,8 cm and two pieces of 1 cm by 1,5 cm (these measurments are very important)
take the piece of 2 by 0,8 and cut a cross at one end like the pictures.
Now bend two of the four triangels and place the spring between them.
Bend the triangels back in place and make sure the spring is secure, I soldered it from the back aswell. Do this twice.

Now take one of the smaller pieces and cut it at 8 mm but leave a small soction of about 1,5 mm wide on.
Now make a cross again and secure the spring like the other one.
Make the 1,5 mm piece thinner and stronger with pliers (make sure it fits into the perfboard).
Now tin the little pin you just made and solder the spring from the back in place (watch the pictures for better detail).
Do the same with the other metal piece but don't attach a spring.

Step 4: Prepare the Servos

I had this idea from: Servo-motor-Adapted-to-Lego .Take a fullyrotational servo and cut a cross in the rotating part and make sure a lego part can fit on. Next cut the lego parts with the cross in them to 11 mm. Now take that piece and put a screw in it and screw it on to the servo(make sure you put the screw in the long part of the lego piece) and try to get it as straight as possible. To finish the servo cut the sides of.
Repeat that for the other one aswell.

Step 5: The Drive System

First take one piece of the perfboard you cut earlyer and solder the 24 pin and 13 pin female headers on to it as shown. Now it is time to solder on the switch and glue and solder the metal pieces, make sure the posititive plate (the one without spring) is on the side with the switch. Solder a wire from the positive plate to the switch and from the center pin of the switch to the left under pin. Connect the negative plate to the sixth pin. Cut the red wire of a servo to 2,5cm and connect it to the second pin, the brown wire to 3cm and connect it to pin 6 and the yellow wire to 7,5cm and connect that one to pin 21 of the other side. Take the other servo and cut the red wire to 8cm and connect it to the second pin, the brown wire to 8cm and connect it to pin 6 and the yellow wire to 2cm and connect it to pin 22 (you can better cut them a bit to long than to short). That was all the soldering for the drive part, when you are sure the connections are right you can use a bit of glue to fix them in place, be sure to glue them in the center and as close to the end as possible. To test it you will have to connect a jumper wire to the two pins next to the switch and insert the batterys. When you flick the switch the servos should turn very short. Now you know it works you can use hot glue to secure them and attach the two lego pieces as shown, make sure you won't cover the hole in the servo.

Step 6: Making the Shield

The shield is the piece that will hold the arduino, the Bluetooth module, the LEDs, the buzzer and the boost converter. It will go on top of the drive part.

Take your other piece of perfboard and solder male headers to the sides and connect the left back two pins as shown. Now solder 15 pin long female headers on top so the arduino nano can fit, make sure the two connected pins are not next to them. (Check the pictures)
Now solder 4 female headers to the back so you can fit in your boost converter later. Connect pins 9 and 10 to the pins next to them using some short wires. Solder the positive and negative female header of the boost converter to the pins next to them and solder the output negative female header to a ground pin of the arduino and the positive to the vin pin of the arduino. Next solder on the extra long straight header behind the arduino and connect vcc of the Bluetooth module to 5volt, ground to ground and tx of the module to rx of the arduino. Now we are going to connect the lights. First solder on the red leds on the back and connect the negative and the positive leads of the leds to each other and connect negative to ground with a 100 ohm resistor and positive to pin 2 of the arduino. Now solder on the white leds on to the perfboard and connect the positive leads and negative leads to each other again. To finish this part you will only have to connect the negative of the leds to ground and the positive with a 47 ohm resistor to pin 8 of the arduino and connect the buzzer (it has polarity) to pin 6 and with a 100 ohm resistor to ground.
Now stick a piece of tape on the bottom and your shield is done if you don't have a gun for it. If you have one you will have to follow the next step.

Step 7: Connect the Gun (optional)

We have to solder some more components to connect the gun.
Like the transistor, the resistors and the 2 pin female header.

First solder on the 2 pin female header and the bc547 transistor next to it with the flat Side towards the headers for the arduino. Now solder the middel (base) pin of the transistor with a 1K ohm resistor to pin 3 of the arduino and the left pin (the emitter) of the transistor to the right pin of the female header. The only thing left to do is connecting the right pin of the transistor (the collector) to the about 4 volts positive of the batterys and the left pin of the 2 pin female header to ground.
Now everything is done we can assemble the TinyTank and give it a try.

Step 8: Connect Everything

First gather all the parts and make sure there are no short circuits. Take the four gears and stick in the lego pins. Now connect the gears to the drive part and snap on the tracks. Insert the batterys and press the shield on. Now you have to make sure the boost converter is set to 9 volts, or an other voltage in the range of the arduino, and plug it in the right way so the input is connected to the batterys. Plug in the arduino, the 90 degree elbow and the Bluetooth module. If you have the gun you can stick it on the boost converter with a piece of double sided tape and connect it, polarity does not matter the gun will just simply turn the other way around.
Do not flick the switch just yet.

Step 9: The Code and the App

I hope you enjoyed the build as much as I did. Now you only have to program the TinyTank and it is ready for the first test drive.
The Bluetooth module will mess up the programming so you have to unplug the Bluetooth module before uploading anything.

So, to upload the code, disconnect the Arduino(I don't know what happens if you leave it in so just take it out), plug in a usb cable and copy and paste the code from here into the Arduino IDE. Make sure you select the right arduino and com. Now upload the code.

You can copy the code from here:

TinyTank code:
It will receive the data from the Bluetooth module and drive the little tank forward backward left and right. It will also fire the gun and turn the lights on and off when you press the buttons on the app and you can set the speed from the app. It beeps when started up and when the connection is lost.

/* this sketch will drive the TinyTank with bluetooth.
* When you turn it on it will make a sound and if you disconnect it it will make an other sound and
* the lights will blink twice.
* It is obvious that when you press the forward button on the app that the tank will drive
* forward and so on. When you press the button for the headlights the headlighst will turn on,
* and this is the same for the backlights. when you press the horn button the horn will turn on
* and if you press again it will turn off. When you press the triangle button the gun will fire once.
* you can change the speed the tank will drive by sliding the slide back and forth.
* the only thing you will have to change is the time the gun is set high so it will shoot once, it will
* depend on your type of gun.
* Made by: Ynze Selders


int rSpeed=0;
int lSpeed=0;
Servo rightservo;
Servo leftservo;
char command;
const int headLights = 8;
const int backLights = 2;
const int gun = 3;
const int buzzer = 6;

void setup() {
pinMode(headLights, OUTPUT);
pinMode(backLights, OUTPUT);
pinMode(gun, OUTPUT);
pinMode(buzzer, OUTPUT);

tone(buzzer, 750); //startup tone
tone(buzzer, 1000);
tone(buzzer, 1250);


void loop() {
if(Serial.available() > 0){
command = Serial.read();

switch(command){ //these are all the letters and numbers the app sends to the bluetooth
case 'F': //module
case 'B':
case 'L':
case 'R':
case 'G':
case 'I':
case 'H':
case 'J':
case '0': //these are the different speeds
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
case '8':
case '9':
case 'q':
break; //end of the speeds
case 'W': // if headlightbutton is pressed turn headlights on
digitalWrite(headLights, HIGH);
case 'w': // if headlightbutton is pressed again turn headlights off
digitalWrite(headLights, LOW);
case 'U': // if backlightbutton is pressed turn backlights on
digitalWrite(backLights, HIGH);
case 'u': // if backlightbutton is pressed again turn backlights off
digitalWrite(backLights, LOW);
case 'X': // if gun button is pressed shoot once
digitalWrite(gun, HIGH);
delay(150); // tweak this value so it shoots once if you press the button
digitalWrite(gun, LOW);
case 'x': // this is the same as the one above here but otherwise you had to press the
digitalWrite(gun, HIGH);//button twice to shoot once
delay(150); // so tweak this value to the same value as the other one
digitalWrite(gun, LOW);
case 'V': // if the horn button is pressed turn the buzzer on
tone(buzzer,1000);// modify this value to get other tones
case 'v': // if the horn button is pressed again turn the buzzer off
case 'D':
rightservo.write(90); //if disconected turn motors off
digitalWrite(gun, LOW); //if disconected make sure the gun is off
tone(buzzer, 2000); //if disconected blink lights and make sound
digitalWrite(headLights, HIGH);
digitalWrite(backLights, HIGH);
digitalWrite(headLights, LOW);
digitalWrite(backLights, LOW);
digitalWrite(headLights, HIGH);
digitalWrite(backLights, HIGH);
digitalWrite(headLights, LOW);
digitalWrite(backLights, LOW);


void forward() //define what is forward
rightservo.write(rSpeed); //it moves with the speed you selected in the app

void back() //define what is backward

void left() //define what is left

void right() //define what is right

void forwardright() //define what is forwardright

void forwardleft() //define what is forwardleft

void backwardleft() //define what is backwardleft

void backwardright() //define what is backwardright

void Stop() //define what is stop

The app:

Step 10: Finished Product

Now your TinyTank is done, you can start playing with it and maybe improve it.
To connect it with your phone, turn the TinyTank on, you should hear a beeping sound, go to the app and click the gear, connect to car and connect to it with the code 1234 or 0000. If the red light turns green it is connected. Now you can start driving.
I would like to hear it if you made the TinyTank.

I posted a video on Youtube, you can click on this link if you want to see it in action:


I will maybe make an other shield with a NRF24L01 module in the near future to make it 2.4GHz controlled.

Ask my in the comments if you have any questions.

<p>Thank you</p>
<p>#include &lt;nano tank&gt;</p><p>int rSpeed=0;</p><p>int lspeed=0;</p><p>Servo rightservo;</p><p>Servo leftservo;</p><p>void setup(){</p><p> Serial begin(9600);</p><p> rightservo.attach(11);</p><p> leftservo.attach(10);</p><p> rightservo.write(90);</p><p> leftservo.write(90);</p><p>}</p><p>void loop (){</p><p> if(serial.available()&gt;0){</p><p> command=Serial.read();</p><p> stop();</p><p> switch(command)//these are the letters and numbers that app sends to the bluetooth module</p><p> case'F':</p><p> forward();</p><p> rspeed=200;</p><p> lspeed=200;</p><p> break;</p><p> case'L':</p><p> left();</p><p> break;</p><p> case'R':</p><p> right();</p><p> break;</p><p> case'D'</p><p> rightservo.write(90);//if disconnect turn motors off</p><p> leftservo.write(90);</p><p> break;</p><p> }</p><p> }</p><p> void forward()//define what is forward</p><p> {</p><p> rightservo.write(rspeed=200);</p><p> leftservo.write(lspeed=200);</p><p> }</p><p> void back()//define what is backward</p><p> {</p><p> rightservo.write(lspeed);</p><p> leftservo.write(rspeed);</p><p> }</p><p> void left()//define what is left</p><p> {</p><p> rightservo.write(rspeed);</p><p> leftservo.write(rspeed);</p><p> }</p><p> void right()//define what is right</p><p> {</p><p> rightservo.write(lspeed);</p><p> leftservo.write(lspeed);</p><p> }</p><p> void stop()//define what is stop</p><p> {</p><p> rightservo.write(90);</p><p> leftservo.write(90);</p><p> }</p><p>are these codes correct?</p>
<p>what if i connect the servo signal wire to the wrong digital pin???</p>
The Servo motor wont work then, but If you change the code it Will work fine on a different digital pin.
Thanks alot
What if i connect bluetooth module directly to power source ?will it work
<p>The voltage range on the Bluetooth module is from 3,6 to 6 volts. The power source are 3 rechargeable 1,2 volt batterys so that's 3,6 volts but if the batterys get low it will drop below 3,6 volts so you will need to use non rechargeable 1,5 volt batterys for it to propperly work so that is why I connected it to the 5volt pin of the arduino.</p>
<p>i just wanted to ask that how much GHz is it</p>
It is a Bluetooth device and Wikipedia says that Bluetooth works with 2.4 to 2.4835 GHz.
<p>does the app work with iphone as well?</p>
<p>unfortunately not</p>
<p>Nicely done, thank you </p>
<p>Stap to Stap?</p>
<p>Stap to Stap?</p>
where would I be able to find the requirements
<p>transistors:</p><p style="margin-left: 20.0px;"><a href="http://www.budgetronics.eu/index.php?action=article&aid=84&group_id=10000162&lang=NL">http://www.budgetronics.eu/index.php?action=article&amp;aid=84&amp;group_id=10000162&amp;lang=NL</a></p><p>the total cost will be about 30 euros</p>
<p>I bought mine on dx.com</p><p>boostconverter:</p><p style="margin-left: 20.0px;"><a href="http://www.dx.com/p/2a-booster-board-dc-dc-step-up-power-module-input-2-24v-to-5v-9v-12v-28v-with-micro-usb-for-arduino-420838#.Vvocssc_58A">http://www.dx.com/p/2a-booster-board-dc-dc-step-up-power-module-input-2-24v-to-5v-9v-12v-28v-with-micro-usb-for-arduino-420838#.Vvocssc_58A</a></p><p>perfboard:</p><p style="margin-left: 20.0px;"><a href="http://www.dx.com/p/double-sided-glass-fiber-prototyping-pcb-universal-board-5-pack-142733#.VvodQMc_58A">http://www.dx.com/p/double-sided-glass-fiber-prototyping-pcb-universal-board-5-pack-142733#.VvodQMc_58A</a></p><p>bluetooth module:</p><p style="margin-left: 20.0px;"><a href="http://www.dx.com/p/hc-06-serial-port-passthrough-wireless-slave-transceiver-bluetooth-module-for-arduino-382686#.Vvodj8c_58A">http://www.dx.com/p/hc-06-serial-port-passthrough-wireless-slave-transceiver-bluetooth-module-for-arduino-382686#.Vvodj8c_58A</a></p><p>arduino nano:</p><p><a href="http://www.dx.com/p/nano-v3-0-atmega328p-development-board-for-arduino-blue-396797#.Vvod68c_58A">http://www.dx.com/p/nano-v3-0-atmega328p-development-board-for-arduino-blue-396797#.Vvod68c_58A</a></p><p>headers:</p><p style="margin-left: 20.0px;"><a href="http://www.dx.com/p/diy-40-pin-2-54mm-female-header-10-pcs-404613#.Vvoefsc_58A">http://www.dx.com/p/diy-40-pin-2-54mm-female-header-10-pcs-404613#.Vvoefsc_58A</a></p><p style="margin-left: 20.0px;"> <a href="http://www.dx.com/p/2-54mm-1x40-pin-breakaway-straight-male-header-10-piece-pack-144191#.VvoeVcc_58A">http://www.dx.com/p/2-54mm-1x40-pin-breakaway-straight-male-header-10-piece-pack-144191#.VvoeVcc_58A</a></p><p>leds:</p><p style="margin-left: 20.0px;"><a href="http://www.dx.com/p/exled-5mm-led-light-emitting-diode-element-set-60-pcs-295310#.VvofBMc_58A">http://www.dx.com/p/exled-5mm-led-light-emitting-diode-element-set-60-pcs-295310#.VvofBMc_58A</a></p><p>resistors:</p><p style="margin-left: 20.0px;"><a href="http://www.dx.com/p/diy-universal-metal-film-resistors-set-silver-blue-355927#.VvofP8c_58A">http://www.dx.com/p/diy-universal-metal-film-resistors-set-silver-blue-355927#.VvofP8c_58A</a></p>
great design.

About This Instructable




More by Ynze-:Electric Lighter Tiny 80Watt Electric Heater Tiny Smartphone Controlled Arduino Tank 
Add instructable to: