Bluetooth Car Controlled by Mobile Application with Arduino

Bluetooth Car Controlled by Mobile Application with Arduino uno

This robot car can be controlled wirelessly with Bluetooth and an android app, and other than that we have placed RGB Neopixel LEDs on the front, back, and bottom of the robot to make it look cool.

We will also build a custom android app with the MIT app inventor so that we can send commands directly via Bluetooth and control the robot’s movements and also control the LEDs on the robot.

Components Required to Build Wireless Arduino Bluetooth Robot:

1. Arduino UNO = 1
2. HC05 Module = 1
3. L298N Motor driver = 1
4. NeoPixel LED x as required = 4
5. Lithium ion 18650 battery with protection circuit = 1
6. BO Motors with wheels = 4

Chassis for Arduino based Bluetooth Robot:

We will get ready made or Chassis of the Robot is the base/main part of the bot that holds all the circuits of the bot. So, we will be using sunboards to make a reliable and strong chassis.

Arduino Bluetooth Car Circuit Diagram:

The complete circuit diagram for the Arduino Bluetooth Car is shown below.

This circuit is made out of generic components and can be found in your local store or it’s easily available on any online store so the replication process becomes easier.

Android App for our Bluetooth Controlled Robot:

Building the android application was very simple with the app inventor. First, we started by designing the user interface. As you can see on the left-hand side of the image the screenshot is taken from the web GUI of the MIT app inventor and the right-hand side of the image is a screenshot from the phone. Once we were satisfied with the GUI, we proceeded with the logical part of the app.

Copy and Paste the code with Arduino IDE:

#include <SoftwareSerial.h>
#include <LiquidCrystal.h>
SoftwareSerial mySerial(10, 11); // RX, TX
LiquidCrystal lcd(A5,A4,A3,A2,A1,A0);

void setup() 
{
  Serial.begin(9600);
  mySerial.begin(38400);
     lcd.begin(16, 2);
     lcd.clear();

lcd.setCursor(0, 0);
lcd.print("   WELCOME TO   ");
lcd.setCursor(0, 1);
lcd.print(" EEE DEPARTMENT ");
delay(2000);

lcd.clea();
lcd.setCursor(0, 0);
lcd.print(" THANKS TO HOD  ");
lcd.setCursor(0, 1);
lcd.print("Dr.S.CHITRA.M.E ");
delay(2000);
  
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("  SUBMITTED BY  ");
lcd.setCursor(0, 1);
lcd.print("SHUHAIBUDHEEN S ");
delay(2000);

lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" VISHALATCHI A  ");
lcd.setCursor(0, 1);
lcd.print(" KANISH KUMAR S ");
delay(2000);

lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" LINGESHWARAN A ");
lcd.setCursor(0, 1);
lcd.print("   MUKUNTHAN D  ");
delay(2000);

lcd.clear();
lcd.setCursor(0, 0);
lcd.print(" NAVEENKUMAR G  ");
lcd.setCursor(0, 1);
lcd.print(" THANKS TO ALL  ");
delay(2000);

  while (!Serial) 
  {
    ; 
  }
  Serial.println("Sending AT...");
  mySerial.write("AT");

  if (mySerial.available() > 0) 
  {
    Serial.write(mySerial.read());
  }

  Serial.println("loop begins");
  LED_setup();

}

char rcd = ' ';
int spd = 100;
unsigned long time_now = 0;

void loop() 

{
  if (mySerial.available())
  
   {
    rcd = mySerial.read();
    Serial.write(rcd);
  }
  unsigned long time_now = 0;

  if (rcd == 'O')
  {
    R_LED(1);
    L_LED(1);
    F_LED(1);
    B_LED(1);

  }
  if (rcd == 'o')
  {

    R_LED(0);
    L_LED(0);
    F_LED(0);
    B_LED(0);
  }

 if (rcd == 'X')

  { L_LED(1);
  }
  if (rcd == 'x')
  {
    L_LED(0);
  }
  if (rcd == 'P')
  {
    R_LED(1);
  }

  if (rcd == 'p')
  { R_LED(0);

  }
  if (rcd == 'W')

  { F_LED(1);
  }
  if (rcd == 'w')
  { F_LED(0);
  }
  if (rcd == 'U')
  { B_LED(1);
  }

  if (rcd == 'u')
  { B_LED(0);
  }
  if (rcd == '0')
  { spd = 80;
  }
  if (rcd == '1')
  { spd = 100;
  }
  if (rcd == '3')
  { spd = 120;
  }
 if (rcd == '5')
  { spd = 180;

  }
  if (rcd == 'q')
  { spd = 255;
  }

  if (rcd == 'F')
 { Forward();

    time_now = millis();
    while (millis() < time_now + 100) 
    {
    }
  }
  else if (rcd == 'B')

  { time_now = millis();
    while (millis() < time_now + 100) {}
    Backward();
  }

  else if (rcd == 'I')

  { time_now = millis();
    while (millis() < time_now + 100) {}
    FdRight();
  }

  else if (rcd == 'J')

  { time_now = millis();
    while (millis() < time_now + 100) {}
    BkRight();
  }

  else if (rcd == 'R')

  { time_now = millis();
    while (millis() < time_now + 100) 
    {     
    }
    SharpRight();

  }

  else if (rcd == 'L')

  { time_now = millis();

    while (millis() < time_now + 100)
 {
 }
    SharpLeft();
  }

  else if (rcd == 'G')
  { time_now = millis();
    while (millis() < time_now + 100)
 {
 }
    FdLeft();
  }
  else if (rcd == 'H')
  { time_now = millis();

    while (millis() < time_now + 100)
 {
 }
    BkLeft();
  }
  else

    Stop();
}

