Remote Robot Using Android

1,366

24

8

About: Electronics Component - PCB [Design, Printing, Inserting] - Electronic Programming

In this tutorial, we will share a tutorial about robotics combined with smartphones, which is how to control the robot by using the smartphone via Bluetooth. Smartphones are installed with applications to transmit data from smartphone to robot. Then the robot will read the commands from the HC-05 Bluetooth Module. The commands used are forward, backward, rotate left, turn right and stop.

Step 1: Materials You Need

You will need:

  1. HC-05 Bluetooth Module
  2. Board BlueBot
  3. Arduino Nano
  4. Motor DC 5 Volt
  5. BlueBot Mechanics

Step 2: Schematic

Once the components have been collected, connect each component according to the schematic above.

Step 3: Step by Step

First, create a view on your smartphone using MIT App Inventor as follows.

Second, as for the controller blocks that need to be made is a notification when the software first run, it will show a notification to turn on bluetooth if not yet on. The second block is ListPicker component that is used to see the list of bluetooth available (block before picking). Block after picking is used to pick up the bluetooth to be connected. The next block is the disconnected block, which is the block used to disconnect the smartphone with the HC-05 bluetooth module.

In the left.Click block is used to send the letter L from smartphone to Arduino via HC-05 Bluetooth Module. Likewise with right.Click is used to send the letter R to Arduino and for other functions just change the letter to be sent. Then build project into APK.

Step 4: Sketch

After creating the program for android, the next step is the receiver program in arduino. In this arduino program is quite simple because it only read the serial commands that are sent bluetooth. Here's the program listing on arduino.

#include <SoftwareSerial.h>
SoftwareSerial mySerial(2, 3); // RX, TX
#define button1 13
#define button2 12
#define pwmOne 5
#define inAOne 4
#define inBOne 9
#define pwmTwo 6
#define inATwo 8
#define inBTwo 7
void setup() {
// put your setup code here, to run once:
pinMode(button1, INPUT_PULLUP);
pinMode(button2, INPUT_PULLUP);
pinMode(pwmOne, OUTPUT);
pinMode(inAOne, OUTPUT);
pinMode(inBOne, OUTPUT);
pinMode(pwmTwo, OUTPUT);
pinMode(inATwo, OUTPUT);
pinMode(inBTwo, OUTPUT);
Serial.begin(9600);
mySerial.begin(38400);
}
char readSerial;
void loop() {
if(mySerial.available())
{
readSerial = mySerial.read();
} switch(readSerial)
{
case 'F': forward(70,70); Serial.println("F"); break;
case 'B': reverse(70,70); Serial.println("B"); break;
case 'L': turnLeft(70,70); Serial.println("L"); break;
case 'R': turnRight(70,70); Serial.println("R"); break;
case 'S': stopRun(); Serial.println("S"); break;
}
}
void forward(int valLeft, int valRight)
{
digitalWrite(inAOne, LOW);
digitalWrite(inBOne, HIGH);
analogWrite(pwmOne, valLeft);
digitalWrite(inATwo, HIGH);
digitalWrite(inBTwo, LOW);
analogWrite(pwmTwo, valRight);
}
void reverse(int valLeft, int valRight)
{
digitalWrite(inAOne, HIGH);
digitalWrite(inBOne, LOW);
analogWrite(pwmOne, valLeft);
digitalWrite(inATwo, LOW);
digitalWrite(inBTwo, HIGH);
analogWrite(pwmTwo, valRight);
}
void turnRight(int valLeft, int valRight)
{
digitalWrite(inAOne, LOW);
digitalWrite(inBOne, HIGH);
analogWrite(pwmOne, valLeft);
digitalWrite(inATwo, LOW);
digitalWrite(inBTwo, HIGH);
analogWrite(pwmTwo, valRight);
}
void turnLeft(int valLeft, int valRight)
{
digitalWrite(inAOne, HIGH);
digitalWrite(inBOne, LOW);
analogWrite(pwmOne, valLeft);
digitalWrite(inATwo, HIGH);
digitalWrite(inBTwo, LOW);
analogWrite(pwmTwo, valRight);
}
void stopRun()
{
digitalWrite(inAOne, HIGH);
digitalWrite(inBOne, HIGH);
analogWrite(pwmOne, 0);
digitalWrite(inATwo, HIGH);
digitalWrite(inBTwo, HIGH);
analogWrite(pwmTwo, 0);
}

Step 5: Check Video to Know More

Share

    Recommendations

    • PCB Contest

      PCB Contest
    • First Time Author

      First Time Author
    • Toys Contest

      Toys Contest

    8 Discussions

    0
    None
    Glumgad

    1 year ago

    Nice project!

    Where did you buy "Board BlueBot". I can't google it )

    1 reply
    0
    None
    sfeelectronicsEdwardF2005

    Reply 1 year ago

    Hi, we use http://duniarobotika.com/2017/09/15/motor-dc-gearbox-5v-roda/ for our motor dc.. :)

    0
    None
    kksjunior

    1 year ago

    Nice, i could use this as a base for my upcoming project! Thanks

    1 reply