What is Bluetooth?
?? It can also be said that Bluetooth technology. The so-called Bluetooth technology, actually a short-range radio technology, was invented by Ericsson company. The use of "Bluetooth" technology can effectively simplify communication between mobile devices such as handheld computers, laptops and mobile phone devices, and can also successfully simplify communication between these equipment and internet Internet, so that the transmission between these modern communications equipment and the Internet becomes more rapid and efficient , widening the road for wireless communication.
Introduction to Bluetooth version
?? Bluetooth development has undergone 8 versions of the update so far. 1.1, 1.2, 2.0, 2.1, 3.0, 4.0, 4.1, 4.2, 5.0. Of course, 5.0 of the Bluetooth module Google has been released, but the market has not seen 5.0 of Bluetooth devices. Then we are looking forward to the arrival of 5.0 Bluetooth devices!
?? So between the 1.x~3.0 we call the traditional Bluetooth, 4.x started Bluetooth we call low-power Bluetooth is Bluetooth ble, of course, 4.x version of Bluetooth is backwards compatible. Android phones must be system version 4.3 and above to support the BLE API.
Bluetooth 2.0 Standard:
- Bluetooth 2.0 Standard 2.0 is an improved version of 1.2, with a transfer rate of about
1.8M/S~2.1M/S,
- Start to support duplex mode------------for voice communication while also transferring files/high quality images
- 2.0 version of course also supports Stereo operation.
- The most widely used is the Bluetooth 2.0+EDR standard, which was introduced in 2004, and the products that support the Bluetooth 2.0+edr standard also appeared in 2006.
- Although the Bluetooth 2.0+EDR standard has been extensively improved in technology, it is from 1. The problem of the complexity of the configuration process and the large power consumption of the device continue to exist.
Advantages:
- The amount of data can be larger, the phone does not need Bluetooth 4.0
Disadvantages:
- MFI certification is required, after certification can buy Apple-specified decryption chip, can use Bluetooth transmission data. MFI certification about 99,000 USD/product, certification cycle of about half a year.
- Bluetooth 2.1+MFI authentication chip, can support Apple iPhone4, iphone4s, iPhone5, etc. with Bluetooth 2.1 above the function of Apple iOS device
Bluetooth V2.1+EDR:
The 2.1+EDR version has a theoretical transfer rate of 2.1Mbps faster than the 2.0 version. and joined the "Sniff subrating" technology. This technique saves power by setting the transmit interval between 2 devices to confirm the signal to each other. This technology can extend battery life by up to 5 times times for hardware devices that require continuous streaming of data, such as keyboards, mice, and so on.
Bluetooth 3.0 Standard:
- April 21, 2009, Bluetooth Technology Alliance (bluetooth® SIG) formally promulgated a new generation of standard specification "Bluetooth core Specification version 3.0 High speed" (Bluetooth kernel Specification version 3.0)
- The core of Bluetooth 3.0 is the "Generic Alternate mac/phy" (AMP), a new alternate RF technology that allows the Bluetooth protocol stack to dynamically select the correct RF for any task.
- The data transfer rate of Bluetooth 3.0 is increased to approximately 24Mbps (you can call 802.11 wi-Fi for high-speed data transfer when needed).
- On the transfer speed, Bluetooth 3.0 is eight times times the Bluetooth 2.0, it can be easily used for video recorder to HDTV, PC to PMP, UMPC to the data transfer between the printer, but need both sides to achieve this standard to realize the function.
Advantages
- Compared to the V2.1+EDR version, the V3.0 data transfer rate theory has reached 24Mbps, which can be used for data transmission between HDTV, laptop, tablet and printer.
- At the same time, the enhanced power control mechanism is introduced in relation to 2.1+edr,3.0, which makes the power consumption of idle time decrease obviously.
Bluetooth 4.0 Standard:
- The Bluetooth 4.0 specification was officially released on July 7, 2010, and the new version has the greatest significance in low power consumption
- While enhancing device compatibility between different OEMs and reducing latency, the theoretical maximum transfer rate is still 24Mbps (i.e. 3mb/s) and the effective coverage range is extended to 100 meters (prior to 10 meters).
- The standard chip is used by a large number of mobile phones, tablets, such as Apple's New ipad tablet, and Apple iphone 5, Meizu MX4, HTC one x and other mobile phones with Bluetooth 4.0 features.
Advantages:
- Do not need to do Apple decryption chip, do not need MFI apple certification.
Disadvantages:
- The amount of data is not too large, the phone must be Bluetooth 4.0; (Bluetooth 4.0 can support Apple
- Iphone4s, IPhone5 and other Bluetooth 4.0-capable Apple iOS devices)
The advantages are mainly reflected in:
- 1, it has a 3.0 Bluetooth version of more than 30% of the battery life. That is, under the same power, when the Bluetooth 3.0 version of the power consumption has reached 100%, Jack's electricity only 70%, not even.
- 2, high out of 3.0 Bluetooth version 4 times times more noise reduction technology. Its CVC6.0 noise cancelling technology, more than the 3.0 version of the CVC4.0 noise-cancelling technology to a higher level, deeper noise reduction, so that every call you, each song can be at your fingertips.
- 3, more than 4.0 version of the true smart -80HZCPU, 3.0 Bluetooth version 5 times times more than the wireless transmission rate. Faster transfer speeds allow you to enjoy a smoother experience, whether you're listening to a song, a call, or a game.
- At present, 4.0 Bluetooth is the best, the transmission rate is the largest, distance is also far, standby time is the longest, save battery.
Compatibility:
Bluetooth 4.0 has several modes, and if it is a Bluetooth 4.0 low power mode device (often called ble mode), it is not backwards compatible.
Now mainstream 4.0BLE bluetooth ble (4.x) low power Bluetooth
-
- Low power Bluetooth compared to traditional Bluetooth, faster transmission speed, wider coverage, higher security, shorter delay, low consumption and other advantages
-
- Traditional through the socket way, and low-power Bluetooth is achieved through the GATT protocol.
PS: If you have not done traditional Bluetooth development before, it is also possible to get started with low power Bluetooth development directly. Because they have changed in the communication protocol, the correlation is not big. Of course, it is interesting to download some traditional Bluetooth development demo to see
?? Now we are in a Bluetooth 4.x era. Before this, as we often use the Bluetooth headset has crossed a lot of versions of Bluetooth headset has v1.1 v1.2 v2.0 v2.1 ... And so many versions, what are the advantages? Of course, the higher the version, the better the signal, more than 2.0 Bluetooth stereo support.
So now we are in the 4.x of equipment is mostly in the master-slave mode.
What is master-slave mode
A main device such as a mobile phone, a Slave device (also become a sub-device or slave) active search from the machine can be sent can also receive, from the machine can also be sent and received, but can only be searched
The active search slave can be sent or received from the machine can also be sent and received but can only be searched.
Common Bluetooth module BLE operating mode
There are four modes of working with Bluetooth modules that are common to ble single devices:
* ##### Main Device mode
* ##### from Device mode
* ##### Broadcast Mode
* ##### Mesh Networking mode
So what's the situation with these four models, then we continue to drive
1. Main device mode
?? The usr-ble100 supports the main device mode and can be connected to a slave device. In this mode, you can search around the device and select the connection from the device you want to connect to. You can also set the default connection from the MAC address of the device, so that the module can find and connect to the module after it has been power-up. And the whitelist feature is supported, the user simply needs to write the Mac of the device to be connected to the whitelist, and the module will connect when it searches for a whitelist-compliant device.
?? The user does not need to pay attention to the data conversion between serial data and wireless packets, and can realize the transparent communication between the main device serial port and the serial port of the device through simple parameter setting.
?? The host connection from the device can be divided into 3 different ways:
The first way to use search, you need to set the following parameters before using:
- (1) Set the operating mode as the main device mode at+mode=m
- (2) Open search mode At+scan
- (3) If the search is from the device, if the sequence number is 1, you can use the Quick Connect command to connect. At+conn=1
(4) After the setup, wait for the light to be steady on behalf of the successful connection, at this time two serial ports can be transparent transmission of data.
The second way?? If you know the MAC address of the slave device you want to connect to, you can also connect in the following way:
(1) Use Mac bind at command to set module power-on default connection from device MAC address at+connadd=ffffffffff11
-
(2) After the setup is complete, restart the module using the Restart command, and the address of the slave device to which the module is connected after reboot.
At+z
2. From device mode ?? BLE is supported from device mode, in this mode fully complies with the BLE4.1 protocol, users can develop their own apps according to the protocol. This mode contains a serial port service, the user can find it through the UUID, there are two channels, respectively, is read and write. The user can manipulate the two channels for data transmission.
?? If the user uses USR-BLE100 's main device to connect with the slave device, then there is no need to pay attention to the Protocol, the two devices of the serial port directly to the data transparent transmission, for the user to establish a simple wireless transmission channel.
? In this mode, the user needs to set the module's operating mode to slave device mode. Users who develop their own app need the UUID of our module to connect, the UUID is: 0x31,0x01,0x9b,0x5f,0x80,0x00,0x00,0x80,0x00,0x10,0x00,0x00,0xd0,0xcd,0x03, 0x00 We provide a sample program for the connection.
- (1) Sets the module to operate from the device, the instruction is At+mode=s
- (2) The user can query the connection of the module by the following instruction At+link
- (3) The user can also use the following command to disconnect the connection now At+disconn
- (4) If you do not want the module to be discovered and connected, you can use the following command to turn off broadcast data At+adp=off
3. Broadcast mode ?? For example, USR-BLE100 supports broadcast mode, in which the module can broadcast more than one pair. The user can set the module broadcast data through the AT command, the module can be broadcast continuously in the low power mode, apply to the very low power consumption, small data volume, unidirectional transmission application, such as wireless meter reading, indoor positioning and other functions.
?? Common Bluetooth module mode of operation
In this mode, the user can set up the module for small data broadcast, the user needs to invoke the BLE standard interface for the app development, and the data needs to be set using the AT command.
-(1) First set the module mode to broadcast mode at+mode=b
-(2) Use the AT command to set the module to send data, data bit 16 binary length of not more than 30 bytes, broadcast format please refer to the BLE protocol. at+advdata=0201041aff4c000215b9407f30f5f8466eaff925556b57fe6d0001000251
-(3) through the Bluetooth monitoring software can get to listen to the packet, as follows
4. Mesh Networking Mode
?? USR-BLE100 supports mesh networking mode, in which the module can implement a simple self-set network, each module only need to set the same communication password can be added to the same network, each module can initiate data, each module can receive data and reply. And does not require a gateway, even if a device fails, it skips and selects the closest device for transmission.
?? USR-BLE100 Support mesh Networking mode, can easily add multiple modules to the network, the use of Star network and relay technology, each network can connect more than 65,000 nodes, the network and network can also interconnect, the end can be countless Bluetooth modules through mobile phones, Connected or directly controlled by a tablet or PC. And does not require a gateway, even if a device fails, it skips and selects the closest device for transmission. The entire networking process only need to power on the device and set the communication password can be automatically set up network, truly simple interconnection.
-(1) First we need to switch the module mode to mesh networking mode
At+mode=f
-(2) Set the communication password, the inter-module network is differentiated by the password at+pass=123456
-(3) Restart the module, the module into the networking mode At+z
-(4) At this point we will set up a plurality of modules in this way, when a module serial port to send data, the surrounding modules will be received, and then output to the serial port, and then send the data to the surrounding data module, and so on.
-(5) When the device that receives the data needs to reply the direct serial port sends, finally the module that sends the first time receives the reply, completes the network internal communication.
Android ble bluetooth Communication learning "This is an in-depth understanding of Android Bluetooth: Bluetooth" Foundation, has been working with the medical treatment, to do some Bluetooth-related apps, so look up some data research summed up, the application of things summed up a bit. Next, look forward to ——-in-depth understanding of Android Bluetooth: Bluetooth "advanced chapter"
If you feel that this article is helpful to you, welcome to group QQ Exchange Group: 232203809
Public Number: Terminal Research and Development department
(Welcome to learn and Exchange)
Learn more about the basics of Android Bluetooth bluetooth--