Bluetooth® Low Energy AT Commands

[中文]

Attention

ESP32C2-4MB AT firmware supports BluFi, but ESP32C2-2MB AT firmware does not. If you need the firmware with BluFi support on ESP32C2-2MB, please compile it on your own by following Compile ESP-AT Project and choosing the following configurations in the Step 5. Configure:

  • Component config -> Bluetooth -> Bluetooth -> Host -> NimBLE - BLE only

  • Component config -> Bluetooth -> NimBLE Options -> Enable blufi functionality

AT+BLUFI: Start or Stop BluFi

Query Command

Function:

Query the status of BluFi.

Command:

AT+BLUFI?

Response:

If BluFi is not started, it will return:

+BLUFI:0

OK

If BluFi is started, it will return:

+BLUFI:1

OK

Set Command

Function:

Start or stop BluFi.

Command:

AT+BLUFI=<option>[,<auth floor>]

Response:

OK

Parameter

  • <option>:

    • 0: stop BluFi

    • 1: start BluFi

  • <auth floor>: Wi-Fi authentication mode floor. ESP-AT will not connect to the AP whose authmode is lower than this floor.

    • 0: OPEN (Default)

    • 1: WEP

    • 2: WPA_PSK

    • 3: WPA2_PSK

    • 4: WPA_WPA2_PSK

    • 5: WPA2_ENTERPRISE

    • 6: WPA3_PSK

    • 7: WPA2_WPA3_PSK

Example

AT+BLUFI=1

AT+BLUFINAME: Query/Set BluFi Device Name

Query Command

Function:

Query the BluFi name.

Command:

AT+BLUFINAME?

Response:

+BLUFINAME:<device_name>
OK

Set Command

Function:

Set the BluFi device name.

Command:

AT+BLUFINAME=<device_name>

Response:

OK

Parameter

  • <device_name>: the name of BluFi device.

Notes

  • If you need to set BluFi name, please set it before command AT+BLUFI=1. Otherwise, it will use the default name BLUFI_DEVICE.

  • The maximum length of BluFi name is 29 bytes.

Example

AT+BLUFINAME="BLUFI_DEV"
AT+BLUFINAME?

AT+BLUFISEND: Send User-Customized Data over BluFi

Set Command

Function:

Send user-customized data from the ESP side to a phone over BluFi.

Command:

AT+BLUFISEND=<length>

Response:

>

The symbol > indicates that AT is ready for receiving serial data and you can enter data now. When the requirement of data length determined by the parameter <length> is met, the transmission starts.

If the data transmission is successful, AT returns:

OK

Parameters

  • <length>: customized data length. Unit: byte.

Notes

  • The length of customized data cannot exceed 600 bytes.

  • If your ESP chip receives customized data from the phone, the data will be printed in the form of +BLUFIDATA:<len>,<data>.

Example

AT+BLUFISEND=4
// After the symbol ">" shows, input 4 bytes of data, such as "1234". Then the data will be transmitted automatically.