Monday 23 December 2013

AUTOBOT - 2014 Arena

General Guidelines

Welcome to the autonomous robotics event: “The AUTOBOT – 2014” presented by Academy Of Technology. With the ever-increasing level of difficulty experienced at the national level autonomous robotics competition, we AOTIANs present an intriguing challenge to our participants. We are confident enough to put you through an exciting competition. Come, participate and win your world!
The competition will comprise of two rounds. The qualifying candidates from the first round will compete against each other for the second round. 

Round One

Round one starts with the bots being placed at the starting position and switched “ON” at the referee’s signal. Then the robot must track the line completely autonomously and navigate through the track to reach the finish line. The track as seen in the illustration will comprise of curves, intersections, dashed lines and a dead end! The dead end is basically marked by a completely black patch. The robot is intended to detect the dead end and make an about turn to pick up the line



Round Two

The robot that qualifies in the first round has to compete in the second round. Round 2 starts with the bots being placed at the starting position and switched “ON” at the referee’s signal. Then the robot must track the line completely autonomously and navigate through the track to reach the finish line. The track comprises of intersections, zigzag paths, curved paths, right angled turns, and dashed paths. Four zones have been specified in the arena that carries score points.


RobotChallenge -   Line Follower Rules 


Note: All rules are subject to change prior notice. But we will try our best to maintain consistency.

Name of Event: AUTOBOT 2014

Short Description: The objective of this contest is to complete the course in the shortest period of time while accurately tracking the course line from start to finish. 

1.   General Requirements

1.1.  Course Time

Time is measured from crossing the start line until the robot crosses the finish line. A robot is deemed to have crossed the line when the forward most part of the robot contacts or crosses over the line.   

1.2.  Time Limit

A maximum of 3 minutes is allowed for a robot to complete the course. A robot that cannot complete the course in the allotted time shall be disqualified.

1.3.   Number of Trials

Each team will get a maximum of three trials of which the best (fastest) time will be counted.

1.4.  Autonomous Control

Once a robot has crossed the starting line, it must remain fully autonomous (i.e. no external controls!), or it will be disqualified.

1.5.  Timeouts

The team may ask for a timeout anywhere during their run in the competition, although the timer will not be paused during a timeout. A team may take a maximum of five timeouts during the three minute time slot allotted to them! (The Robot will be re-positioned at the point where it left the line)

1.6.  Restarts

The team may ask for a restart in which the team can do any hardware modifications if they require but they will not be allowed to change the code! (The Robot will be re-positioned at the Start of track by the volunteers). A team may take a maximum of two restarts.

1.7.   Losing the Line

In case a robot loses the line course, the team must ask for a timeout (Which would allow them to reposition their bots on the line from where it lost the track).

2.   Competition Rules

