Difference between revisions of "BT4C"

From ElectroDragon
Jump to navigation Jump to search
(Bluetooth End)
(AT Commands on Serial End)
 
Line 19: Line 19:
 
== AT Commands on Serial End ==
 
== AT Commands on Serial End ==
 
=== Work mode switch command ===
 
=== Work mode switch command ===
 +
<br>
 
The module is in transmission mode by default. (Hint: the module must send AT + MODE = 0 <CR> after entering power to enter command mode
 
The module is in transmission mode by default. (Hint: the module must send AT + MODE = 0 <CR> after entering power to enter command mode
 
Can use AT command)
 
Can use AT command)
Line 32: Line 33:
 
Command not accepted Response: ERROR <CR> <LF>
 
Command not accepted Response: ERROR <CR> <LF>
 
===  Broadcast enable command ===
 
===  Broadcast enable command ===
The module is broadcast enabled by default.
+
* The module is broadcast enabled by default.
1) Query the current broadcast status
+
* 1) Query the current broadcast status
Send: AT + SCAN <CR>
+
* Send: AT + SCAN <CR>
Response: + SCAN: <para> <CR> <LF>
+
* Response: + SCAN: <para> <CR> <LF>
para is the current broadcast status. 0--broadcast is not enabled 1--broadcast is enabled
+
* para is the current broadcast status. 0--broadcast is not enabled 1--broadcast is enabled
2) Query the parameters supported by the current command
+
* 2) Query the parameters supported by the current command
Send: AT + SCAN? <CR>
+
* Send: AT + SCAN? <CR>
Response: + SCAN: 0,1 <CR> <LF>
+
* Response: + SCAN: 0,1 <CR> <LF>
0--turn off the broadcast 1--turn on the broadcast. This function is valid only when the module is not connected to the server.
+
* 0--turn off the broadcast 1--turn on the broadcast. This function is valid only when the module is not connected to the server.
3) Set the current broadcast status
+
* 3) Set the current broadcast status
Send: AT + SCAN = <para> <CR> para is 0,1
+
* Send: AT + SCAN = <para> <CR> para is 0,1
Command accepted response: OK <CR> <LF>
+
* Command accepted response: OK <CR> <LF>
Command not accepted Response: ERROR <CR> <LF>
+
* Command not accepted Response: ERROR <CR> <LF>
para is the setting state 0--turn off the broadcast 1--turn on the broadcast
+
* para is the setting state 0--turn off the broadcast 1--turn on the broadcast
 
=== Set the connection interval ===
 
=== Set the connection interval ===
The connection interval can be set from 10ms to 2000ms. Supports all connection interval settings in multiples of 10ms between 10ms and 2000ms
+
* The connection interval can be set from 10ms to 2000ms. Supports all connection interval settings in multiples of 10ms between 10ms and 2000ms
Settings, effective immediately.
+
* Settings, effective immediately.
1) Query the current connection interval
+
* 1) Query the current connection interval
Send: AT + LINKINV <CR>
+
* Send: AT + LINKINV <CR>
Response: + LINKINV: <para> <CR> <LF>
+
* Response: + LINKINV: <para> <CR> <LF>
para is the current connection interval.
+
* para is the current connection interval.
2) Query the parameters supported by the current command
+
* 2) Query the parameters supported by the current command
Send: AT + LINKINV? <CR>
+
* Send: AT + LINKINV? <CR>
Response: + LINKINV: <para> <CR> <LF>
+
* Response: + LINKINV: <para> <CR> <LF>
para is all parameters supported by the command
+
* para is all parameters supported by the command
3) Set the connection interval
+
* 3) Set the connection interval
Send: AT + LINKINV = <para> <CR> para is an integer multiple of 10ms
+
* Send: AT + LINKINV = <para> <CR> para is an integer multiple of 10ms
Command accepted response: OK <CR> <LF>
+
* Command accepted response: OK <CR> <LF>
Command not accepted Response: ERROR <CR> <LF>
+
* Command not accepted Response: ERROR <CR> <LF>
 
=== Baud rate setting ===
 
