Menu Close

Robo India PC Controlled Robot on The Arduino Robotic Kit

Robo India presents PC controlled robot on The Arduino Robotic Kit, You may control your robot through PC. Software is provided for Microsoft Windows. 

Where to Buy.

Buy on Amazon Prime – click here

Buy on Robo India – click here

1. Introduction:

A step by step guide for to make PC Controlled Robot on The Arduino Robotic Kit.

You may need this tutorial to assemble the chassis. While you assemble chassis. Here is the basic robot assembly of The Arduino Robotic Kit.

There is no need of any assembly just plug USB cable to the Arduino board and PC/Laptop.

2. Assembly and Connections

After assembling the robot make the connection as given in the following diagram. The Power Jumper on the motor shield works as Switch to motor it will be useful while debugging.

2.1 Assembly

Assembly of PC controlled robot is simple no need to assemble additional things than basic Chassis, Arduino Board and Shield.

2.2 Testing motor Connection

It is difficult to find GND and positive supply terminal of motor. Transfer the following code to the Arduino Board. The robot should move in forward direction, if it not doing so, interchange the of the wire of motor. e.g. suppose left motor is rotating in back ward direction and right motor is rotating in forward direction then you have to interchange the wires of M3 terminal.

You may download this sketch from here.

//Robo India Line follower Tutorial
// This codes runs robo int the forward direction.

// Shield Pins Declaration 
int dataPin = 8;        
int latchPin = 12;
int clockPin = 4;
int en = 7;
void setup()
{
    pinMode(dataPin, OUTPUT);     // Setting up the motor shield. 
    pinMode(latchPin, OUTPUT);
    pinMode(clockPin, OUTPUT);
    pinMode(en, OUTPUT);    
    digitalWrite(en, LOW); 
 
 forward(); // This funtion for forward robot motion
 
  
 }

void loop()
{
}

void forward(void){
        digitalWrite(latchPin, LOW);            
        shiftOut(dataPin, clockPin, LSBFIRST, 3);
        digitalWrite(latchPin, HIGH);  

}

void backward(void){
        digitalWrite(latchPin, LOW);            
        shiftOut(dataPin, clockPin, LSBFIRST, 164);
        digitalWrite(latchPin, HIGH);  
}

void turn_left(void){
        digitalWrite(latchPin, LOW);            
        shiftOut(dataPin, clockPin, LSBFIRST, 161);
        digitalWrite(latchPin, HIGH);  
}

void turn_right(void){
        digitalWrite(latchPin, LOW);            
        shiftOut(dataPin, clockPin, LSBFIRST, 38);
        digitalWrite(latchPin, HIGH);  
}

void halt(void){
        digitalWrite(latchPin, LOW);            
        shiftOut(dataPin, clockPin, LSBFIRST, 32);
        digitalWrite(latchPin, HIGH);  
}


2.3 Programming PC Controlled Robot – 

The programme for PC controlled robot. This programme reads serial data and acts accordingly. Details of the data is mentioned ahead.

It has following predefined function for robot motion-

1. forward() : forward movement of robot.

2. backward() : backward movement of robot.

3. turn_left() : for turning left.

4. turn_right(): for turning right.

5. halt() : for stopping robot.

You may download this sketch from here.

// Robo India PC Controlled Tutorial
// www.roboindia.com
// declaring Motor Shield
int dataPin = 8;        
int latchPin = 12;
int clockPin = 4;
int en = 7;

void setup()
{   // setting up Motor Shield. 
    pinMode(dataPin, OUTPUT);      
    pinMode(latchPin, OUTPUT);
    pinMode(clockPin, OUTPUT);
    pinMode(en, OUTPUT);    
    digitalWrite(en, LOW);   
    
    Serial.begin(9600); // Intializing Serial Communication.
}

void loop()
{
while(Serial.available())
  {     
  char option = Serial.read();
  
  switch (option)
  {
    case 70:   // 70 is ASCII code for - F
    forward();
    break;
    case 66:   // 66 is ASCII code for - B
    backward();
    break;
    case 76:   // 76 is ASCII code for - L
    turn_left();
    break;
    case 82:   // 82 is ASCII code for - R
    turn_right();
    break;
    case 83:  // 83 is ASCII code for - S
    halt();
    break; 
  }
}
}

void forward(void){  // function for forward movement. 
        digitalWrite(latchPin, LOW);            
        shiftOut(dataPin, clockPin, LSBFIRST, 3);
        digitalWrite(latchPin, HIGH);  

}

void backward(void){   // function for forward movement. 
        digitalWrite(latchPin, LOW);            
        shiftOut(dataPin, clockPin, LSBFIRST, 164);
        digitalWrite(latchPin, HIGH);  
}

void turn_left(void){   // function for left turn. 
        digitalWrite(latchPin, LOW);            
        shiftOut(dataPin, clockPin, LSBFIRST, 161);
        digitalWrite(latchPin, HIGH);  
}

void turn_right(void){   // function for Right turn. 
        digitalWrite(latchPin, LOW);            
        shiftOut(dataPin, clockPin, LSBFIRST, 38);
        digitalWrite(latchPin, HIGH);  
}

void halt(void){        // function for stopping robot. 
        digitalWrite(latchPin, LOW);             
        shiftOut(dataPin, clockPin, LSBFIRST, 32);
        digitalWrite(latchPin, HIGH);  
}


 2.4 Software

The software we are using here sends serial data to the comport at 9600 baud rate. The data and the related operations are as follows –

Forward – F

Backward – B

Left – L

Right – R

Stop – S

You may test the robot programme at serial terminal by sending above mentioned character set.

download software from here.

After downloading extract the folder and run .exe file. You will need to once disconnect your arduino USB cable, reconnect it and enter the port no. and press open button. If you enter correct port no., the other functions will be activated. Before closing the software press close button.


3. Resources:

Where to Buy.

Buy on Amazon Prime – click here

Buy on Robo India – click here

This motor shield is based on Adafruit Motor Shield. Resources can be found here.

download software for PC Controlling.

If you have any query please write us at support@roboindia.com

Thanks and Regards
Content Development Team 
Robo India
https://roboindia.com

Leave a Reply