2.1        Field


  1. The field is white sheet with area of 2 m².
  2. The 15 mm wide line is printed on the white field with black ink.
  3. Minimal turn radius of the line is 20 cm.
  4. The line is surrounded by 25 cm of free space on both sides, except on cross-sections.
  5. The Start and Finish graphics are only used for illustration purpose, so are the colored patches to denote the zones (Will not be there in the actual competition!).

    2.2        Robot


    1. Maximum measures of the robot must 20 x 20 x 20 cm and the maximum weight is 1 kg. (This is a stringent requirement and will be checked by volunteers during Robot registration)
    2. Robot must cover the line all of the time, otherwise the trial is cancelled. 
    3. Robot must not damage the field and not endanger the spectators.
    4.  Using greater voltages than 24V is forbidden.
    5. Robot must have start and stop button(s). 
    6. You may use on board or off board power.
    7. The Robot may use ready-made development board (such as Arduinos, AVR boards, etc). But ready-made robots will not be allowed in general. (Allowance of such ready-made bots will solely depend on the discretion of the Event Head!)

      2.3        Organisation


      1. There will be a testing arena (not identical to the actual!) where the participants will be allowed to test and calibrate their bots.
      2. To be able to compete, the robot must be registered. The registration contains technical regulations check and marking the robot with a numbers sticker.
      3. There are 2 hours for competing (making trials), the teams will be allocated a time slot for their trial.
      4. Maximum lap time is 3 minutes. Exceeding this will cancel the trial.
      5. The team may comprise of maximum four members (minimum two).
      6. The referee solves the questions and the problems.
      7. The decision of the event co-coordinator(s) and authorities’ in-charge will be final in all regards. 

          3.  Scoring Rules

        Total score= Z + (180-t)-(30*r)-(10*p)-q

        Where,       t= Total time taken in seconds.
                                  r= Number of restarts.
                                  p= Number of time-outs.
                                  q=20 (if the bot fails to turn at the Dead End!)
                                  Z = Zone Calculation

            Zone Calculation:


        • If your robot crosses Zone 1 successfully then you are awarded 25 points.
        • If your robot crosses Zone 2 successfully then you are awarded 25 points.
        • If your robot crosses Zone 3 OR Zone 4 successfully then you are awarded 50 points .

        Tuesday 9 April 2013

        Intelligent Obstacle Avoiding Robot


        Introduction

        In the field of Robotics, starting from Unmanned Aerial Vehicle to Land Rovers, all employ some form of obstacle avoidance technology. Obstacle avoidance plays a crucial role in the development of intelligent rovers that can detect obstacles in their paths automatically and navigate all by themselves avoiding the obstacles. So, here in this article we will attempt to build a system using Atmega 8 microcontroller and dedicated obstacle detecting sensors to replicate obstacle avoidance behavior. 

        Obstacle Avoidance

        Just imagine how a blind guy would navigate through a given terrain. He must be having a stick which he uses as a detector for his obstacles…Suppose there is a wall to his front; he keeps swiping his stick back and forth and in the horizontal motion. So he would swipe his stick and he would feel the obstacle…right? Now he has three choices; either he would turn left or right or move back and go in the other direction perhaps. Here in the domain of electronics, we have sensors to do the detection! It’s on us to add the intelligence to it, so that it can navigate through the terrain.
        In this particular article we will explore the field of “intelligent obstacle avoidance”. Now there is a specific reason to why I call it intelligent. Although we will be using concepts of finite Automata into the obstacle avoiding problem, there is not much to worry. The concepts used here will open up new perspectives for the improvement of traditional robots that uses simple logic (I mean those which don’t employ Automata Theory to their design!)

        Problem

        Let’s define our problem statement. You will have to build a robot that is smart enough to avoid obstacles in its path and navigate autonomously through a given terrain full of obstacles.

        Problem Figure

        Here the rover is surrounded by walls in all the three sides.




        General Layout Of The Rover

        This is the general layout of the rover. We have three TSOP sensor modules mounted at the front, left and right of the rover. We have used BO type motors to save space and money.(BO's are cheaper than conventional DC motors!)





        Circuit Diagram

        (Click on the image to enlarge)

        Sensors

        Sensors for obstacle avoidance come in different forms employing different techniques for obstacle detection. There are Ultrasonic Ping sensors which use ultrasonic waves for object detection and ranging, but these are costly. Again there are SHARP IR sensors which are again a very costly solution to your needs. Then there are normal IR LED and Sensor pairs which you can use, but these normal IR sensor pairs have a major drawback, which is that these gets confused by ambient IR light. So, how do we find a better solution? Well if you only consider obstacle detection (and not distance ranging!), then the effective solution is to use a TSOP sensor. These sensors although basically are of IR type but they don’t get confused by ambient IR light. Hence you get efficient obstacle detection. Dedicated TSOP sensor modules are available in the market, buy there of them; each for the left, front and right of the rover.

        Motors

        For the motors you could use any normal DC motor of preferably lower RPM. Although BO type DC motors are quite popular in robotics for low torque applications. Get about a 60-100 RPM motor. You will need two of them (There is one Castor wheel in the middle of the front end).

        Theoretical Solution for Obstacle Avoidance

         Table 1: Input Table

        Sensor Input
        L - F - R
        Interpretation
        Output
        0 - 0 - 0
        All clear Move ahead
        Y0
        0 - 0 - 1
        Wall to the right
        Y1
        0 - 1 - 0
        Wall at front
        Y3
        0 - 1 - 1
        Wall at front and to the right
        Y1
        1 - 0 - 0
        Wall to the left
        Y2
        1 - 0 - 1
        Wall to the left and to the right
        Y0
        1 - 1 - 0
        Wall at front and to the left
        Y2
        1 - 1 - 1
        Wall at all side
        Y3

               Table 2: Output Table

        Output
        Practical Meaning of Output
        Y0
        Move Straight
        Y1
        Stop, move back  slightly and take a Left turn
        Y2
        Stop, move back  slightly and take a Right turn
        Y3
        Stop, move back  slightly and turn 180 degree

        Source Code 

        Here I present a sample code for the Obstacle Avoiding Rover. The code is written for Atmega 8 Micro-controller, although it could be easily modified for an Atmega 16/32 Micro-controller. After compiling it in AVR STUDIO, you will get the equivalent hex code which you need to flash into the Microcontroller using some AVR programmer hardware.(Click here for the Serial AVR programmer circuit.)


        #define F_CPU 1000000UL     //set your clock speed
        #include <avr/io.h>
        #include <util/delay.h>


        /*Left Sensor connected to PC 0 of Atmega 8
          Right Sensor connected to PC 1 of Atmega 8
          Front Sensor connected to PC 2 of Atmega 8
        */

        /*A1-->PB0--> + --> +ve of the left motor
          A2-->PB1--> - --> -ve of the left motor
          B1-->PB2--> + --> +ve of the right motor
          B2-->PB3--> - --> -ve of the right motor
        */


        int move_backward=0b00000110;
        int right_turn=0b00001010;
        int move_forward=0b00001001;
        int left_turn=0b00000101;
        int left_sensor_on=0b0000001;
        int right_sensor_on=0b0000010;
        int front_sensor_on=0b0000100;
        int left_sensor_off=0b0000000;
        int right_sensor_off=0b0000000;
        int front_sensor_off=0b0000000;


        void wait(float x)             // Delay function
        {
        for(int i=0;i<(int)(1302*x);i++)
        _delay_loop_1(0);
        }


        void main ()
        {


        DDRB = 0xFF; //Output port
        DDRC = 0b0000000; //input port

          int left_sensor = 0;
          int right_sensor = 0;
          int front_sensor = 0;

        while(1)   //create an infinite loop
        {
         left_sensor = (PINC & 0b0000001);
         right_sensor = (PINC & 0b0000010);
         front_sensor = (PINC & 0b0000100);

        if(( left_sensor==left_sensor_off) & (right_sensor==right_sensor_off) & (front_sensor==front_sensor_on))
         {
        PORTB = move_backward;             //move backward
        wait(2.0);
        PORTB=right_turn;                    //take a right turn
        wait(1.0);

                 }
        if((left_sensor==left_sensor_off) & (right_sensor==right_sensor_off) & (front_sensor==front_sensor_off))
          {
                    PORTB=move_forward;                  //move forward
             } 

              if(( left_sensor==left_sensor_on) & (right_sensor==right_sensor_off) & (front_sensor==front_sensor_off))
          {
             PORTB=move_backward;
         wait(2.0);
         PORTB=right_turn;
         wait(1.0);

          }
         
         if(( left_sensor==left_sensor_off) & (right_sensor==right_sensor_on) & (front_sensor==front_sensor_off))
          {
             PORTB=move_backward;
         wait(2.0);
         PORTB=left_turn;
         wait(1.0);

          }
         if(( left_sensor==left_sensor_off) & (right_sensor==right_sensor_on) & (front_sensor==front_sensor_on))
          {
             PORTB=move_backward;
         wait(2.0);
         PORTB=left_turn;
         wait(1.0);

          }
          if(( left_sensor==left_sensor_on) & (right_sensor==right_sensor_on) & (front_sensor==front_sensor_off))
          {
               PORTB=move_forward;
          }

         if(( left_sensor==left_sensor_on) & (right_sensor==right_sensor_off) & (front_sensor==front_sensor_on))
          {
               PORTB=move_backward;
         wait(2.0);
         PORTB=right_turn;
         wait(1.0);
          }

        }

        }

        Friday 18 January 2013

        SAMPLE CODE FOR THE LINE FOLLOWER (ROUND 1)


        #define F_CPU 1000000UL            //Define Clock speed. This is currently set to 1Mhz(Which is default for a factory shipped AVR Micro). UL represents Hertz.
        #include <avr/io.h>                //Header file for basic I/O Operations
        #include<util/delay.h>          //Header file for the Delay Routine


        void wait(float sec, int freq)             //Delay Routine (Leave it as it is)
        {

        int i;

        if(freq==1)
        for(i=0;i<(int)(1302*sec);i++)
        _delay_loop_1(0);

        if(freq==2)
        for(i=0;i<(int)(2604*sec);i++)
        _delay_loop_1(0);

        if(freq==4)
        for(i=0;i<(int)(15*sec);i++)
        _delay_loop_2(0);

        if(freq==8)
        for(i=0;i<(int)(30*sec);i++)
        _delay_loop_2(0);

        if(freq==12)
        for(i=0;i<(int)(46*sec);i++)
        _delay_loop_2(0);

        if(freq==16)
        for(i=0;i<(int)(61*sec);i++)
        _delay_loop_2(0);

        }



        int main()                    //Start of MAIN
        {

        DDRC=0x00;    //Set PORT C as input for the sensors.
        /*Left sensor connected to bit 7 of PORT C (Change it a/c to your setup)
           Middle sensor connected to bit 6 of PORT C (Change it a/c to your setup)
           Right sensor connected to bit 5 of PORT C (Change it a/c to your setup)
        */

        DDRD=0xFF;    //Set PORT D as output for connection with motor driver

        /*A1-->PD0--> + --> +ve of the left motor
          A2-->PD1--> - --> -ve of the left motor
          B1-->PD2--> + --> +ve of the right motor
          B2-->PD3--> - --> -ve of the right motor
        */

        int middle_sensor=0,left_sensor=0,right_sensor=0;

        PORTD=0b00010101;       //Motor driver pulses along with enable active at PD4-->ENABLE

        while(1)    //Infinite Loop
        {
         left_sensor=PINC&0b10000000;  //Left sensor connected to bit 7 of PORT C (Change it a/c to your setup)
         middle_sensor=PINC&0b01000000;   //Middle sensor connected to bit 6 of PORT C (Change it a/c to your setup)
         right_sensor=PINC&0b00100000;    //Right sensor connected to bit 5 of PORT C (Change it a/c to your setup)

        if(left_sensor==1 && middle_sensor==0 && right_sensor==0)     //For sensor state : 1 0 0 -> sharp left
        {
        PORTD=0b00010110;    //Motor driver bit combination for sharp left turn
        wait(.2,8);      
        wait(1,8);
        PORTD=0b00010101;            //Move Forward
        }

        if(left_sensor==0 && middle_sensor==0 && right_sensor==1)     //For sensor state : 0 0 1 -> Sharp Right
        {
        PORTD=0b00011001;            //Motor driver bit combination for sharp right turn
        wait(.2,8);
        wait(1,8);
        PORTD=0b00010101;            //Move Forward
        }

        if(left_sensor==1 && middle_sensor==1 && right_sensor==1)     //For sensor state : 1 1 1 -> All Sensor on horizontal strip(Move Forward and flash Led)
        {

        PORTD=0b00010101;            //Move Forward if you are on a horizontal strip.
        PORTD=0b10000000;     //Glow an LED if on a horizontal strip.(LED connected to bit 7 of PORT D)
        }

        /*(Here in this code i have not written all the possible logic condtions (for three sensors!) which might arise on the track.

        You will require to put all other logic condtions which you find is necessary.)*/

        } //END of WHILE
         return 0;
        } //END OF MAIN

        The IR Line sensor

        This is a 8 sensor array of iR sensors

        The Sensor Array
        The sensor board consists of 8 IR sensors. The sensors are placed 1.2 cm apart from each other.Two on oboard LM324 onboard convert the anaglog signals from the IR photodiode and convert them to digital signals. There is a onboard preset to calibrate the sensors. The sensor board PCB is shown below. I used EaglePCB for the designing because it is quite easy to learn and comes free. The sensor board is single sided so it should be possible to etch at home. Just print the board to size and etch it.



        The above picture is of the silk side of the sensor array. Here you can clearly see how the components have been placed in the vero board. The symbols marked with "L#" represent respective IR diodes and the symbols marked with "PD#" represent the respective IR sensors.


        The solder side of the above sensor module

        You need to solder your vero board according to the above given layout. Just try to relate the layout with the silside of the sensor module. Although this module has 8 sensors but in most of the competitions 3 sensors will suffice! One on the line. The other two on both sides of the line; the Left Sensor and the Right Sensor.