Arduino Hands-on-BT05 Bluetooth 4.0BLE Module
The concept of 37 sensors and actuators has been widely circulated on the internet, but in reality, Arduino is compatible with more than just these 37 types of sensor modules. Considering that I have accumulated some sensor and actuator modules on hand, following the principle that practice makes perfect (hands-on experience is essential), with the aim of learning and exchanging knowledge, I am preparing to conduct a series of experiments one by one. Regardless of whether they are successful (program runs smoothly) or not, I will document the process - whether it's a small progress or an issue that couldn't be resolved, I hope to spark discussions and inspire further exploration.
【Arduino】168 Sensor Module Series Experiments (Data Code + Simulation Programming + Graphical Programming)
BT-05 Bluetooth 4.0 BLE Module with Serial Port CC2541 Compatible with HM-10 Bluetooth AT09 Module
BT-05 Bluetooth 4.0 BLE Module
CC2541 is a power-optimized true System-on-Chip (SoC) solution designed for low-energy and proprietary 2.4GHz applications. It enables the creation of robust network nodes at low overall material costs, combining excellent performance of leading RF transceivers with an industry-standard enhanced 8051 MCU, on-chip programmable flash memory, 8kB RAM, and a host of other powerful features and peripherals. CC2541 is particularly well-suited for systems requiring ultra-low energy consumption, as indicated by its various operational modes. The short transition times between operating modes further enhance its energy efficiency.
CC2541
CC2540/41 Features
(1) Radio Frequency
- Compliant with 2.4GHz Bluetooth low energy specifications and proprietary RF baseband system
- Supports core data rates of 250kbps, 500kbps, 1Mbps, 2Mbps
- Excellent link budget, no external front end required for long-range applications
- Programmable output power up to 0dBm
- Outstanding receiver sensitivity (-94dBm at 1Mbps), selectivity, and blocking performance
- Suited for wireless frequency-agile systems worldwide: ETSI EN300328 and EN3004402 classes (Europe), FCC CFR47 Part 15 (USA), and ARIB STD-T66 (Japan)
(2) Layout
- Minimal external components
- Reference design support available
- 6mm×6mm quad flat no-lead (QFN) -40 package
- Pin-compatible with CC2540 (when USB or I2C is not used) (ADC)
(3) Low Power Consumption
- RX mode as low as 17.9mA
- TX mode (0dBm): 18.2mA
- Power mode 1 (4μs wake-up): 270μs
- Power mode 2 (sleep timer enabled): 1μs
- Power mode 3 (external interrupt): 0.5μs
(4) TPS62730 Compatible Low-Power Operation Mode
- RX as low as 14.7mA (3V supply)
- TX (0dBm): 14.3mA (3V supply)
(5) Microcontroller
- High-performance, low-power 8051 microcontroller core with code prefetch feature
- System programmable flash memory, 128 or 256KB
- 8KBRAM with retention in all power modes
- Hardware debugging support
- Expanded baseband automation, including automatic acknowledgment and address decoding
- Retention of all relevant registers in all power modes
(6) Peripherals
- Powerful 5-channel direct memory access (DMA)
- General timers (1 16-bit, 2 8-bit)
- Infrared (IR) generation circuit
- 32kHz sleep timer with capture capability
- Precise digital received signal strength indicator (RSSI) support
- Battery monitor and temperature sensor
- 12-bit analog-to-digital converter (ADC) with 8 channels and configurable resolution
- Advanced Encryption Standard (AES) security co-processor
- 2 powerful universal asynchronous receiver-transmitters (UART) supporting multiple serial protocols
- 23 general I/O pins (21×4mA, 2×20mA)
- I2C interface
- 2 I/O pins with LED driving capability
- Secure device timer
- Integrated high-performance comparator
(7) Development Tools
- CC2541 Evaluation Module Kit (CC2541EMK)
- CC2541 Mini Development Kit (CC2541DK-MINI)
- SmartRF™ Software
- Provided IAR Embedded Workbench™
CC2540/41 Software Features
(1) Compliance with the Bluetooth 4.0 protocol stack for single-mode Bluetooth Low Energy (BLE) solutions:
- Fully power-optimized stack, including controller and host
- GAP - central device, peripheral, or broadcaster (including combination roles)
- Attribute Protocol (ATT)/Generic Attribute Profile (GATT)
- Client and Server roles
- L2CAP description
(2) Example applications and profiles:
- General applications for GAP central and peripheral roles
- Proximity, accelerometer, simple keypress, and battery GATT services
- Support for more applications within the BLE software stack
(3) Multiple configuration options:
- Single-chip configuration, allowing applications to run on the CC2541
- Interface for running on an external microprocessor
- BTool - a Windows PC application for evaluation, development, and testing
Applications Scope:
- 2.4GHz Bluetooth Low Energy systems
- Private 2.4GHz systems
- Human interface devices (keyboards, mice, remotes)
- Sports and leisure equipment with one HWI2C interface
- Mobile phone accessories
- Consumer electronics
Classic Application Circuit for CC2540/41
CC2540/41RF section: supports BLE protocol stack and private 2.4G RF system on chip;
Data rate: 250kbps, 500kbps, 1Mbps, 2Mbps;
Output power: 0dBm (support programmable output power);
Receiver sensitivity: -94dBm@1Mbps;
Suitable for wireless applications conforming to global radio frequencies with outstanding link budget, supporting long-range applications;
Low power consumption: RX mode as low as 17.9mA; TX mode (0dBm) as 18.2mA; Power mode 1 (4us wake-up): 270uA; Power mode 2 (sleep timer on): 1uA; Power mode 3 (external interrupt): 0.5uA;
Wide supply voltage range (2V-3.6V);
MCU: high-performance and low-power 8051 core with code prefetch capability;
Programmable Flash: CC2541F128 128KB and CC2541F256 256KB;
Supports hardware debugging;
Baseband extension with automatic acknowledgment and low decoding capabilities;
Registers retain data in all power modes;
Peripherals: powerful 5-channel direct memory access (DMA);
General timers (1 16-bit, 2 8-bit);
Infrared production circuit;
32kHz sleep timer with capture function;
Supports RSSI (Received Signal Strength Indicator);
Battery monitor and temperature sensor; 8-channel 12-bit ADC (configurable resolution);
Advanced Encryption Standard security co-processor;
2 powerful asynchronous serial communication interfaces (UART) supporting multiple serial protocols;
23 general I/O interfaces (214mA; 220mA);
I2C interface;
2 high current I/O (directly drive LEDs);
Security device timer;
Integrated high-performance comparator;
Development tools: CC2541 evaluation module kit (CC2541EMK); CC2541 Mini Development Kit (CC2541DK-MINI); SmartRF software; IAR Embedded Workbench provided.
The Comparison of CC2541,CC2640,CC2640R2F
BT05 Bluetooth 4.0 BLE Module Highlights:
1.Ultra-low standby power consumption of 90uA~400uA.
2.Super long connection distance of 32.8 feet/10 meters.
3.Extremely fast response time of 0.4 seconds.
4.Compatible with Android, Apple, PC, and MAC systems.
5.No byte limit for data transmission, with a maximum speed of up to 3K Bytes/second.
6.No MFI certification required.
7.Perfect support for iOS system.
8.Perfect support for Android 4.3 system.
9.All-in-one module with master-slave functionality, featuring transparent transmission, remote control, and PIO acquisition functions. Switching and configuration can be easily done through the AT command set. Just like the Bluetooth serial modules you have used before, this upgrade toBluetooth 4.0 can be seamlessly achieved without modifying PCB or lower machine programs.
Schematic diagram of the module
Pin Function Description
AT09 Bluetooth 4.0BLE Module Features:
Usage requirements:
For Apple devices: Compatible with iPhone 4S and above, running on iOS 6 and above.
For Android devices: Requires Android version 4.3 or higher, with Bluetooth version 4.0.
- The core module uses the BT05 module, with interface pins including VCC, GND, TXD, RXD, and STATE. An additional LED status output pin is reserved for indicating the Bluetooth connection status, allowing the microcontroller to determine if the Bluetooth connection is established.
- LED indicator displays the Bluetooth connection status: Flashing indicates no Bluetooth connection, steady light indicates Bluetooth connected and port opened. The STATE pin outputs high level when connected, low otherwise.
- Setting the module as master mode: The module is configured as a master or slave module via software. Send AT+ROLE1 command through serial communication (CR or \r\n), upon receiving "OK," the setting is successful with the LED blinking rapidly. Connecting the master module to a slave module requires specific AT commands (refer to the BT05 AT command set).
- Onboard 3.3V LDO, input voltage range 3.6-6V, strictly prohibit exceeding 7V.
- Interface operates at 3.3V, can be directly connected to various microcontrollers (e.g., 51, AVR, PIC, ARM, MSP430). Even 5V microcontrollers can be connected without needing MAX232 or passing through MAX232!
- Effective range in an open area is 7-10 meters, connectivity beyond 10 meters is possible but not guaranteed in terms of connection quality.
- Once paired, functions as a full-duplex serial port without requiring knowledge of Bluetooth protocols, supporting common communication format of 8 data bits, 1 stop bit, no parity bit. Only this format is supported, does not support other formats.
- Before establishing a Bluetooth connection, allows setting baud rate, name, pairing password using AT commands. Configured parameters are saved even after power loss. Automatically switches to transparent mode after Bluetooth connection is established.
- Compact size (3.57cm*1.52cm), factory soldered for quality assurance. Wrapped in transparent heat shrink tubing for dust prevention, aesthetics, and some static protection capability.
- This link acts as a slave device, compatible with various Bluetooth-enabled computers, Bluetooth hosts, most Bluetooth-equipped smartphones, PDAs, PSPs, and other smart terminals. Slave devices cannot pair with each other.
Module Wiring
Input Voltage: 3.3V/5V, only one power supply group is needed.
Built-in level conversion function.
If communicating with a Bluetooth module using a 5.0V MCU, power the 5.0V power port, and the logic levels for RX and TX are 5V.
If communicating with a Bluetooth module using a 3.3V MCU, power the 3.3V power port, and the logic levels for RX and TX are 3.3V.
For RX, connect the Bluetooth module's serial receive end to the MCU's TXD.
For TX, connect the Bluetooth module's serial transmit end to the MCU's RXD.
GND, ground terminal for power supply negative pole.
3.3V, 3.3V power supply at the power end.
5V, 5V power supply at the power end.
Module Usage Tips
- The MLT-BT05 4.0 Bluetooth moduleoperates in the 2.4GHz wireless frequency band, and should try to avoid various factors that may affect wireless transmission. Please pay attention to the following points:
- Avoid using metal for the product casing surrounding the Bluetooth module. If using a partially metal casing, try to keep the antenna part of the module away from the metal part as much as possible.
- Metal connecting wires or screws inside the product should be kept as far as possible from the antenna part of the module.
- Place the module's antenna part close to the edges of the PCB, avoiding placing it in the middle of the board. Make sure there is a clearance milled under the antenna on the PCB, parallel to the direction of the antenna, without copper pads or traces. Directly exposing the antenna part outside the PCB is also a good option.
- Cover the area under the module with a large GND plane as much as possible, and extend the routing towards the outer perimeter.
- It is recommended to use insulated materials for isolation at the module mounting position on the substrate, such as placing a whole block of silkscreen (Top OverLay) at that position.
Important Information (Vital)
TXD: Transmitter, generally refers to one's own transmitting end, normal communication requires connection to another device's RXD.
RXD: Receiver, generally refers to one's own receiving end, normal communication requires connection to another device's TXD.
During normal communication, your own TXD always connects to the other device's RXD!
Loopback Test: In normal communication, RXD is connected to another device's TXD. Therefore, if you want to receive data sent by yourself, namely self-transmission and reception, connect your own TXD directly to RXD. This is used to test whether the sending and receiving are functioning correctly. It is the fastest and simplest testing method. When troubleshooting, this test should be done first to determine if there is a product malfunction, also known as a loopback test.
Bluetooth 4.0 BLE
Bluetooth has gone through 8 versions of updates so far: 1.1, 1.2, 2.0, 2.1, 3.0, 4.0, 4.1, and 4.2. Between versions 1.x and 3.0, we refer to it as traditional Bluetooth, while Bluetooth starting from version 4.x is known as Bluetooth Low Energy (BLE). Of course, the 4.x version of Bluetooth is backwards compatible. Android phones must have a system version of 4.3 or above to support BLE API. Compared to traditional Bluetooth, Bluetooth Low Energy boasts faster transmission speeds, wider coverage, higher security, shorter latency, and lower power consumption, among other advantages. (Most wearable devices nowadays use BLE Bluetooth technology.)
The communication methods between traditional Bluetooth and Bluetooth Low Energy also differ. Traditional Bluetooth generally uses the socket method, while Low Energy Bluetooth utilizes the Gatt protocol for implementation.
Key Advantages:
Low energy consumption: runs on standard organic batteries and can operate for up to a year or even several years; low cost; full compatibility achievable.
Speed supports data transfer of up to 1M, minimizing interference with 4G to the maximum extent.
More intelligent: can complete data transmission within 3 milliseconds at most.
Enhanced security: employs encryption algorithms, providing encrypted and authenticated data packets. Therefore, the advantages of Bluetooth 4.0 encompass three specifications in one, combining the technologies of traditional Bluetooth. The biggest difference compared to version 3.0 lies in the significantly lower power consumption of 4.0, which is reduced by 90% compared to older versions. With Bluetooth technology evolving from traditional areas like smartphones, gaming, computers, and cars towards new fields such as the Internet of Things and healthcare, user demands are increasing. Version 4.0 strengthens data transmission technology while emphasizing low energy performance.
Open-source code
Experimental Setup Image