user20607: Can I make all in one arduino robot? Example - line follower, bluetooth control, sonar sensor,dtmf in one arduino robot just switch to any mode without change the parts.

user8033: Yes, actually it has been done before (multiple times).
I, along with some other students did such a project at my school.
https://www.youtube.com/watch?v=GTJQ2VXtmk0
https://www.youtube.com/watch?v=sXXh3Q8WoEM
Materials needed

Arduino (or other programmable microcontroller board with voltage regulation)
Battery pack (and charger)
2 to 5 line sensors
ultrasonic sensor
Bluetooth module
Robot chassis
Atleast two motors (with encoders is nicer, but not neccesary)
Motor driving circuitry
Switch and emergency stop button

It can be useful to buy a "line follower robot kit"
Connection
This is the connection we used. You're free to make your own adjustments.

Programming
We used a server that (was connected via bluetooth) and has the map and a user-interface.
When you press the end-point on the server, it would generate the shortest route, calculate the directions, and send it to the robot.
The robot would then drive until it comes to a junction and then executes the direction command.
I've attached some preview code. It's better to do it yourself, but if you really don't know where to get started, you can try this.
You will have to implement the low-level code yourself.
The robot will wait for Bluetooth messages. You can set it to a "direct drive" modus or "line following" modus.
void setup() {
  // put your setup code here, to run once:
  setupBluetooth();
  setupUltrasonicSensor();
  setupMotors();
  setupLinesensors();
  state=waiting;
}

void loop() {
  char receivedCharacter = bluetoothReceiveCharacter();

  switch (state) {
    case waiting:
      switch(receivedCharacter){
        case 'd':
          bluetooth.println("Direct Drive enabled!");
          state = directDrive;
        break;
        case 'l':
          bluetooth.println("Line following enabled!");
          state = following;
          motor1.setSpeed(50);
          motor2.setSpeed(50);
        break;
      }
      break;
    case directDrive:
        directDrive(receivedCharacter);
      break;
    case following:
        followLine(receivedCharacter);
      break;
    default:
      bluetooth.println("STATE ERROR!");
      buzzer.buzz();
      led.blink();
    break;
  }
}

void followLine(){
    long distance = ultrasonicSensor.measureDistance();
    unsigned char lineSensorsPattern = lineSensors.getPattern();

    switch(receivedCharacter){
      case 'X':
        bluetooth.println("Line following disabled! (Now waiting)");
        state = waiting;
      break;
    }

    if(distance > 100 || distance == -1){
      switch(lineSensorsPattern){
        case 0b00000000:
          motor1.setSpeed(0);
          motor2.setSpeed(0);
          bluetooth.println("Following interrupted, lost path!");
          findPath();
        break;
        case 0b00000100:
          motor1.setSpeed(100);
          motor2.setSpeed(100);
          bluetooth.println("Following line, middle sensor on.");
        break;
        case 0b00000100:
          motor1.setSpeed(100);
          motor2.setSpeed(100);
          bluetooth.println("Following line, middle sensor on.");
        break;
        case 0b00000110:
          motor1.setSpeed(70);
          motor2.setSpeed(100);
          bluetooth.println("Following line, middle & right sensor on.");
        break;
        case 0b00001100:
          motor1.setSpeed(100);
          motor2.setSpeed(70);
          bluetooth.println("Following line, middle & left sensor on.");
        break;
        case 0b00000010:
          motor1.setSpeed(0);
          motor2.setSpeed(100);
          bluetooth.println("Following line, right sensor on.");
        break;
        case 0b00001000:
          motor1.setSpeed(100);
          motor2.setSpeed(0);
          bluetooth.println("Following line, left sensor on.");
        break;
      }
    }else{
      bluetooth.println("Following interrupted, obstacle in path!");
    }
}