=== Baud rate setting ===
The baud rate defaults to 9600 8N1. Can set baud rate: 9600, 19200, 38400, 57600, 115200.
+
* The baud rate defaults to 9600 8N1. Can set baud rate: 9600, 19200, 38400, 57600, 115200.
1) Query the current baud rate
+
* 1) Query the current baud rate
Send: AT + UART <CR>
+
* Send: AT + UART <CR>
Response: + UART: <para> <CR> <LF>
+
* Response: + UART: <para> <CR> <LF>
para is the current serial baud rate
+
* para is the current serial baud rate
2) Query the parameters supported by the current command
+
* 2) Query the parameters supported by the current command
Send: AT + UART? <CR>
+
* Send: AT + UART? <CR>
Response: + UART: <para> <CR> <LF>
+
* Response: + UART: <para> <CR> <LF>
para is all parameters supported by the command
+
* para is all parameters supported by the command
3) Set the baud rate of the serial port
+
* 3) Set the baud rate of the serial port
Send: AT + UART = <para> <CR> para is 9600,19200,38400,57600,115200.
+
* Send: AT + UART = <para> <CR> para is 9600,19200,38400,57600,115200.
Command accepted response: OK <CR> <LF>
+
* Command accepted response: OK <CR> <LF>
Command not accepted Response: ERROR <CR> <LF>
+
* Command not accepted Response: ERROR <CR> <LF>
 
=== Set the transmit power ===
 
=== Set the transmit power ===
The transmission power is divided into ten levels, which are 0 level-19.5dbm, level 1-16dbm, level 2-13.3dbm, level 3-9.6dbm, level 4-5dbm,
+
* The transmission power is divided into ten levels, which are 0 level-19.5dbm, level 1-16dbm, level 2-13.3dbm, level 3-9.6dbm, level 4-5dbm,
Level 5-3.1dbm, Level 6 0dbm, Level 7 3.3dbm, Level 8 6.3dbm, and Level 9 7.9dbm. The transmit power defaults to 9 levels of 7.9dbm.
+
* Level 5-3.1dbm, Level 6 0dbm, Level 7 3.3dbm, Level 8 6.3dbm, and Level 9 7.9dbm. The transmit power defaults to 9 levels of 7.9dbm.
1) Query the current transmit power
+
* 1) Query the current transmit power
Send: AT + RFPW <CR>
+
* Send: AT + RFPW <CR>
Response: + RFPW: <para> <CR> <LF>
+
* Response: + RFPW: <para> <CR> <LF>
para is the current power value
+
* para is the current power value
2) Query the parameters supported by the current command
+
* 2) Query the parameters supported by the current command
Send: AT + RFPW? <CR>
+
* Send: AT + RFPW? <CR>
Response: + RFPW: <para> <CR> <LF>
+
* Response: + RFPW: <para> <CR> <LF>
para is all parameters supported by the command
+
* para is all parameters supported by the command
3) Set the transmit power
+
* 3) Set the transmit power
Send: AT + RFPW = <para> <CR> para is 0 ~ 9.
+
* Send: AT + RFPW = <para> <CR> para is 0 ~ 9.
Command accepted response: OK <CR> <LF>
+
* Command accepted response: OK <CR> <LF>
Command not accepted Response: ERROR <CR> <LF>
+
* Command not accepted Response: ERROR <CR> <LF>
 
=== Set the module name ===
 
=== Set the module name ===
The module name is GCBT40 by default. Users can set names up to 18 bytes long. The restart takes effect.
+
* The module name is GCBT40 by default. Users can set names up to 18 bytes long. The restart takes effect.
1) Query the current module name
+
* 1) Query the current module name
Send: AT + NAME <CR>
+
* Send: AT + NAME <CR>
Response: + NAME: <para> <CR> <LF>
+
* Response: + NAME: <para> <CR> <LF>
para The current module name.
+
* para The current module name.
2) Set a new module name
+
* 2) Set a new module name
Send: AT + NAME = <para> <CR> para new name
+
* Send: AT + NAME = <para> <CR> para new name
Command accepted response: OK <CR> <LF>
+
* Command accepted response: OK <CR> <LF>
Command not accepted Response: ERROR <CR> <LF>
+
* Command not accepted Response: ERROR <CR> <LF>
 
=== set the broadcast interval ===
 