#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>

#endif
#define F_LED_PIN         12 //Front LED
#define F_LED_PIXEL       6
#define B_LED_PIN         13  //Back LED
#define B_LED_PIXEL       6
#define R_LED_PIN         7 //Right LED
#define R_LED_PIXEL       1
#define L_LED_PIN         8 //Left LED
#define L_LED_PIXEL       1

Adafruit_NeoPixel F_LED_STRIP(F_LED_PIXEL, F_LED_PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel B_LED_STRIP(B_LED_PIXEL, B_LED_PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel R_LED_STRIP(R_LED_PIXEL, R_LED_PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel L_LED_STRIP(L_LED_PIXEL, L_LED_PIN, NEO_GRB + NEO_KHZ800);

void LED_setup()
{
  #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif

  F_LED_STRIP.begin();
  B_LED_STRIP.begin();
  R_LED_STRIP.begin();
  L_LED_STRIP.begin();
  R_LED_STRIP.clear();
  L_LED_STRIP.clear();
  F_LED_STRIP.clear();
  B_LED_STRIP.clear();
}
void R_LED(int a)

{
  if(a==1)
  {
    R_LED_STRIP.clear();
    R_LED_STRIP.setPixelColor(0, R_LED_STRIP.Color(0, 255, 255));
   R_LED_STRIP.show();   // Send the updated pixel colors to the hardware.
  }
  else 
{
    R_LED_STRIP.clear();
     R_LED_STRIP.show();
  }   
}

void L_LED(int a)
{
  if(a==1)
  {
    L_LED_STRIP.clear();
    L_LED_STRIP.setPixelColor(0, L_LED_STRIP.Color(0, 255, 255));
   L_LED_STRIP.show();   // Send the updated pixel colors to the hardware.

  }
  else
  {
     L_LED_STRIP.clear();
     L_LED_STRIP.show();
  }
}

void F_LED(int a)
{
  if(a==1)
  {
    F_LED_STRIP.clear();
    F_LED_STRIP.setPixelColor(0, F_LED_STRIP.Color(255, 255, 255));
    F_LED_STRIP.setPixelColor(1, F_LED_STRIP.Color(0, 0, 50));
    F_LED_STRIP.setPixelColor(2, F_LED_STRIP.Color(0, 0, 50));
    F_LED_STRIP.setPixelColor(3, F_LED_STRIP.Color(0, 0, 50));
    F_LED_STRIP.setPixelColor(4, F_LED_STRIP.Color(0, 0, 50));
    F_LED_STRIP.setPixelColor(5, F_LED_STRIP.Color(255, 255, 255));
   F_LED_STRIP.show();   // Send the updated pixel colors to the hardware.
  }
  else if(a==0)
  {
    F_LED_STRIP.clear();
    F_LED_STRIP.show();
  }
}

void B_LED(int a)
{
  if(a==1)
  {
    B_LED_STRIP.clear();
    B_LED_STRIP.setPixelColor(0, B_LED_STRIP.Color(255, 0, 0));
    B_LED_STRIP.setPixelColor(1, B_LED_STRIP.Color(0, 50, 0));
    B_LED_STRIP.setPixelColor(2, B_LED_STRIP.Color(0, 50, 0));
    B_LED_STRIP.setPixelColor(3, B_LED_STRIP.Color(0, 50, 0));
    B_LED_STRIP.setPixelColor(4, B_LED_STRIP.Color(0, 50, 0));
    B_LED_STRIP.setPixelColor(5, B_LED_STRIP.Color(255, 0, 0));
    B_LED_STRIP.show();   // Send the updated pixel colors to the hardware.
  }
  else if(a==0)
  {
    B_LED_STRIP.clear();
    B_LED_STRIP.show();
  }
}
void Forward()
{
  analogWrite(5, spd);
  digitalWrite(6, 0);
  analogWrite(9, spd);
  digitalWrite(3, 0);
  delay(50);
}
void Backward()
{
  digitalWrite(5, 0);
  analogWrite(6, spd);
  digitalWrite(9, 0);
  analogWrite(3, spd);
}
void Stop()
{
  analogWrite(5, 0);
  digitalWrite(6, 0);
  analogWrite(9, 0);
  digitalWrite(3, 0);
}
void FdRight()
{
  analogWrite(5, spd);
  digitalWrite(6, 0);
  digitalWrite(9, 0);
  analogWrite(3, 0);
}
void BkRight()
{
  analogWrite(5, 0);
  digitalWrite(6, 0);
  digitalWrite(9, 0);
  analogWrite(3, spd);
}
void SharpRight()
{
  analogWrite(5, spd);
  digitalWrite(6, 0);
  digitalWrite(9, 0);
  analogWrite(3, spd);
}
void SharpLeft()
{
  digitalWrite(5, 0);
  analogWrite(6, spd);
  analogWrite(9, spd);
  digitalWrite(3, 0);
}
void BkLeft()
{
  digitalWrite(5, 0);
  analogWrite(6, spd);
  analogWrite(9, 0);
  digitalWrite(3, 0);
}
void FdLeft()
{
  digitalWrite(5, 0);
  analogWrite(6, 0);
  analogWrite(9, spd);
  digitalWrite(3, 0);
}

Keerthi Varman
Keerthi Varman

Keerthivarman completed his graduate at PSG Tech, Coimbatore, TN and also a part-time blogger. He loves to dig into Android Apps, PC Suite and website design, explores everything and shares his knowledge with readers. He always looks forward to increasing productivity and being happy.

Articles: 217

Leave a Reply

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.

×

Hi, How can I help you?

×