void directDrive(char receivedCharacter) {
  switch (receivedCharacter) {
    case 'X':
      motor1.setSpeed(0);
      motor2.setSpeed(0);
      state = waiting;
      bluetooth.println("Direct Drive disabled! (Now waiting)");
      break;
    case 'w':
      motor1.setSpeed(motor1.getSpeed()++);
      motor2.setSpeed(motor2.getSpeed()++);
      break;
    case 'a':
      motor1.setSpeed(motor1.getSpeed()++);
      motor2.setSpeed(motor2.getSpeed()--);
      break;
    case 's':
      motor1.setSpeed(motor1.getSpeed()--);
      motor2.setSpeed(motor2.getSpeed()--);
      break;
    case 'd':
      motor1.setSpeed(motor1.getSpeed()--);
      motor2.setSpeed(motor2.getSpeed()++);
      break;
  }
}

My advice
My best advice is to work in iterations. Slowly add more features until you've got the product that you desire. Or develop parts of it individually.

Get a bluetooth link working, send some messages back and forth.
Connect motors to an Arduino and chassis let it drive a pre-programmed path.
Get some line sensors to work (non reflecting black tape!)
Get a ultrasonic sensor to work.
Start combining these! Control the robot over bluetooth. Let the robot follow the lines. Add a breaking when it sees something within range.


As addition/clarification.
You could make a button, that increases the state every time you press it.
If you then check which state the robot is in, you can make it perform his task for that state.
if(buttonPressed){state++;}
if(state>3){state=0;}

if(state==0){
  //code for DTMF handling
}else if(state==1){
  //code for bluetooth
}else if(state==2){
  //code for sonar
}else if(state==3){
  //code for line sensors
}


20607: <p>Can I make all in one arduino robot? Example - line follower, bluetooth control, sonar sensor,dtmf in one arduino robot just switch to any mode without change the parts.</p>
 8033: <p>Yes, actually it has been done before (multiple times).
I, along with some other students did such a project at my school.</p>

<p><a href="https://www.youtube.com/watch?v=GTJQ2VXtmk0" rel="nofollow noreferrer">https://www.youtube.com/watch?v=GTJQ2VXtmk0</a>
<a href="https://www.youtube.com/watch?v=sXXh3Q8WoEM" rel="nofollow noreferrer">https://www.youtube.com/watch?v=sXXh3Q8WoEM</a></p>

<p><strong>Materials needed</strong></p>

<ul>
<li>Arduino (or other programmable microcontroller board with voltage regulation)</li>
<li>Battery pack (and charger)</li>
<li>2 to 5 line sensors</li>
<li>ultrasonic sensor</li>
<li>Bluetooth module</li>
<li>Robot chassis</li>
<li>Atleast two motors (with encoders is nicer, but not neccesary)</li>
<li>Motor driving circuitry</li>
<li>Switch and emergency stop button</li>
</ul>

<p>It can be useful to buy a "line follower robot kit"</p>

<p><strong>Connection</strong></p>

<p>This is the connection we used. You're free to make your own adjustments.</p>

<p><a href="https://i.stack.imgur.com/raepe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/raepe.png" alt="enter image description here"></a></p>

<p><strong>Programming</strong></p>

<p>We used a server that (was connected via bluetooth) and has the map and a user-interface.
When you press the end-point on the server, it would generate the shortest route, calculate the directions, and send it to the robot.</p>

<p>The robot would then drive until it comes to a junction and then executes the direction command.</p>

<p>I've attached some preview code. It's better to do it yourself, but if you really don't know where to get started, you can try this.
You will have to implement the low-level code yourself.</p>

<p>The robot will wait for Bluetooth messages. You can set it to a "direct drive" modus or "line following" modus.</p>

<pre><code>void setup() {
  // put your setup code here, to run once:
  setupBluetooth();
  setupUltrasonicSensor();
  setupMotors();
  setupLinesensors();
  state=waiting;
}