=== set the broadcast interval ===
You can set the broadcast interval from 100ms to 2000ms. The following setting parameters are supported: 100, 200, 500, 1000, 2000. broadcast
+
* You can set the broadcast interval from 100ms to 2000ms. The following setting parameters are supported: 100, 200, 500, 1000, 2000. broadcast
Modifications take effect immediately.
+
* Modifications take effect immediately.
1) Query the current connection interval
+
* 1) Query the current connection interval
Send: AT + ADVT <CR>
+
* Send: AT + ADVT <CR>
Response: + ADVT: <para> <CR> <LF>
+
* Response: + ADVT: <para> <CR> <LF>
para is the current connection interval.
+
* para is the current connection interval.
2) Query the parameters supported by the current command
+
* 2) Query the parameters supported by the current command
Send: AT + ADVT? <CR>
+
* Send: AT + ADVT? <CR>
Response: + ADVT: <para> <CR> <LF>
+
* Response: + ADVT: <para> <CR> <LF>
para is all parameters supported by the command
+
* para is all parameters supported by the command
3) Set the connection interval
+
* 3) Set the connection interval
Send: AT + ADVT = <para> <CR> para is 100, 200, 500, 1000, 2000.
+
* Send: AT + ADVT = <para> <CR> para is 100, 200, 500, 1000, 2000.
Command accepted response: OK <CR> <LF>
+
* Command accepted response: OK <CR> <LF>
Command not accepted Response: ERROR <CR> <LF>
+
* Command not accepted Response: ERROR <CR> <LF>
 
=== Query MAC address ===
 
=== Query MAC address ===
Send: AT + GMAC <CR>
+
* Send: AT + GMAC <CR>
Response: + GMAC: <para> <CR> <LF> para is the MAC address.
+
* Response: + GMAC: <para> <CR> <LF> para is the MAC address.
 
=== Low power mode ===
 
=== Low power mode ===
The module defaults to normal mode.
+
* The module defaults to normal mode.
1) Query the current mode
+
* 1) Query the current mode
Send: AT + STBY <CR>
+
* Send: AT + STBY <CR>
Response: + MODE: <para> <CR> <LF> 0--normal mode 1--low power mode
+
* Response: + MODE: <para> <CR> <LF> 0--normal mode 1--low power mode
2) Query the parameters supported by the current command
+
* 2) Query the parameters supported by the current command
Send: AT + STBY? <CR>
+
* Send: AT + STBY? <CR>
Response: + MODE: <para> <CR> <LF> para is 0,1,2.
+
* Response: + MODE: <para> <CR> <LF> para is 0,1,2.
3) Setting mode
+
* 3) Setting mode
Send: AT + STBY = <para> <CR> para is 0,1,2. Mode 2 is deep sleep mode (the module automatically resets after wake-up and the mode returns to the original 0 or 1)
+
* Send: AT + STBY = <para> <CR> para is 0,1,2. Mode 2 is deep sleep mode (the module automatically resets after wake-up and the mode returns to the original 0 or 1)
Command accepted response: OK <CR> <LF>
+
* Command accepted response: OK <CR> <LF>
Command not accepted Response: ERROR <CR> <LF>
+
* Command not accepted Response: ERROR <CR> <LF>
 
=== RF test mode setting ===
 
=== RF test mode setting ===
Module transmits single carrier signal at specified frequency
+
* Module transmits single carrier signal at specified frequency
Send: AT + TEST = P, C <CR>
+
* Send: AT + TEST = P, C <CR>
Where P is the RF transmit power (values: 0 ~ 9), C is the transmit frequency, and the conversion relationship between C and the transmit frequency is
+
* Where P is the RF transmit power (values: 0 ~ 9), C is the transmit frequency, and the conversion relationship between C and the transmit frequency is
For: transmitting frequency = 2402 + C * 2MHz
+
* For: transmitting frequency = 2402 + C * 2MHz
Command accepted response: OK <CR> <LF>
+
* Command accepted response: OK <CR> <LF>
Command not accepted Response: ERROR <CR> <LF>
+
* Command not accepted Response: ERROR <CR> <LF>
 
=== Restore the default settings ===
 
