loading

BELIEVE IF YOU CAN!

This is the Easiest Arduino-Bluetooth Control Tutorial Eeeevur!

You will need:

- Arduino Board and its USB cable(I used Arduino Nano. UNO and Leonardo also works)

- Bluetooth Module (I used HC-05. Anyone works (I think))

- 4 "female jumpers"

- Android App "Arduino Bluetooth Controller"

- The Arduino Sketch attached to this project.

In this example I just turned on and off the Arduino LED attached to digital pin 13. It means that you can open the sketch and modify the pin you want to control.

Feel free to modify the parameters.

Step 1: Connect Bluetooth Module on Arduino

You can use any Bluetooth module, the important is to connect the correct pins:

Module | Arduino
VCC | 3.3V

GND | GND

TX | RX

RX | TX

Then Connect Arduino Board on Computer

Step 2: Arduino Sketch

Open your Arduino IDE, copy and paste the code below or download the .ino file:

--------- DISCONNECT THE TX AND RX PINS WHEN UPLOAD THE SCRIPT TO ARDUINO BOARD --------------

...And re-connect when the upload finishes

<p>/*Sketch made on 01-Feb-2017<br> * Vitor Domingues
 * vitordomingues@ymail.com
 * 
 */</p><p>void setup() {
  pinMode(13,OUTPUT); //define pin 13 as output
  Serial.begin(9600); //Start Serial Communication (bluetooth)
  
}</p><p>void loop() {
  
  if(Serial.available()){       //check if the module is receiving anything via bluetooth
    int recebe = Serial.read(); //"recebe" is portuguese for "receive"
    Serial.println(recebe);     //show on Serial Monitor the value received via bluetooth
    if(recebe-48 == 1){         //The value is added on 48 units because of the comms protocol
      digitalWrite(13,HIGH);    //turns on the LED attached to pin 13 (change 13 to any other pin number if you want)
    }
    else if(recebe-48 == 2){    //if the received value is 2...
      digitalWrite(13,LOW);     //turns off the LED attached to pin 13
    }
  }
  
  
  delay(100);</p><p>  
  // put your main code here, to run repeatedly:</p><p>}</p>

Step 3: The Android App

- Download the Android App to your Android Device:

https://play.google.com/store/apps/details?id=com....

- Open the App when the download finishes and search for the module on the Bluetooth Devices list

- Tap HC-05 and if it requests the password or pin code, type 0000 or 1234

- Select the "Switch Mode"

- Go on the configurations and tap on the "On" icon to configure the "message" to be sent as "1" (see the image)

- Configure the "Off" icon to "2" and tap the upper-left corner icon to leave configuration

Step 4: Play!

Touch the App switch to turn on and off the Arduino LED attached.

Open the Serial Monitor on Arduino IDE and observe the messages being printed as well as you turn on and off the App switch.

That's it!

Didn't I say it's easy?

<p>Thanks for sharing :)</p>

About This Instructable

590views

16favorites

Bio: Control and Automation Engineering Graduation Student (Mechatronics), interested in diferent ways of making by CNC, 3D Printer, as well as electronic boards and programming. Intended ... More »
More by Vitor Shaft:Easiest Arduino Bluetooth Control With Android 
Add instructable to: