void setup() Serial.begin(9600); bt.begin(9600); // Match BL12-A3 default baud Serial.println("BL12-A3 ready");
1. Introduction The BL12-A3 is a compact, low-power, and highly integrated Bluetooth 4.0 (BLE) module designed for short-range wireless communication. It is widely adopted in Internet of Things (IoT) projects, smart home devices, wireless sensor networks, and educational microcontroller prototyping. The module acts as a transparent serial data bridge, converting UART (Universal Asynchronous Receiver-Transmitter) signals to Bluetooth signals and vice versa. This makes it exceptionally easy to use with platforms like Arduino, ESP32, STM32, and Raspberry Pi.
if (Serial.available()) bt.write(Serial.read());
void loop() if (bt.available()) Serial.write(bt.read());
| Command | Description | Example Response | |---------|-------------|------------------| | AT | Check communication | OK | | AT+NAME=<name> | Set device name | OK | | AT+BAUD=<param> | Change baud rate (1=9600,2=19200,4=38400,5=57600,6=115200) | OK | | AT+ROLE=<mode> | 0=Slave, 1=Master | OK | | AT+ADDR? | Query module’s MAC address | +ADDR:xx:xx:xx:xx:xx:xx | | AT+RENEW | Restore factory settings | OK | Note: After changing baud rate, your serial terminal must match the new rate before further commands. | Feature | BL12-A3 | HC-05 | HC-06 | HM-10 | |---------|---------|-------|-------|-------| | Bluetooth Classic/BLE | BLE 4.0 | Classic 2.0 | Classic 2.0 | BLE 4.0 | | Master/Slave Capable | Slave (optional master firmware) | Both | Slave only | Both | | AT Command Mode | Yes | Yes | Limited | Yes | | Default Baud Rate | 9600 | 9600 | 9600 | 9600 | | Typical Cost | ~$3–5 | ~$6–8 | ~$4–6 | ~$8–10 | | iOS/Android App Support | BLE apps | Classic SPP apps | Classic SPP apps | BLE apps |
Always verify your vendor’s datasheet, as pin assignments and command sets may vary slightly between manufacturers. When in doubt, start with the factory default 9600 baud and use a USB-to-TTL adapter to test the module independently before integrating it into a larger system. End of write-up.
Common AT commands (entered after sending +++ with guard times before and after):