Friday, 6 July 2012

Auto Tank - Ver 2

As I have planned before, finally I got some time to work with the tank and it looks much better now. See the video below. And yes I managed to break the tread!

My first plan was to make alternate left and right turn. But I after making a program for that I have realised turning left and right alternately will only get the tank stuck in some corner failing to get out of the trap. So I had to adopt a different strategy for fixed IR sensor control. I am just writing the logic below.
  1. Power on
  2. Move forward crazy(full speed).
    1. speed depends the distance to the obstacle
    2. speed reduces to zero as it reaches towards the obstacle
  3. Once the gap in front has reduced to 8 cm(approx), stop and have a think about which way to turn
  4. Turn left or right - Turning right has a probability of 9/10 and turn left has a probability of 1/10.
  5. Once the decision has made on which direction to turn  keep turning until the gap in front increases more than 8cm(approx).
  6. move forward
  7. got to step 2
The decision making with the more probability to turn right has been done using a random function as shown in below pseudo code.

        int t=random(1,11);   // randomly gets a value between 1 and 10, random() is an Arduino function
         Turn right
        Turn left

And from the previous version I have removed all the pause timings to make it more smooth-smooth. previously the minimum gap to brake was less than 8 cm. Increasing this minimum gap reduced the tank running into things and made the sensor more safe from collisions.

Now, these are my future improvement plans for this.

  1. Move the motor controller from the bread board into a PCB.
  2. Use a common 9V rechargeable battery for both Arduino and the motors. Currently Arduino runs with 9V PP3 battery and the motors on 4.8 V rechargeable battery pack.


  1. Hi Suloke! The robot's really cool - I like it! :D
    I wanted to make a tracked vehicle for one of my first robotic projects but I stuck to using wheels; I suck at using tracks but I'll try them out one day. ^___^

    Keep up the good work!

    Kind Regards,

    1. Thank you
      I have learnt my lesson AKdaBAOUS. Tracks sucks, unless you get a good quality one! Mine kept breaking (as you can see in the video) because it's a cheap one. I had to take the 'thread and needle' out to fix it.