Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
rename BT modules
06-03-2014, 11:08 PM (This post was last modified: 06-04-2014 02:21 AM by steamboat.)
Post: #1
rename BT modules
If you buy a new BT module it has a pre installed name like HC-06. This name can be seen from your Android or Apple cell phone or tablet.

Switch on your BT in your phone.
Search for BT devices at your phone.

My Android phone displays the individual BT module number first
like "20:14:04:02:32:04"
than after a while it will show the BT module as "HC-06".

If you like to give your BT module a personal look and/or want to use more than one BT modules / RepWalkers at home and like to identify it by name you can rename the BT module with an easy Arduino code. Uses the AT command "AT+NAMExxxxxx" while xxxxxx stands for a 20 character long free to choose device name.

This is all the code you need to copy into your Arduino

void setup() {
Serial.begin(9600);
delay(1000);
Serial.print("AT+NAMEShellmo_01");
delay(1000);
}

void loop() {
}


Connect the BT module to the Arduino


BT Module <-> Arduino
GND <-> GND
VCC <-> 5V
TXD <-> RX (Pin 0) // you have to cross bind RX and TX!
RXD <-> TX (Pin 1)


Be sure your Phone is not connected with the BT module - (BT module should blink).

Press the reset button at the Arduino once. Wait a second.

Disconnect the BT module from power for a while - this makes the new settings effective.
(This is the theorie - with the module I got the change takes effect even without disconnecting the BT module from power)

Reconnect the BT module to power and you will find the BT module as Shellmo_01 in your Android device - this may take a while... Maybe you have to try it twice because the hardware address like "20:14:04:02:32:04" is still the same and the phone has to make a more deeper communication with the BT module to get it's new name!

[Image: 2014-06-03.142308-k.jpg]


In the same way you also can change the PIN and the baud rate:


Serial.print("AT+PIN4321"); // new pin = 4321
delay(1000);
Serial.print("AT+BAUD7"); // set baud rate 7 = 57600
delay(1000);



The Baud rate is coded like this:

1---------1200
2---------2400
3---------4800
4---------9600 (Default)
5---------19200
6---------38400
7---------57600
8---------115200
9---------230400
A---------460800
B---------921600
C---------1382400


You can run in trouble with the easy script because the BT serial communication runs at the same "port" as the Arduino communication to the PC. You can avoid this by using an additional soft serial port and using this for the communication with the BT module. Use this code:

#include <SoftwareSerial.h>

//Bluetooth pins
int softRx = 2;
int softTx = 3;
SoftwareSerial softserial(softRx, softTx);

void setup() {
softserial.begin(9600);
delay(1000);
softserial.print("AT+NAMERadow_06");
delay(1000);
}

void loop() {
}


And this pinning:

BT Module <-> Arduino
GND <-> GND
VCC <-> 5V
TXD <-> RX (Pin 2) // you have to cross bind RX and TX!
RXD <-> TX (Pin 3)


If you like you can change this script so that the serial monitor will write direct to the BT module. Please take care not sending a CR or LF with the serial monitor. You can switch this on and off at the bottom line of the serial monitor.

Rainer
http://www.steamboating.de
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
rename BT modules - steamboat - 06-03-2014 11:08 PM

Forum Jump:


User(s) browsing this thread: 1 Guest(s)