qazx7283
Published

Arduino Bluetooth Remote Car

This is the remote car which controller can control it on the phone through the Bluetooth.

IntermediateFull instructions provided3 hours1,671
Arduino Bluetooth Remote Car

Things used in this project

Hardware components

Battery Holder, 18650 x 2
Battery Holder, 18650 x 2
×1
Dual H-Bridge motor drivers L298
SparkFun Dual H-Bridge motor drivers L298
×1
Arduino Nano R3
Arduino Nano R3
×1
HC-05 Bluetooth Module
HC-05 Bluetooth Module
×1
led 0805 red
×7
led 0805 white
×8
18650 battery
×2

Story

Read more

Schematics

Bluetooth car

internal picture

Code

Bluetooth car

C/C++
 //  2020/1/3 adapted by Zach
 
 int outPin1 = 5;     //motor1
 int outPin2 = 6;    //motor1

 int outPin3 = 10;   //motor2
 int outPin4 = 11;   //motor2
 int red = 2;
 int white=3;

 char bt = 0;       //BT 
 

 void setup()
 {
   Serial.begin(9600);
   
   pinMode(outPin1,OUTPUT);
   pinMode(outPin2,OUTPUT);
   pinMode(outPin3,OUTPUT);
   pinMode(outPin4,OUTPUT);
   pinMode(red,OUTPUT);
   pinMode(white,OUTPUT);
 }
 void loop()
 {
   if (Serial.available() > 0) //save incoming data to variable 'bt'
   {
     bt = Serial.read();

     digitalWrite(white,HIGH);

   
     if(bt == 'F')           //move forwards
     {
       digitalWrite(outPin1,HIGH);
       digitalWrite(outPin2,LOW);
       digitalWrite(outPin3,LOW);
       digitalWrite(outPin4,LOW);
       digitalWrite(red,LOW);
     }
     else if (bt == 'B')      //move backwards
     {
       digitalWrite(outPin1,LOW);
       digitalWrite(outPin2,HIGH);
       digitalWrite(outPin3,LOW);
       digitalWrite(outPin4,LOW);
       digitalWrite(red,HIGH);
     }
     else if (bt == 'S')     //stop!!
     {   
       digitalWrite(outPin1,LOW);
       digitalWrite(outPin2,LOW);
       digitalWrite(outPin3,LOW);
       digitalWrite(outPin4,LOW);
       digitalWrite(red,LOW);
       
     }
     else if (bt == 'R')    // turn wheels right
     {
       digitalWrite(outPin3,LOW);
       digitalWrite(outPin4,HIGH);
       digitalWrite(outPin1,LOW);
       digitalWrite(outPin2,LOW);
       digitalWrite(red,LOW);
     }
     else if (bt == 'L')     //turn wheels left
     {
       digitalWrite(outPin3,HIGH);
       digitalWrite(outPin4,LOW);
       digitalWrite(outPin1,LOW);
       digitalWrite(outPin2,LOW);
       digitalWrite(red,LOW);
     }
     else if (bt== 'G')      //move forward left
     {
      digitalWrite(outPin1,HIGH);
      digitalWrite(outPin2,LOW);
      digitalWrite(outPin3,HIGH);
      digitalWrite(outPin4,LOW);
      digitalWrite(red,LOW);
     }
     else if (bt== 'I')      //move forward right
     {
      digitalWrite(outPin1,HIGH);
      digitalWrite(outPin2,LOW);
      digitalWrite(outPin3,LOW);
      digitalWrite(outPin4,HIGH);
      digitalWrite(red,LOW);
     }
     else if (bt== 'H')      //move backward left
     {
      digitalWrite(outPin1,LOW);
      digitalWrite(outPin2,HIGH);
      digitalWrite(outPin3,HIGH);
      digitalWrite(outPin4,LOW);
      digitalWrite(red,LOW);
     }
     else if (bt=='J')       //move backward right
     {
      digitalWrite(outPin1,LOW);
      digitalWrite(outPin2,HIGH);
      digitalWrite(outPin3,LOW);
      digitalWrite(outPin4,HIGH);
      digitalWrite(red,LOW);
     }
      
   }
   
 }

Credits

qazx7283

qazx7283

2 projects • 2 followers
Thanks to DIY Builder.

Comments