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
        if(t==1)  
        {
         Turn right
         }
        else
        {
        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.


Wednesday, 13 June 2012

AutoTank - Ver 1

After few weeks of playing with LEDs, waiting for the parts and a 'massive' man flu I have put things together on the tank and made a tank robot. What this tank does is go forward at full throttle, when it detects some obstacles in front turn left.

AutoTank V1.1 - Parts list

  1. Sharp IR sensor - GP2Y0A41SK0F
  2. 2 x DC motors(came with the tank toy)
  3. 1 motor driver - SN754410 Quadruple half H driver
  4. The brain - Arduino UNO R3
  5. One 9V(PP3) battery to power the Arduino
  6. 4 x NiMH cells to give 4.8V - for the motor driver power
  7. An SPDT switch (SPST was enough for this application but I didn't have any!)
  8. And lots of insulation tape to keep things together - proper engineering
AutoTank on test run
Yes, as I said before this turns in only one direction and there is no bump sensor. IR sensor is a range sensor so it is used to control the speed depending on the distance from the obstacle(not to a great deal) with dead stop distance.

Planned improvements for next version
  1. Make alternate left and right turn
  2. Protect the front IR sensor from colliding into things
  3. Use a bigger range of speed control on straight control
There are a lot of hardware improvements required(software too) but I don't want to try to do too much in one go and I got to wait for the hardware parts anyway(not even ordered yet).




Saturday, 19 May 2012

LED Projects

I think, because I am a beginner, the best way to learn programming the microcontroller and familiarising with its inputs and outputs are by using simple LED programs. So I am making some simple LED projects and adding them here.

1. LED blinking - using Two LEDs.

A very basic one LED blink using Arduino is available in Arduino learning page. This one is using same ways but two LEDs fading in and out alternatively. I have used two PWM outputs to drive the LEDs. Each LED is connected to the PWM pin with a 220 Ohm resistor in series. See the video below.


2. 5 LED Filling/counting pattern.

This one is using the Arduino digital pins. The five LEDs are turned on and off using three 'for' loops and the delay() function. For this you may need the following things.
  1. 5 LEDs
  2. Arduino Uno
  3. Bread board
  4. Jumper leads (connecting leads)
  5. 5 Resistors (220 Ohm)
  6. And a Cup of tea!
See the video below.

This is a breadboard connection picture made with Fritzing. Fritzing is a software that I recently found out, very useful and easy. Brilliant application!!
And here is the schematic. I know, it is pathetic. This is the first time ever I used the Fritzing. I will get there, eventually!
And finally the code.
/********************************************************************************
void setup() {
  
pinMode(3,OUTPUT);
pinMode(4,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(7,OUTPUT); 
}

void loop() {
  
  for (int i=3; i < 8; i++)   //main counter
  {
      for(int j=3; j
      {
      digitalWrite(j,HIGH);
      delay(250);
      }
      for(int j=3; j
      {
      digitalWrite(j,LOW);
      }
      delay(250);
  } 

}
********************************************************************************/

Light sensitive LED string - Using an LDR

This is a simple circuit demonstrating the use of analogue pins to read sensor data and calculate output according to it. I found the basic code and instructions from the Arduino learning site. I am using an LDR (Light dependant resistor) to detect the level of surrounding light and show that using an array of LEDs.
If the room is dark all the 5 LEDs will light up with a moving pattern. If the room is well lit all the LEDs will go off. In the video below there wasn't enough light in the room to turn all the LEDs off! probably on direct sunlight they will all go off.
There is not only full bright and complete dark, light level has been measured and shown on scale of 0-5. No LEDs(0) for full bright light and 5 LEDs for complete darknessnesssssssss!!!

See the video below.


I am working on the schematic of this. Will update soon once i finish drawing this up.

Shopping list - to start making your robot

Here is a list of basic things and some extra bits that I think essential to make a simple robot. I know it depends on how you define the simple robot but I am making this list keeping my tank robot in mind!

  1. Bread board 
  2. Wires - those ones you can directly push into the bread board are great! 
  3. Resistors 
  4. Capacitors 
  5. LEDs - at least one 
  6. A soldering kit 
  7. A digital multimeter 
  8. A computer 
  9. A programmer to compile and burn your program to the microcontroller 
  10. Microcontroller - For a beginner I think buying a microcontroller kit is the best idea - like Arduino, or biotrics cerebellum. 
  11. Motors - dc or stepper or servo 
  12. Sensors - I will be using an IR range sensor 
  13. Buy some old second hand toys so you can build your robot frame from it. I have been to couple of car boot sales and got enough metal frames and wheels and all sorts of stuff.


Some good shopping websites - for UK
  • http://www.phenoptix.com - They are specialised in LEDs, but I got my Arduino for a very good deal from there.
  • http://www.bitsbox.co.uk/ - Very small company but good number of components and deals, I bought an electronics kit and a Sharp IR range finder from there. Best deal I found on internet.

Friday, 11 May 2012

The beginning!

So, hello fellow crazy creators! Hope all of you are working hard and providing your bit towards the rise of the machines(will they??) and extinction of the human race! (Terminator, yes that's what I am on about).

Will they rise or not that's not my problem now although I have thoughts and theories about it. I quite like making the robots! Just for fun! I have only started making last week so not an expert. But I thought I need to write down the things I find out somewhere I can easily access, share it with other enthusiasts and get help from other experienced robo makers!!

I have found a quite use full website : www.societyofrobots.com They have everything you need to know about how to make a robot. And I found some useful websites where you can buy parts from.


http://robot-electronics.co.uk/
http://www.rapidonline.com/default.aspx
http://www.technobotsonline.com
http://www.hobbytronics.co.uk/
So to start with I decided to make a small tank that run around inside my house floor and avoid the obstacles! and hopefully the chair legs! To make things easy I bought an RC controlled tank which I will be pulling apart later on. Before I do that I think it is a good idea to put some pictures of it up here.

So I played with it for about a week an even tried it run down the stairs! it survived because it got stuck on the second step from top. I can't remember the name of this tank I am not really interested in the outside shape and detailing of it. I just wanted a tank!

So as next step I had a look around to find out what microcontroller I should be using to replace the original one of the tank. After a week of reading through blog posts of this vs that I have decided to get an Arduino UNO. Main reasons are Arduino is an opensource project so there are endless help available there, the programmer (the C compiler) is free, and arduino is easy and cheap for a beginner.
Arduino UNO