=== Restore the default settings ===
Send: AT + DEFA <CR>
+
* Send: AT + DEFA <CR>
Response: OK <CR> <LF>
+
* Response: OK <CR> <LF>
After this command is set, the module will automatically reset.
+
* After this command is set, the module will automatically reset.
 +
*
  
 
== Bluetooth End ==
 
== Bluetooth End ==

Latest revision as of 05:08, 8 January 2020

Specifications

  • Voltage range 2.0V-3.6V DC
  • Frequency range 2402MHz to 2480MHz programmable configuration
  • Frequency error +/- 20ppm
  • Modulation method GFSK
  • Data transmission rate: 1Mbps
  • Transmission distance: 100m
  • Output power 7.9dBm Max programmable configuration
  • Receive sensitivity -94dBm
  • Sleep current 8uA
  • Receive current 12mA
  • Emission current 20mA 7.9dBm
  • Working temperature -30 ℃-85 ℃
  • Size 18.8mm x 15.1mm
  • Antenna impedance 50ohm
  • Antenna interface PCB PCB onboard antenna

AT Commands on Serial End

Work mode switch command


The module is in transmission mode by default. (Hint: the module must send AT + MODE = 0 <CR> after entering power to enter command mode Can use AT command) 1) Query the current mode Send: AT + MODE <CR> Response: + MODE: <para> <CR> <LF> 0--command mode 1--transmission mode 2) Query the parameters supported by the current command Send: AT + MODE? <CR> Response: + MODE: <para> <CR> <LF> para is 0,1. 3) Setting mode Send: AT + MODE = <para> <CR> para is 0,1. Command accepted response: OK <CR> <LF> Command not accepted Response: ERROR <CR> <LF>

Broadcast enable command

  • The module is broadcast enabled by default.
  • 1) Query the current broadcast status
  • Send: AT + SCAN <CR>
  • Response: + SCAN: <para> <CR> <LF>
  • para is the current broadcast status. 0--broadcast is not enabled 1--broadcast is enabled
  • 2) Query the parameters supported by the current command
  • Send: AT + SCAN? <CR>
  • Response: + SCAN: 0,1 <CR> <LF>
  • 0--turn off the broadcast 1--turn on the broadcast. This function is valid only when the module is not connected to the server.
  • 3) Set the current broadcast status
  • Send: AT + SCAN = <para> <CR> para is 0,1
  • Command accepted response: OK <CR> <LF>
  • Command not accepted Response: ERROR <CR> <LF>
  • para is the setting state 0--turn off the broadcast 1--turn on the broadcast

Set the connection interval

  • The connection interval can be set from 10ms to 2000ms. Supports all connection interval settings in multiples of 10ms between 10ms and 2000ms
  • Settings, effective immediately.
  • 1) Query the current connection interval
  • Send: AT + LINKINV <CR>
  • Response: + LINKINV: <para> <CR> <LF>
  • para is the current connection interval.
  • 2) Query the parameters supported by the current command
  • Send: AT + LINKINV? <CR>
  • Response: + LINKINV: <para> <CR> <LF>
  • para is all parameters supported by the command
  • 3) Set the connection interval
  • Send: AT + LINKINV = <para> <CR> para is an integer multiple of 10ms
  • Command accepted response: OK <CR> <LF>
  • Command not accepted Response: ERROR <CR> <LF>

Baud rate setting

  • The baud rate defaults to 9600 8N1. Can set baud rate: 9600, 19200, 38400, 57600, 115200.
  • 1) Query the current baud rate
  • Send: AT + UART <CR>
  • Response: + UART: <para> <CR> <LF>
  • para is the current serial baud rate
  • 2) Query the parameters supported by the current command
  • Send: AT + UART? <CR>
  • Response: + UART: <para> <CR> <LF>
  • para is all parameters supported by the command
  • 3) Set the baud rate of the serial port
  • Send: AT + UART = <para> <CR> para is 9600,19200,38400,57600,115200.
  • Command accepted response: OK <CR> <LF>
  • Command not accepted Response: ERROR <CR> <LF>

