Wireless Robo-car Using 360° Servo Motor

by Jestin_Cubetech in Circuits > Arduino

8117 Views, 27 Favorites, 0 Comments

Wireless Robo-car Using 360° Servo Motor

DSC_0967.jpg
DSC_0842.jpg
smart car robot using 360 Degree continuous rotation servo motor.

Components

5346b04526ece2a157000038.jpg
DSC_0961.jpg
DSC_0972.jpg
DSC_0951.jpg
DSC_0952.jpg
DSC_0955.jpg
DSC_0957.jpg
DSC_0950.jpg
DSC_0803.jpg
DSC_0782.jpg
DSC_0791.jpg
DSC_0783.jpg

Making Steps

DSC_0777.jpg
DSC_0778.jpg
DSC_0796.jpg
DSC_0801.jpg
DSC_0804.jpg
DSC_0806.jpg
DSC_0809.jpg
DSC_0814.jpg
DSC_0960.jpg
DSC_0958.jpg

Prototype

DSC_0958.jpg
DSC_0975.jpg
DSC_0806.jpg

Wireless Communication System -zigbee

DSC_0969.jpg
DSC_0971.jpg
DSC_0972.jpg
DSC_0951.jpg
DSC_0950.jpg
DSC_0799.jpg

Program

DSC_0974.jpg
#include <Servo.h>

///////////////////////////// KEYS /////////////////////////////
#define FWD_KEY     'W'
#define BWD_KEY     'S' 
#define QUICK_L_KEY 'Q'
#define QUICK_R_KEY 'E' 
#define TRNL_L_KEY  'A' 
#define TRNL_R_KEY  'D'
#define STOP_KEY    ' '
#define KEY_DLY     200
///////////////////////////////////////////////////////////////////
#define STOP_L 95 
#define STOP_R 95 

#define FWD_L 0 
#define FWD_R 360 

#define BWD_L 180
#define BWD_R 0 

#define QTRNL_L STOP_L+5 
#define QTRNL_R FWD_R 

#define QTRNR_L FWD_L 
#define QTRNR_R STOP_R-5 

#define TRNL_L STOP_L 
#define TRNL_R FWD_R 

#define TRNR_L FWD_L 
#define TRNR_R STOP_R

/////////////////////////////////////////////////////////////////////

Servo left_servo,right_servo;  // create servo object to control a servo
unsigned char incomingByte=0;
unsigned int count=0;


int potpin = 0;  // analog pin used to connect the potentiometer
int val;    // variable to read the value from the analog pin

void setup()
{
   Serial.begin(9600);
  left_servo.attach(2);  // attaches the servo on pin 9 to the servo object
  right_servo.attach(3);  // attaches the servo on pin 10 to the servo object
  left_servo.write(STOP_L);
  right_servo.write(STOP_R);
}

void loop()
{
 
   if(Serial.available() > 0)
   {
     incomingByte =Serial.read();
   }
  
   if(incomingByte==FWD_KEY)
  {
    left_servo.write(FWD_L);
right_servo.write(FWD_R);
incomingByte='X';
        count=0;
  }
  else if(incomingByte==BWD_KEY)
  {
    left_servo.write(BWD_L);
right_servo.write(BWD_R); 
incomingByte='X';
        count=0;
  }
  else if(incomingByte==QUICK_L_KEY)
  {
    left_servo.write(QTRNL_L);
right_servo.write(QTRNL_R);
    incomingByte='X';
    count=0;
  }
  else if(incomingByte==QUICK_R_KEY)
  {
    left_servo.write(QTRNR_L);
right_servo.write(QTRNR_L);
    incomingByte='X';
    count=0;
  }
    else if(incomingByte==TRNL_L_KEY)
  {
    left_servo.write(TRNL_L);
right_servo.write(TRNL_R);
    incomingByte='X';
    count=0;
  }
  else if(incomingByte==TRNL_R_KEY)
  {
    left_servo.write(TRNR_L);
right_servo.write(TRNR_R);
    incomingByte='X';
    count=0;
  }
   else if(incomingByte==STOP_KEY)
  {
    left_servo.write(STOP_L);
right_servo.write(STOP_R);
    incomingByte=0;
    count=0;
  }
else if(incomingByte=='X')
{
    if(++count>KEY_DLY)
{
left_servo.write(STOP_L);
right_servo.write(STOP_R);
count=0; incomingByte=0;
}
     delay(1);
}

}

Downloads

Videos

Robo Car Using PIC16F877A

DSC_0806.jpg