With the rapid development of Bluetooth technology, many excellent products have emerged in the Bluetooth chip market. CSR's BlueCore series products, Bmadcom's BCM series products and TI's CC2540 series products are widely used. Among them, TI's CC2450 and CSR's CSR1000 chips are very suitable for Bluetooth 4.0 application solutions.
This article selects TI's CC2450F128 chip as the Bluetooth communication chip, which provides a true single-chip low-power Bluetooth BLE solution capable of running applications and BLE protocol stack. The CC2450F128 integrates a high-performance, low-power 8051 microprocessor core. It provides 128KB of Flash memory on-chip and supports UART and USB communication interfaces externally, so it is very suitable for Bluetooth 4.0 application solutions.
1 overall designThis design provides a good general solution for Bluetooth 4.0-based devices and helps to develop devices for specific applications. The overall architecture of the system is shown in Figure 1. In the overall system architecture diagram, there are two main parts: handheld devices and Bluetooth devices that support Bluetooth 4.0. The handheld device supporting Bluetooth 4.0 can be such as a smart phone, a tablet computer, etc.; the Bluetooth device is the solution provided in this article. Data transmission between Bluetooth 4.0 enabled handheld devices and Bluetooth devices via Bluetooth 4.0 protocol provides data solutions for Bluetooth headsets, mobile phone anti-lost applications and wireless camera applications.
Figure 1 System overall architecture block diagram
It is not difficult to see from the overall system block diagram of the system that the design supports one-to-many communication connections, that is, each handheld device supporting Bluetooth 4.0 can establish a connection with multiple Bluetooth devices at the same time, which greatly facilitates the expansion of application functions. .
2 detailed design and implementationThis section will provide a solution for Bluetooth devices in the overall architecture block diagram of the system. Here, TI's CC2450F128 chip is selected as the Bluetooth communication chip. The biggest feature of this chip is that it can provide a true single-chip low-power Bluetooth BLE solution, which can run applications and BLE protocol stacks, and is simple and efficient to use.
2.1 CC2450F128 peripheral circuit design
The peripheral circuit schematic of the low-power Bluetooth chip CC2450F128 is shown in Figure 2. It can be seen from Fig. 2 that the CC2450F128 chip generally requires two clock crystals, and the most core part is the circuit design of the antenna, and the impedance matching needs to be adjusted according to actual needs. Since the CC2450F128 chip uses the 8051 microprocessor core, it can provide multiple IO pins externally for other business logic implementations.
Figure 2 CC2450F128 peripheral circuit schematic
2.2 Communication protocol extension
Another important part of the solution is the design and extension of its communication protocol. It is often necessary to extend its configuration in accordance with the Bluetooth 4.0 communication protocol, including the Setvice configuration and the Character configuration.
For example, you can first add a Service with a UUID of 00001802-0000-1000-8000-00123456789b, and then add a Characteristic with a UUID of 00002a06-0000-1000-8000-00123456789b for the service.
It is usually necessary to divide a plurality of functional categories according to the business logic of the application, and then subdivide the functional categories. Each function class corresponds to a Service, and each function segment corresponds to a Characteristic. In general, each application can include multiple Service, and each Service can include multiple Characters.
3 system performance analysisThe solution provided in this paper is to solve the communication problem of Bluetooth 4.0-based devices, so we must focus on several key factors that affect its communication: signal strength, device discovery time, stability and false positive rate.
3. 1 relationship between signal strength and distance
Signal strength is one of the most important factors determining the quality of Bluetooth 4.0 communication. In order to clarify the actual signal strength attenuation, in-depth actual data measurement is performed. The raw data plot of the relationship between signal strength and distance is shown in Figure 3. In Figure 3, the blue intersection shows 492 sets of data. From Figure 3, it can be seen that the overall trend of signal strength is more obvious. The data at the same distance is relatively concentrated, and some data have fluctuations.
Figure 3 Raw data plot of signal strength versus distance
In order to better analyze the data in Figure 3, the data needs to be processed. Firstly, based on the distance, the six signal strength data at the same distance are averaged, and then the data is fitted to the processed data to obtain the relationship between signal strength and distance.
The relationship between signal strength and distance is shown in Figure 4. In FIG. 4, the red intersection indicates 82 sets of data after the mean processing of the six pieces of signal intensity data at the same distance, and the blue line indicates the curve after fitting the 82 sets of data. It can be seen from Fig. 4 that the signal intensity decays rapidly within 1 m, then gradually decreases with increasing distance, and fluctuates during the decay process.
Figure 4 Diagram of signal strength versus distance
According to the law of signal strength and distance in Figure 4, it can be used in the application of Bluetooth ranging. In the implementation, it is necessary to consider the fluctuation factor of the Bluetooth signal strength itself, and use the method of multiple sampling and historical data correction to deal with it reasonably. Data to obtain valid data available to improve the stability of the system itself.
3.2 Device discovery time and distance relationship
Device discovery time is another of the most important factors in evaluating Bluetooth 4.0 communication quality. When using a Bluetooth device, the first step before communication is to scan the Bluetooth device. However, during the scanning process, the device discovery time is greatly correlated with the distance. In order to clarify the internal relationship, in-depth actual data measurement is performed. The statistical data of the relationship between the time and distance of the sorted device is shown in Table 1.
Table 1
It is not difficult to see from Table 1. The overall trend is that the closer the distance is, the shorter the device discovery time is; the farther the distance is, the longer the device discovery time is. When the distance exceeds 10 m, the device finds a very long time or cannot find the device. Therefore, in practical applications, it is necessary to consider the performance parameters of the system and select a suitable communication distance.
3.3 stability and false positive rate
3.3.1 Equipment Discovery Stress Test
In order to verify the stability of the solution, 100 Bluetooth devices were used within 10 m for device discovery stress testing. After the stress test, it was revealed that scanning was performed using 100 Bluetooth devices. The closer the device is, the higher the frequency is found, and the farther the device is, the lower the frequency is found. The overall discovery rate of the device can reach nearly 90%, and 10% of the devices are not found. The main reason is that the device signal is close to the nearest device, which is easy to be discovered and takes priority in resources.
3.3.2 Device connection test
The connection test of the device has a great relationship with the hardware device and the software design of the upper layer. In theory, the number of device connections is not limited, but the number of device connections varies greatly depending on the actual hardware and software resources and the application scenarios. Here, our prototype device is very stable when connecting 3 Bluetooth devices at the same time. It is more stable when connecting 5 Bluetooth devices. When connecting more Bluetooth devices, it will not connect.
3.3.3 Equipment false alarm rate test
In the actual application, the current connection status of the Bluetooth device will be considered. Since the device finds a very long time or cannot discover the device when the distance exceeds 10 m, the logic in the application usually considers that the Bluetooth device has been disconnected, so a 10 m false alarm rate test is performed. In this test, the Bluetooth device is first connected, and then moved to a position less than 10 m to check that it has indicated that the connection has been disconnected. After 100 tests, it found that the false positive rate at the position of about 10 m is about 15%, which will be affected by the logic of the software.
4 ConclusionThis paper designs and implements a communication scheme based on Bluetooth 4.0 from the perspective of practical application. The solution provides a low-power Bluetooth solution that supports simultaneous communication across multiple devices. The actual experimental test results show that the communication distance has a great influence on the received signal strength, device discovery time and false alarm rate of the Bluetooth device. The design provided in this paper has been verified by a large amount of data, which can better complete the Bluetooth 4.0 communication function, provide the ability of multi-device discovery and connection, and the application scheme based on signal strength ranging.
Wuxi Lerin New Energy Technology Co.,Ltd. , https://www.lerin-tech.com