Diy Bluetooth Controlled Robot & Android App

About: An Electronics engineer and a hobbyist. I love to keep experimenting with microcontrollers.

Hello guys today we will make a Bluetooth controlled robot using arduino. Well the name of this project itself gives you the idea about it. We will be using a HC05 module to control the robot. And that's not it I will also share the sceenshots of how I made the Bluetooth control application using the MIT app inventor 2. So read the complete instructable. Lets begin!!!

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Things We Need

I suggest you to buy the components from UTSource.net as they provide wide range of electronics components and modules for you to choose from. They also provide PCB Design services at affordable rates. So do check them out.

For making this project gather the following components -

1. Arduino Uno

2. HC-05 Bluetooth Module

3. L293d Motordriver Module

4. Metal Chassis with wheels and motors

5. Connecting wires

6. A battery to power the robot. (For demonstration I used a 5V adapter)

Step 2: Circuit Diagram

Follow the schematic above to make the connections. If you plan on using a voltage higher than 5V to power the project then just connect the Bluetooth Module's Vcc pin to the Arduino's 5V instead of the motor driver's power input pin. If you ignore that you will end up frying your Bluetooth Module.

Refer the next two images for more help.

Step 3: Arduino Code

Copy the code below and paste it in your Arduino Ide. Or you can directly download the .ino file from below.

//Motor A 
const int motorPin1  = 9;  //DECLARE ARDUINO PINS FOR MOTORS
const int motorPin2  = 10;  
//Motor B
const int motorPin3  = 11; 
const int motorPin4  = 3; 
void setup() 
{
pinMode(motorPin1, OUTPUT); 
pinMode(motorPin2, OUTPUT);  //DECLARE PIN MODES
pinMode(motorPin3, OUTPUT);
pinMode(motorPin4, OUTPUT);
Serial.begin(9600);
}
void loop()
{
if(Serial.available() > 0) 
{
char MState = Serial.read();
Serial.println(MState);
if(MState == 'F')
{
    digitalWrite(motorPin1, HIGH);
    digitalWrite(motorPin2, LOW);//FORWARD
    digitalWrite(motorPin3, HIGH);
    digitalWrite(motorPin4, LOW);
}
if(MState == 'L')
{
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, LOW);//LEFT
    digitalWrite(motorPin3, HIGH);
    digitalWrite(motorPin4, LOW);
}
if(MState == 'R')
{
    digitalWrite(motorPin1, HIGH);
    digitalWrite(motorPin2, LOW);//RIGHT
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, LOW);
}
if(MState == 'B')
{
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, HIGH);//BACKWARD
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, HIGH);
}
if(MState == 'S')
{
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, LOW);//STOP
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, LOW);
}
if(MState == 'W')//L360
{
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, HIGH);//LEFT 360
    digitalWrite(motorPin3, HIGH);
    digitalWrite(motorPin4, LOW);
}
if(MState == 'X')//R360
{
    digitalWrite(motorPin1, HIGH);
    digitalWrite(motorPin2, LOW);//RIGHT 360
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, HIGH);
}
if(MState == 'Y')//TL
{
    digitalWrite(motorPin1, LOW);
    digitalWrite(motorPin2, HIGH);//LEFT 90
    digitalWrite(motorPin3, HIGH);
    digitalWrite(motorPin4, LOW);
    delay(2000);
    digitalWrite(motorPin1, HIGH);
    digitalWrite(motorPin2, LOW);//FORWARD
    digitalWrite(motorPin3, HIGH);
    digitalWrite(motorPin4, LOW);
}
if(MState == 'Z')//TR
{
    digitalWrite(motorPin1, HIGH);
    digitalWrite(motorPin2, LOW);//RIGHT 90
    digitalWrite(motorPin3, LOW);
    digitalWrite(motorPin4, HIGH);
    delay(2000);
    digitalWrite(motorPin1, HIGH);
    digitalWrite(motorPin2, LOW);//FORWARD
    digitalWrite(motorPin3, HIGH);
    digitalWrite(motorPin4, LOW);
}
}
}

Note : Don't forget to disconnect the TX and Rx connection between the Arduino and the Bluetooth Module. Or else you won't be able to upload the code to your Arduino Board.

Step 4: Making of the Android Application

Making the android application is very easy. Go to App Inventor 2 . Refer the screen shots above to design the application.

Step 1 :Open your browser and search for MIT App Inventor 2. Then log in using your gmail address. A window will appear showcasing your previous projects or if you are using this for the first time it will be empty.

Step 2 :Now click on Start New Project. Give a suitable name to your project and click OK. This will lead you to a new screen where you will see a smartphone screen like interface. Over to your left will be Palette which will contain all the essential components for building your app. And to the right will be the properties of the highlighted components.

Step 3 :Now click on the screen and you will be able to see its properties. In that section search for Icon tab. Click on it and add a Icon for your new application.

Step 4 :Now to Layout in the Palette section and add a Horizontal Layout to the screen. Just drag and drop.In properties set its width to fill parent. Now go to User Interface and drag and drop a label to the screen and set it width to fill parent. Remove the text in the text box and align it to center. From the same palette drag and drop List Picker inside the horizontal arrangement and set its width to fill parent. In its properties go to Image and add a new image. Don't forget to remove the text inside the Text tab.

Step 5:Now go to Layout and drag and drop Table Arrangement on the screen. Set the rows and columns to 3 and click on fill parent.

Step 6 :Again go to user interface and add 5 buttons inside the Table Arrangement. Change their text and names. Adjust them by changing their widths in order to make them fit in the table.

Step 7 :Now go to connectivity and drag and drop Bluetooth Client to the screen. Then go to sensors and similarly add a clock. That's it you are done with the designing part. Now it is time to code the blocks. Click on the Blocks button on the top right corner.Now follow the steps shown in the above images and join the blocks accordingly.

If you have any problem understanding the block feel free to leave a comment below. I will answer all your doubts.

Those who are not interested in making the application by them-self can simply download it from the link given below.

Click Here to Download

While installing this application make sure you enable "installing applications from unknown sources" on your smart phone.

Step 5: Working Video of the Project

I have included a video showing the working of this project. For the data-saver squad, you guys can simply see the working in the gif I have included.

If you like my work then please share it with your friends. Also follow me here to see my upcoming instructables.

That's it for now guys. See you soon with another project.

Be the First to Share

    Recommendations

    • Instrument Contest

      Instrument Contest
    • Make it Glow Contest

      Make it Glow Contest
    • STEM Contest

      STEM Contest

    Discussions