BUILD AN ARDUINO BLUETOOTH APP USING HC-06

About: Electronics Engineering Student , Who fall in love with electronics and coding ,i wasted a lot time in my childhood i didn't think electronics will be so important to me , but i am not giving up now nad t...

Intro: BUILD AN ARDUINO BLUETOOTH APP USING HC-06

Descriptions :

In this Instructable we will look at a wireless Bluetooth connection between android phone and Arduino. We will use the popular and low cost HC-06 Bluetooth module to create the Bluetooth signal from the Arduino. To create the Android App I use the MIT App Inventor II, which is an easy to use graphical programming interface.

Step 1: Components Needed :

HARDWARE:

1. hc-06 or hc-05 bluetooth module

2-of course and micro controller I'am going just use a arduino uno

3.a module relay(I mad an inconstructible here ) // or not if your are going to use just and led

4. resistor ( 2.2 k ohm x 1) (3.3 k ohm x 1).

5. LED or bulb lamp .

6. General purpose PCB 10. Breadboard and Jumpers.

* Relay are generally use with the arduino in case of high voltage ,for example an 220v ac to turn on/off a cafe machine *

Step 2: Schematic :

Setting up the hc-06 (or hc-05 )The hc-06 has 6 pins: we are going only to use VCC, GND, TXD, RXD .

You need to check your bluetooth module but generally you can deliver to VCC pin from 3.3v to 5v ,but for RX of the bluetooth module you need to downshift the 5v comming from the arduino to 3.3v ,it can not handel 5v .

I use only resistor to divide the voltage from 5v to 3.3v using 2.2 k ohm from arduino pin and 3.3 k ohm to gnd .

* When powering the bluetooth hc-06 a red led Should be blinking *

Step 3: The App :

This app was made using app inventor II : http://appinventor.mit.edu/explore/ (An interface development of android app developed by the MIT )

I made the Buttons and background image using Photoshop if you want to do a tutorial on the entier app just ask it in the comment below .

You can find The App and the inventor project here GitHub .

Step 4: The Arduino Ide Code :

#include

SoftwareSerial HC06(11,10) ; // declare the hc06 module to be used with and serial communication

const char DOUT_LED = 2;

String messageReceive; // declare a variable string for stocking the messages transmited by the bluetooth

void setup() {

Serial.begin(9600);

HC06.begin(9600); // Initialise the series communications

pinMode(DOUT_LED, OUTPUT);

digitalWrite(DOUT_LED, LOW);

}

void loop() {

while(HC06.available()) { // Detect the presence of message

delay(3);

char c = HC06.read();

messageReceive += c; } // If there is then read the message char by char

if (messageReceive.length() >0) {

Serial.println(messageReceive);

if (messageReceive == "led:on") // If message receive is "led:on" then turn on the led

{digitalWrite(DOUT_LED, HIGH);}

if (messageReceive == "led:off") // Same for off

{digitalWrite(DOUT_LED, LOW);}

messageReceive="";

} }

Step 5: Connecting to Bluetooth :

On your phone :

1 . First go on your settings

2 .Activate bleutooth .

3 .You will see aprear HC-06 Connect to it and enter the code usually it's (1234) .

4 .After installing the app earlier Launch it .

5 .And there You go ! You have bluetooth connected lamp or led .

Now you can do what ever you want with this Module be creative ;)

Share

    Recommendations

    • Tiny Home Contest

      Tiny Home Contest
    • Fix It! Contest

      Fix It! Contest
    • Furniture Contest 2018

      Furniture Contest 2018

    Discussions