Arduino: Project 33: Bluetooth Controlled Robocar!

So this was an exciting robotics project! I’ve basically built a robocar which can be controlled by your phone using Bluetooth.

Demo:

Things Required:

  1. Arduino UNO
  2. USB Cable
  3. L293D IC
  4. Jumper wires
  5. Batteries 1.5V (x4)
  6. Battery Case
  7. 9V battery
  8. Bluetooth Module
  9. Car Chassis
  10. DC-Motor (x4)
  11. Breadboard
  12. Wheels (x4)

Reference Material:

  1. Wiring of L293D- (LINK)
  2. Another Useful Link: (LINK)

Code:

View on/ Download from Github: (LINK)

const int LeftForward=4;
const int LeftBackward=5;
const int RightForward=2;
const int RightBackward=3;
int ins;

void setup() {
  pinMode(LeftForward, OUTPUT);
  pinMode(LeftBackward, OUTPUT);
  pinMode(RightForward, OUTPUT);
  pinMode(RightBackward, OUTPUT);
  Serial.begin(9600);
}


void loop() {
  while(Serial.available()>0){
    ins= Serial.read();
    Serial.print(ins);
    Serial.print("\n");

    if (ins==1){
      move_forward();
    } else if (ins==2){
      move_backward();
    } else if (ins==3){
      move_left();
    } else if (ins==4){
      move_right();
    } else if (ins==5){
      move_stop();
    }
  }
}

void move_stop(){
  digitalWrite(LeftForward, LOW);
  digitalWrite(LeftBackward, LOW);
  digitalWrite(RightForward, LOW);
  digitalWrite(RightBackward, LOW);
}

void move_forward(){
  digitalWrite(LeftForward, HIGH);
  digitalWrite(LeftBackward, LOW);
  digitalWrite(RightForward, HIGH);
  digitalWrite(RightBackward, LOW);
}

void move_backward(){
  digitalWrite(LeftForward, LOW);
  digitalWrite(LeftBackward, HIGH);
  digitalWrite(RightForward, LOW);
  digitalWrite(RightBackward, HIGH);
}

void move_left(){
  digitalWrite(LeftForward, HIGH);
  digitalWrite(LeftBackward, LOW);
  digitalWrite(RightForward, LOW);
  digitalWrite(RightBackward, HIGH);
  delay(500);
}

void move_right(){
  digitalWrite(LeftForward, LOW);
  digitalWrite(LeftBackward, HIGH);
  digitalWrite(RightForward, HIGH);
  digitalWrite(RightBackward, LOW);
  delay(500);
}

Stay Tuned for upcoming posts on Arduino Projects! Want to be the first to know when a new and amazing post comes up?? Then feel free to subscribe!

Happy Learning!!

This image has an empty alt attribute; its file name is stay-tuned.gif

Leave a Reply

PHP JS HTML CSS BASH PYTHON CODE

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close