Introduction
DF-Bluetooth module V3 adopts a unique double-board design to prevent electrostatic damage to the module as well as providing a beautiful appearance. The module has two DC input ports and can be powered at 3.5~8V wide voltage range or 3.3V, which allows it to be suitable for various scenarios. There are STATE and LINK indicators for displaying the working and connection status of the module (STATE: Search state(high 104ms; cycle 342ms; flashing 2.9Hz); Connection state(high 104ms; cycle 2ms; flashing 0.5Hz) LINK: keep ON when paried). In addition, the module comes with on-board antenna that offers quality singal and longer transmit distance. With transparent serial port, it can be paired with all sorts of Bluetooth adapters or phone's Bluetooth for convenient redevelopment.
The module status can be set by the DIP. Turn off the LINK light via LED off to enter power-saving mode. AT mode can set the module to AT command mode, and the baud rate and mater-slave mode can be revised by AT command. When two such modules are set as master and slave respectively, they can be paired freely for data transmission, which is very suitable for data communication of two MCUs.
Specification
- BLE Chip: CSR BC417143
- Bluetooth Protocol: Bluetooth Specification v2.0 +EDR
- USB Protocol: USB v1.1/2.0
- Working Frequency: 2.4-2.48GHz unlicensed ISM Band
- Modulation Mode: GFSK (Gaussian Frequency Shift Keying)
- Power: ≤4dBm, Class 2
- Transmission Distance: 20-30 in free space
- Sensitivity: ≤-84 dBm at 0.1% BER
- Transmission rate: Asynchronous: 2.1 Mbps (Max)/160 kbps; Synchronous: 1Mbps/1Mbps
- Security: Authentication and encryption
- Support profiles: Bluetooth serial port
- Baud Rate: 4800~1382400/N/ 8/1 Default to 9600/N/ 8/1
- Input Voltage: +3.5V~+8V DC or 3.3V DC/50mA
- Working Temperature: -20°C-+55°C
- Dimension: 40×20×13mm
PinOut
Pin | Definition |
---|---|
GND | GND |
VCC | 3.5-8V DC (When there is VCC input, 3V3 port can be used as 3.3V power output) |
NC | Empty Pin |
RXD | UART Input(TTL Level), connect to MCU TXD |
TXD | UART Output(TTL Level), connect to MCU RXD |
3V3 | DC3.3V (When there is 3.3V input, the VCC port cannot be connected to power source) |
Set module in AT mode
How to enter into AT mode
The DF-Bluetooth V3 module has two switches on the module.
- The NO.1 switch is used to set the LINK-LED on/off for power saving.(1 for off, ON for on)
- The NO.2 switch is used to turn on/off AT mode of the Bluetooth module (On->Enter; 2->Exit)
- In AT mode
- In Functional mode
So if you turn the NO.2 switch on, you can use the AT mode to set the Bluetooth module, e.g. name, baud rate, master/slave mode etc.
Preparation
- USB to TTL Converter x1
- Bluetooth module x1
- Software: CoolTerm, you can also use Arduino IDE serial monitor
Steps
- Part 1: Ready to go
- Plug the Bluetooth module into the USB to TTL module;
- Turn on the AT mode switch of the Bluetooth module;
- Connect the USB to TTL module to your computer;
- Install the driver for the USB to Serial module if it can't be recognized.
- Part 2: Setting
After connecting the module to computer, we can use CoolTerm software to talk with Bluetooth module.
- Click Connection --> Choose Options to set several parameters in CoolTerm.
- Set Serial Port
- Port: the port number can be got from the Device Manager of the computer
- Baudrate: 38400
- Data Bits: 8
- Parity : none
- Stop Bits: 1
- Set Terminal
- Terminal Mode: Line Mode
- Key Emulation: CR+LF
Image:Coolterm Preferences 38400.png|Set Serial Port Image:Coolterm Preferences BT.png|Set Terminal
- Part 3: Setting
Now use the CoolTerm to send AT commands to the Bluetooth Module and see what information the Bluetooth will answer to the computer.
- For example:
- Input: at
- Return: OK
- Input: at+name=DFRobot
- Return: OK
- Input: at+name?
- Return:+name: DFRobot OK
- Input: at+role=0
- Return: OK
- Input: at+role?
- Return: +role:0 OK
- AT+PSWD?
- +PSWD:1234 OK
- AT+ORGL (Restore the default setting:)
- Return: OK
- AT+UART=115200,0,0 Return: OK
- Param1: baud rate (bits/s) 4800/ 9600/ 19200/ 38400/ 57600/ 115200/ 230400/ 460800/ 912600/ 1382400
- Param2: stop bit , 0- 1 bit/ 1- 2 bits
- Param3: parity bit, 0- None/ 1- Odd/ 2- Even
- AT+RESET
- Return: OK
- Default setting
- Device class: 0
- Inquiry code: 0x009e8b33
- Device mode: Slave mode
- Binding mode: SPP
- Serial port: 38400 bits/s; 1 stop bit, no parity (In datasheet, it said the default baud rate is 9600 which is wrong.)
- Pairing code: “1234”
- Device name: “HHW-SPP-1800-2
More AT command can be obtained from the TEL0026_Datasheet.
- Part 4: Exit AT mode
Please turn the AT mode switch off and then repower the Bluetooth module.
Tutorial
Communication between PC and Bluetooth Module
The DF-Bluetooth module is based on the specification of Bluetooth V2.0, compatible with V1.1. A Bluetooth adaptor is required to communicate with the DF-Bluetooth module. When it is paired with other Bluetooth devices, the DF-Bluetooth is always set to slave mode.
The IVT BlueSoleil is recommended to manager all your Bluetooth devices.
STEPS
Step 1: Connect a Bluetooth adapter to the computer so that the computer can find the Bluetooth module.
Step 2: Put the Bluetooth module on the Arduino board
Step 3: Open BlueSoleil software (Figure 1) and right click the yellow ball in the centre screen, click “Search Devices” , an icon named EPBMX-COM will appear after few seconds. The EPBMX-COM is the DF-Bluetooth module.
Step 4: Right click EPBMX-COM icon, click “Pair”. A window will popup ask for PassKey which is “1234” by default (Figure 2).LINK-LED on the Bluetooth will blink if the Pair is successful and the LED is on.
Step 5: Right click EPBMX-COM, click “Search Service”. Then a serial port will appear and right click EPBMX-COM again and choose the choice “Connect Bluetooth Serial Port (C0MXX)” and you can see the LINK-LED on the Bluetooth will be lit if the LED switch is on.
Step 6: Upload test code to Arduino. Please unplug the Bluetooth module from the Arduino board while uploading test code.
void setup()
{
Serial.begin(9600); //Set serial baud rate to 9600
}
void loop()
{
Serial.print("Hello!"); //print out hello string
delay(1000); //1 second delay
}
Result
Plug the Bluetooth module on the Arduino board again after finishing uploading the codes. Then open the serial monitor to see what Arduino is sending to Bluetooth module. You can also use CoolTerm to check the communication.
-
NOTE: Check the serial setting! Make sure the baud rate is set to 9600 on both master and slave. When the DF-Bluetooth is used on Arduino, please make sure you disconnect the DF-Bluetooth module before uploading any code to your Arduino. Or it will fail to upload any sketch as the DF-Bluetooth module occupying the TX/RX pins.
Communication between Two Bluetooth Modules
Step 1: Necessary Hardware
- 2× DFRduino UNO R3
- 2× IO Sensor Expansion Board V7
- 2× DF-Bluetooth Module V3
- 2× USB Cable
- 1× USB to TTL
Step 2: Bluetooth Module Configuration
- Set the two modules to Master and Slave respectively.
- Serial Parameter: set the both modules to 115200 for the convenience of debugging later.
- Connection Mode: if the module cannnot be searched/connected by/with adapter or PC, this parameter needs to be configured:AT+CMODE=1.
Other parameters can directly adopt the default setting. Refer to the setting part above for more details. Master-slave pairing does not need a driver, and the two modules can transmit data when powered on. When the indicator lights LINK on the two Bluetooth modules keep ON, the pairing is successful. At this time, the serial port function has been started. When the master and slave pair are used normally, the lights will not go out. If the distance between the master and the slave is too far and the connection is lost, the lights will keep flashing. Put the two modules closer then they will find each other and connect automatically. The master will remember the slave it has configured, and it will find the slave address it has remembered as soon as it is powered on.
Step 3: Hardware Connection
- Plug the two Bluetooth Modules onto I/O shields respectively, and plug them into UNO boards.
- Connect the two UNO boards to computer via USB cables.
Step 4: Code Burning
- If you are using the new I/O shield, please dial to prog before downloading codes, and then dial back to run when finished.
- If you are using the old I/O shield, then please unplug the Bluetooth module when downloading codes. Replug it after the codes burning is done.
When downloading codes, you don't need to consider the order of master-slave above. Any module can be transmitting end or receiving end.
Codes for transmitting end:
void setup() {
Serial.begin(115200); //init serial and set baud rate to 115200
}
void loop() {
Serial.print("Hello!");
Serial.println("DFRobot");
delay(1000);
}
Codes for receiving end:
void setup() {
Serial.begin(115200); //Init serial port and set baud rate to 115200
}
void loop() {
char val;
val = Serial.read(); //Read serial port
if (val != -1) {
Serial.print(val); //Send out the received data again via serial port
}
}
Result
Open two serial ports and set their bard rate to 115200, check the result.
Transmitting End:
Receiving End:
Communication between Bluetooth module and Android Phone
Step 1: Necessary Hardware
- 1× DFRduino UNO R3
- 1× IO Sensor Expansion Board V7
- 1× DF-Bluetooth Module V3
- 1× USB Cable
- 1× USB to TTL
- Android Phone of specified model (See details below)
Step 2: Bluetooth Module Configuration
Same as above.
Step 3: Hardware Connection
- Plug the Bluetooth Module onto I/O shields, and plug it into UNO board.
- Connect the UNO board to computer via USB cable.
Step 4: Download and Install APP
Open Bluetooth Termial to download and install the APP.
If you cannot install, please click to check if your phone is on the list. If not, then sorry you cannot use this APP.
You can directly install Google Play Store on your phone, then search this APP in it.
Step 5: Pair your phone with the Bluetooth module and connect
- Open the Bluetooth settings of the mobile phone, and make pairing. The password is 1234.
- Select "Connect a device-Secure", then the following box will pop up. Click Bluetooth_V3 to start connecting.
- The indicator LINK will keep ON when connected sucessfully.
Step 6: Burn test code into UNO
Note:
- When burning the program to UNO, please select the serial port number of UNO instead of Bluetooth. The baud rate setting in the program should be consistent with that of your Bluetooth module.
- If you are using the new I/O shield, please dial to prog before downloading codes, and then dial back to run when finished.
- If you are using the old I/O shield, then please unplug the Bluetooth module when downloading codes. Replug it after the codes burning is done.
If the connection is lost during code downloading, please reconnect and try.
- UNO-->Transmitting END, Phone-->Receiving End, burn the codes.
void setup()
{
Serial.begin(115200); //Init serial port and set baud rate to 115200
}
void loop()
{
Serial.print("Hello!"); //Serial port send out string
Serial.println(" DFRobot"); //Serial port send out string with carriage return
delay(1000); //delay
}
We can see the data sent by UNO when the burning is done.
- UNO--->Receiving end, Phone--->Transmitting end, burn the codes.
void setup(){
Serial.begin(115200); //Init serial port and set baud rate to 115200
}
void loop(){
char val;
val = Serial.read(); //Read serial port
if(val!=-1){
Serial.print(val); //Send out the received data again via serial port
}
}
Result
When the burning is done, input a string on the phone, then we can see the data UNO received on the serial monitor. As shown below:
FAQ
Q1. I want to use it as a wireless module on Arduino, and use my phone as a controller, can it be possible? |
A1. Welcome! For sure it is possible.
Q2. In the AT command list manual, some AT commands (e.g. AT+DISC etc.) seem to be useless cause I sent them to the device, but got "Error: (16)", is the AT commands given wrong or I missed anything? |
A2. Please check the Appendix 1: AT command error in that manual, 16 means "SPP is not initialized", so please send "AT+INIT" to initialize the SPP before sending other AT commands like you mentioned.
Q3. How can I find or pair with this BT V3 module through my pc or phone when it was run in AT mode? i.e. the AT selection switch was put at AT side. |
A3. Please enter AT mode, send "AT+INIT" first, after a while, send "AT+DISC", wait a second, you could find the BT module in your PC/ phone Bluetooth panel. Default pairing code is: "1234".
For any question/ advice/ cool idea to share with us, please visit DFRobot Forum