Introduction: Arduino Bluetooth Control Basic Tutorial

In this tutorial I'll show you, How to control Arduino with your smart phone using, My app developed with app inventor 2.

Step 1: Things You Need

Hardware

    • Arduino
    • Bluetooth Module HC 05/06
    • LED
    • 220Ω Resistor
    • 2.2KΩ Resistor
    • 4.7Ω Resistor
    • Android device

    Software

    • Arduino IDE
    • App Inventor 2 (for create your app).

    Step 2: Watch the Video Tutorial

    Step 3: Schematics

    The circuit is so simple:

    Arduino Pins: Breadboard: Resistor: Bluetooth Module:

    • RX (Pin 0)--------------------------2.2KΩ--------------TX
    • TX (Pin 1)------------------------------------------------RX
    • 5v-----------------------------------------------------------5v
    • Gnd--------------------------------------------------------Gnd
    • Pin2,Gnd-------Led----------------220Ω
    • RX------------------------------------4.7Ω---------------Gnd


    Notes and Tips: You need to remove the RX and TX cables when you’re uploading the sketch to your Arduino.

    If the HC-05 Bluetooth Module asks for a password, It’s’1234′.

    Sometimes people connect the TX from the bluetooth module to the TX of the Arduino… that’s wrong and it won’t work. Make sure you connect it properly, the TX into RX and the RX into the TX.

    Step 4: Arduino Sketch

    int ledblue=2;

    int tx=1;

    int rx=0;

    char inSerial[15];

    void setup(){ Serial.begin(9600);

    pinMode(ledblue, OUTPUT);

    pinMode(tx, OUTPUT);

    pinMode(rx, INPUT);

    allpinslow();

    }

    void loop()

    { int i=0;

    int m=0;

    delay(500);

    if (Serial.available() > 0) { while (Serial.available() > 0) { inSerial[i]=Serial.read();

    i++; }

    inSerial[i]='\0';

    Check_Protocol(inSerial); }}

    void allpinslow() { digitalWrite(ledblue, HIGH);

    digitalWrite(ledblue, LOW); } void Check_Protocol(char inStr[]){ int i=0;

    int m=0;

    Serial.println(inStr);

    if(!strcmp(inStr,"2off")){ //Led Off allpinslow();

    digitalWrite(ledblue, LOW); Serial.println("Blue Off");

    for(m=0;m<11;m++){ inStr[m]=0;} i=0;} if(!strcmp(inStr,"2on")){ //Led on allpinslow();

    digitalWrite(ledblue, HIGH);

    Serial.println("Blue on"); for(m=0;m<11;m++){ inStr[m]=0;} i=0;} else{ for(m=0;m<11;m++){ inStr[m]=0; } i=0;

    }}

    Step 5: Android Application

    App Inventor 2 project file:Designer and Blocks code.