How can I connect a BL654 (loaded with smartBASIC AT Commands) to a BT510?

The BT510 is an event driven BLE multi-sensors which is capable of measuring temperature, open/close magnet and motion detection. There is basically two ways to get data from it:

  • Advertisements
  • Connection

While the BT510 as been especially designed to transfer data via BLE advertisements, you can also use BLE connection to retrieve data. It's worth mentioning that preliminary intended use of BLE connection with the BT510 is for configuration (usually during commissioning process on the field). As exposed into the Sentrius™ BT510 User Guide section 4.2, the BT510 make use of BLE Virtual Serial Port (VSP) service.

The BL654 is BLE v5.1 module which embeds an nRF52840 chipset from Nordic. Laird Connectivity developed smartBASIC, an event driven programming language that sits on top of Nordic SDK. Its most famous software/feature is the AT Commands Interface where you can drive a BLE module through UART with using batch of intuitive commands.

As part of IoT applications that involve to interact with a BT510 via BLE through a BL654 loaded with AT Command Interface, it can be useful to know the steps to get the BL654 connected to the BT510.

Because the BT510 GATT table is protected by a pairing process which involve static passkey (123456), it's important to change BL654 IOCAP in first instance to allow a Passkey entry procedure during pairing/bonding process.

On the BL654 side you'll need to follow the procedure below with AT Commands :

  • Change BL654 IOCAP setting either on 2 (Keyboard only) or 4 (Keyboard+Display)
  • Engage a non-VSP connection (AT+LCON)
  • Engage a pairing/bonding process with AT+PAIR 1
  • Issue BT510 passkey as part of the pairing/bonding process with AT+PRSP 1,123456
  • Disconnection from non-VSP connection (AT+LDSC 1)
  • Reconnect with VSP connection (ATD)

Now that both devices are connected with VSP mode, you can write JSON commands to send over BL654 UART in order to configure the BT510 as you like. For more information on JSON spec, you can have a look here :  https://www.jsonrpc.org/specification

A typical AT Commands session could look like this, where 01C630157769EE is a BT510 BLE Mac Address:

ATS 107=4 
OK
AT&W
OK
ATZ
OK
AT+LCON 01C630157769EE
connect 1,01C630157769EE,15000,6000000,0
AT+PAIR 1
OK
passkey? 1
AT+PRSP 1,123456
encrypt 1
AT+LDSC 1
discon 1,22

// BL654 is now bonded to BT510, VSP connection can be made.

ATD 01C630157769EE
ENCRYPT
CONNECT 0,01C630157769EE,15000,6000000,0

Categories

Products