Set the transmit power

  • The transmission power is divided into ten levels, which are 0 level-19.5dbm, level 1-16dbm, level 2-13.3dbm, level 3-9.6dbm, level 4-5dbm,
  • Level 5-3.1dbm, Level 6 0dbm, Level 7 3.3dbm, Level 8 6.3dbm, and Level 9 7.9dbm. The transmit power defaults to 9 levels of 7.9dbm.
  • 1) Query the current transmit power
  • Send: AT + RFPW <CR>
  • Response: + RFPW: <para> <CR> <LF>
  • para is the current power value
  • 2) Query the parameters supported by the current command
  • Send: AT + RFPW? <CR>
  • Response: + RFPW: <para> <CR> <LF>
  • para is all parameters supported by the command
  • 3) Set the transmit power
  • Send: AT + RFPW = <para> <CR> para is 0 ~ 9.
  • Command accepted response: OK <CR> <LF>
  • Command not accepted Response: ERROR <CR> <LF>

Set the module name

  • The module name is GCBT40 by default. Users can set names up to 18 bytes long. The restart takes effect.
  • 1) Query the current module name
  • Send: AT + NAME <CR>
  • Response: + NAME: <para> <CR> <LF>
  • para The current module name.
  • 2) Set a new module name
  • Send: AT + NAME = <para> <CR> para new name
  • Command accepted response: OK <CR> <LF>
  • Command not accepted Response: ERROR <CR> <LF>

set the broadcast interval

  • You can set the broadcast interval from 100ms to 2000ms. The following setting parameters are supported: 100, 200, 500, 1000, 2000. broadcast
  • Modifications take effect immediately.
  • 1) Query the current connection interval
  • Send: AT + ADVT <CR>
  • Response: + ADVT: <para> <CR> <LF>
  • para is the current connection interval.
  • 2) Query the parameters supported by the current command
  • Send: AT + ADVT? <CR>
  • Response: + ADVT: <para> <CR> <LF>
  • para is all parameters supported by the command
  • 3) Set the connection interval
  • Send: AT + ADVT = <para> <CR> para is 100, 200, 500, 1000, 2000.
  • Command accepted response: OK <CR> <LF>
  • Command not accepted Response: ERROR <CR> <LF>

Query MAC address

  • Send: AT + GMAC <CR>
  • Response: + GMAC: <para> <CR> <LF> para is the MAC address.

Low power mode

  • The module defaults to normal mode.
  • 1) Query the current mode
  • Send: AT + STBY <CR>
  • Response: + MODE: <para> <CR> <LF> 0--normal mode 1--low power mode
  • 2) Query the parameters supported by the current command
  • Send: AT + STBY? <CR>
  • Response: + MODE: <para> <CR> <LF> para is 0,1,2.
  • 3) Setting mode
  • Send: AT + STBY = <para> <CR> para is 0,1,2. Mode 2 is deep sleep mode (the module automatically resets after wake-up and the mode returns to the original 0 or 1)
  • Command accepted response: OK <CR> <LF>
  • Command not accepted Response: ERROR <CR> <LF>

RF test mode setting

  • Module transmits single carrier signal at specified frequency
  • Send: AT + TEST = P, C <CR>
  • Where P is the RF transmit power (values: 0 ~ 9), C is the transmit frequency, and the conversion relationship between C and the transmit frequency is
  • For: transmitting frequency = 2402 + C * 2MHz
  • Command accepted response: OK <CR> <LF>
  • Command not accepted Response: ERROR <CR> <LF>

Restore the default settings

  • Send: AT + DEFA <CR>
  • Response: OK <CR> <LF>
  • After this command is set, the module will automatically reset.

Bluetooth End

  • BT Service - UUID:0xFF11
  • Serial - UUID:0xFF12

Config UUID:0xFF20

configure the connection interval channel (service UUID: 0xFF21)

  • Executable: write
  • Configuration operation: Supports connection interval configuration of integer multiples of 10ms.
  • Directly write the corresponding data to configure. If the configuration is successful, the status response channel returns OK, otherwise it returns ERROR.
  • Query operation:
  • Send '=' to query the current configuration. The result is returned by the status reply channel.
  • Send '?' To query the currently supported configuration values. The result is returned by the status reply channel.

Rename module name channel (service UUID: 0xFF22)

  • Executable: write
  • Configuration operation: Support module name modification up to 18 characters. The restart takes effect.