void loop() {
  char receivedCharacter = bluetoothReceiveCharacter();

  switch (state) {
    case waiting:
      switch(receivedCharacter){
        case 'd':
          bluetooth.println("Direct Drive enabled!");
          state = directDrive;
        break;
        case 'l':
          bluetooth.println("Line following enabled!");
          state = following;
          motor1.setSpeed(50);
          motor2.setSpeed(50);
        break;
      }
      break;
    case directDrive:
        directDrive(receivedCharacter);
      break;
    case following:
        followLine(receivedCharacter);
      break;
    default:
      bluetooth.println("STATE ERROR!");
      buzzer.buzz();
      led.blink();
    break;
  }
}

void followLine(){
    long distance = ultrasonicSensor.measureDistance();
    unsigned char lineSensorsPattern = lineSensors.getPattern();

    switch(receivedCharacter){
      case 'X':
        bluetooth.println("Line following disabled! (Now waiting)");
        state = waiting;
      break;
    }

    if(distance &gt; 100 || distance == -1){
      switch(lineSensorsPattern){
        case 0b00000000:
          motor1.setSpeed(0);
          motor2.setSpeed(0);
          bluetooth.println("Following interrupted, lost path!");
          findPath();
        break;
        case 0b00000100:
          motor1.setSpeed(100);
          motor2.setSpeed(100);
          bluetooth.println("Following line, middle sensor on.");
        break;
        case 0b00000100:
          motor1.setSpeed(100);
          motor2.setSpeed(100);
          bluetooth.println("Following line, middle sensor on.");
        break;
        case 0b00000110:
          motor1.setSpeed(70);
          motor2.setSpeed(100);
          bluetooth.println("Following line, middle &amp; right sensor on.");
        break;
        case 0b00001100:
          motor1.setSpeed(100);
          motor2.setSpeed(70);
          bluetooth.println("Following line, middle &amp; left sensor on.");
        break;
        case 0b00000010:
          motor1.setSpeed(0);
          motor2.setSpeed(100);
          bluetooth.println("Following line, right sensor on.");
        break;
        case 0b00001000:
          motor1.setSpeed(100);
          motor2.setSpeed(0);
          bluetooth.println("Following line, left sensor on.");
        break;
      }
    }else{
      bluetooth.println("Following interrupted, obstacle in path!");
    }
}

void directDrive(char receivedCharacter) {
  switch (receivedCharacter) {
    case 'X':
      motor1.setSpeed(0);
      motor2.setSpeed(0);
      state = waiting;
      bluetooth.println("Direct Drive disabled! (Now waiting)");
      break;
    case 'w':
      motor1.setSpeed(motor1.getSpeed()++);
      motor2.setSpeed(motor2.getSpeed()++);
      break;
    case 'a':
      motor1.setSpeed(motor1.getSpeed()++);
      motor2.setSpeed(motor2.getSpeed()--);
      break;
    case 's':
      motor1.setSpeed(motor1.getSpeed()--);
      motor2.setSpeed(motor2.getSpeed()--);
      break;
    case 'd':
      motor1.setSpeed(motor1.getSpeed()--);
      motor2.setSpeed(motor2.getSpeed()++);
      break;
  }
}
</code></pre>

<p><strong>My advice</strong></p>

<p>My best advice is to work in iterations. Slowly add more features until you've got the product that you desire. Or develop parts of it individually.</p>

<ol>
<li>Get a bluetooth link working, send some messages back and forth.</li>
<li>Connect motors to an Arduino and chassis let it drive a pre-programmed path.</li>
<li>Get some line sensors to work (non reflecting black tape!)</li>
<li>Get a ultrasonic sensor to work.</li>
<li>Start combining these! Control the robot over bluetooth. Let the robot follow the lines. Add a breaking when it sees something within range.</li>
</ol>

<hr>

<p>As addition/clarification.
You could make a button, that increases the state every time you press it.
If you then check which state the robot is in, you can make it perform his task for that state.</p>

<pre><code>if(buttonPressed){state++;}
if(state&gt;3){state=0;}

if(state==0){
  //code for DTMF handling
}else if(state==1){
  //code for bluetooth
}else if(state==2){
  //code for sonar
}else if(state==3){
  //code for line sensors
}
</code></pre>
