Maverick Den STEM Robotics Pvt. Ltd.
Email: info@maverickden.com
Contact No. : 7715916683 (India)
60123250147 (Malaysia)

Start Your Career with STEM Based Robotics (In 6/12 Weeks Internship)

BLUETOOTH CONTROLLED ROBOT

Bluetooth is a wireless technology standard for exchanging data over short distances (using short-wavelength UHF radio waves in the ISM band from 2.4 to 2.485 GHz) from fixed and mobile devices, and building personal area networks (PANs). Range is approximately 10 Meters (30 feet). These modules are based on the Cambridge Silicon Radio BC417 2.4 GHz BlueTooth Radio chip. This is a complex chip which uses an external 8 Mbit flash memory.

HC-05 PinOut

  • KEY:If brought HIGH before po wer is applied, forces AT Command Setup Mode. LED blinks slowly (2 seconds)
  • VCC:+5 Power.
  • GND: System / Arduino Ground.
  • TXD:Transmit Serial Data from HC-05 to Arduino Serial Receive.( NOTE: 3.3V HIGH level: OK for Arduino )
  • RXD:Receive Serial Data from Arduino Serial Transmit.
  • STATE:Tells if connected or not.

COMPONENTS USED :

SR NO COMPONENT NAME QUANTITY
1 Arduino Board(Uno or Nano) 1
2 Mini BreadBoard 1
3 Motor Driver(L293D)- 1
4 Battery Holder 1
5 BO motor 2
6 Bluetooth Module HC-05 1
7 Caster wheel 1
8 Wheels 2
9 Jumper cables (M to F and M to M) 1 set of each


Schematic Diagram :

Code : 

int Motor_A_Reverse = 5;

int Motor_A_Forward = 4;

int Motor_B_Reverse = 3;

int Motor_B_Forward = 2;

 

void setup() {

// put your setup code here, to run once:

Serial.begin(9600);

 

//pinMode(Motor_A_Enable, OUTPUT);

pinMode(Motor_A_Forward, OUTPUT);

pinMode(Motor_A_Reverse, OUTPUT);

 

// pinMode(Motor_B_Enable, OUTPUT);

pinMode(Motor_B_Forward, OUTPUT);

pinMode(Motor_B_Reverse, OUTPUT);

}

 

void loop() {

 

if(Serial.available() > 0)

{

char data;

data = Serial.read();

 

switch (data)

{

case ‘A’: //FORWARD

//analogWrite(Motor_B_Enable, 100);

//analogWrite(Motor_A_Enable, 100);

digitalWrite(Motor_A_Reverse, LOW);

digitalWrite(Motor_B_Reverse, LOW);

digitalWrite(Motor_A_Forward, HIGH);

digitalWrite(Motor_B_Forward, HIGH);

break;

case ‘B’: //REVERSE

//analogWrite(Motor_B_Enable, 100);

//analogWrite(Motor_A_Enable, 100);

digitalWrite(Motor_A_Forward, LOW);

digitalWrite(Motor_B_Forward, LOW);

digitalWrite(Motor_A_Reverse, HIGH);

digitalWrite(Motor_B_Reverse, HIGH);

break;

case ‘C’: //FORWARD RIGHT

digitalWrite(Motor_B_Forward, LOW);

digitalWrite(Motor_B_Reverse, LOW);

 

digitalWrite(Motor_A_Reverse, LOW);

digitalWrite(Motor_A_Forward, HIGH);

break;

case ‘D’: //FORWARD RIGHT

digitalWrite(Motor_A_Reverse, LOW);

digitalWrite(Motor_A_Forward, LOW);

digitalWrite(Motor_B_Reverse, LOW);

digitalWrite(Motor_B_Forward, HIGH);

break;

case ‘b’: //REVERSE LEFT

digitalWrite(Motor_B_Forward, LOW);

digitalWrite(Motor_B_Reverse, LOW);

digitalWrite(Motor_A_Reverse, HIGH);

digitalWrite(Motor_A_Forward, LOW);

break;

case ‘a’: //REVERSE RIGHT

digitalWrite(Motor_A_Reverse, LOW);

digitalWrite(Motor_A_Forward, LOW);

digitalWrite(Motor_B_Reverse, HIGH);

digitalWrite(Motor_B_Forward, LOW);

break;

default: //If bluetooth module receives any value not listed above, both motors turn off

digitalWrite(Motor_A_Reverse, LOW);

digitalWrite(Motor_A_Forward, LOW);

digitalWrite(Motor_B_Forward, LOW);

digitalWrite(Motor_B_Reverse, LOW);

break;

}

}

}