configure the serial baud rate channel (service UUID: 0xFF23)

  • Executable: write
  • Configuration operation: Support the following serial port speed configuration: 9600, 19200, 38400, 57600, 115200
  • Query operation:
  • Send '=' to query the current configuration. The result is returned by the status reply channel.
  • Send '?' To query the currently supported configuration values. The result is returned by the status reply channel.

Configure the transmit power channel (service UUID: 0xFF24)

  • The transmission power is divided into ten levels, which are 0 level-19.5dbm, level 1-16dbm, level 2-13.3dbm, level 3-9.6dbm, level 4-5dbm,
  • Level 5-3.1dbm, Level 6 0dbm, Level 7 3.3dbm, Level 8 6.3dbm, Level 9 7.9dbm. The transmit power defaults to 9 levels of 7.9dbm.
  • Executable: write
  • Configuration operation: Support the following power level configuration: 0 ~ 9.
  • Query operation:
  • Send '=' to query the current configuration. The result is returned by the status reply channel.
  • Send '?' To query the currently supported configuration values. The result is returned by the status reply channel.

low power mode enable channel (service UUID: 0xFF25)

  • Executable: write
  • Configuration operation: Support normal and low power modes Operation: 0 is normal mode, 1 is low power mode.
  • Query operation:
  • Send '?' To query the currently supported configuration values. The result is returned by the status reply channel.

configure the broadcast interval channel (service UUID: 0xFF26)

  • Executable: write
  • Configuration operation: Supports all connection interval configurations with integer multiples of 10ms.
  • Directly write the corresponding data to configure. If the configuration is successful, the status response channel returns OK, otherwise it returns ERROR.
  • Query operation:
  • Send '=' to query the current configuration. The result is returned by the status reply channel.
  • Send '?' To query the currently supported configuration values. The result is returned by the status reply channel.
  • ==== status reply service channel (service UUID: 0xFF2F) ====

What you can do: notifications Function: Returns the configured operating status. The query operation returns the query results. The configuration operation returns the operation result. OK indicates that the operation was successful, and ERROR indicates that the operation failed or the configuration value is not supported.

GPIO Control UUID:0xFF50

GPIO0 output control channel (service UUID: 0xFF51)

  • Executable: write
  • Configuration operation: write 0 or 1
  • Function: GPIO port output 0 or 1

GPIO0 mode control channel (service UUID: 0xFF52)

  • Executable: write
  • Configuration operation: write 0 or 1
  • Function: Control GPIO output or input mode, 0 is input mode, 1 is output mode

GPIO0 status channel (service UUID: 0xFF53)

  • Executable operation: read
  • Function: read the status of GPIO0, 0 is low level, 1 is high level

GPIO1 output control channel (service UUID: 0xFF54)

  • Executable: write
  • Configuration operation: write 0 or 1
  • Function: GPIO1 output 0 or 1

GPIO1 mode control channel (service UUID: 0xFF55)

  • Executable: write
  • Configuration operation: write 0 or 1
  • Function: Control GPIO1 output or input mode, 0 is input mode, 1 is output mode

GPIO1 status channel (service UUID: 0xFF56)

  • Executable operation: read
  • Function: read the status of GPIO1, 0 is low level, 1 is high level

data storage channel (service UUID: 0xFF58)

  • Executable operations: read, write
  • Configuration operation: Any data can be written, and previously written data can be read
  • Function: data storage, module power-down data retention, length 18 bytes

GPIO status reply service channel (service UUID: 0xFF5F)

  • What you can do: notifications
  • Function: return GPIO port status

Device Info UUID:0x180A

Module MAC address (service UUID: 0x2A23)

  • Executable operation: read
  • Number of bytes: 8
  • Default: 0000xxxxxxxxxxxx (hex)
  • Description: Module physical address

module model (service UUID: 0x2A24)

  • Executable operation: read
  • Number of bytes: 15
  • Default: BT4C
  • Description: Module model

Software version (Service UUID: 0x2A28)

  • Executable operation: read
  • Number of bytes: 4
  • Default: None
  • Note: Software version

Manufacturer (Service UUID: 0x2A29)

  • Executable operation: read
  • Number of bytes: 10
  • Default: BLE Module