SETUP BLUETOOTH MODULE AS MASTER OR SLAVE

setup bluetooth

Wiring arduino and bluetooth module as above. Upload this sketch

also you can setup bluetooth without arduino, see on https://arduinoproyek.wordpress.com/setup-bluetooth-with-ftdi232/

#include <SoftwareSerial.h>

SoftwareSerial BTserial(2, 3); // RX | TX

// Connect the HC-05 TX to Arduino pin 2 RX.

// Connect the HC-05 RX to Arduino pin 3 TX through a voltage divider.

char c = ‘ ‘;

void setup()

{

Serial.begin(9600);

Serial.println(“Arduino is ready”);

Serial.println(“Remember to select Both NL & CR in the serial monitor”);

// HC-05 default serial speed for AT mode is 38400

BTserial.begin(38400);

}

void loop()

{

// Keep reading from HC-05 and send to Arduino Serial Monitor

if (BTserial.available())

{

c = BTserial.read();

Serial.write(c);

}

// Keep reading from Arduino Serial Monitor and send to HC-05

if (Serial.available())

{

c = Serial.read();

BTserial.write(c);

}

}

Prefer upload with Arduino IDE version 1.6.xx.

After upload completted, disconnect VCC jumper from bluetooth module, than press small button on the bluetooth module, hold press and reconnect VCC jumper to bluetooth module, than release button, LED on module will flushing every two second, module now ready to be in AT command. Next, open serial monitor with baud rate 9600 and Both NL & CR, than follow below steps :

Setup for slave :

type AT than enter, it will get message OK,

type AT+ROLE=0 than enter, it will get message OK,

type AT+ADDR? it will get message +ADDR:2016:10:315904 ——-> write this number on paper, this will be used for address bind to master.

Now slave module ready to be used,

bluetooth slave

Setup for master:

type AT than enter, it will get message OK,

type AT+ROLE=1 than enter, it will get message OK,

type AT+CMODE=0 it will get message OK,

type AT+BIND=2016,10,315904, it will get message OK,

Now master module ready to be used,

bluetooth master

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s