6.4 Bluetooth® LE Thread Sensor Provisioning SED Demo Application
This application demonstrates the multiprotocol functionality of the PIC32CX BZ6 and PIC32WM BZ6 family of devices and modules, which allows for the concurrent operation of both Thread and Bluetooth LE stacks. Thread commissioning over Bluetooth LE uses a Bluetooth Low Energy link to exchange Thread network parameters and to run Thread and Bluetooth LE tasks simultaneously under FreeRTOS. This application was developed using the BLE Provisioning component. For more details on project generation using BLE component, refer to the Project Generation with Component to use the component for application development.
Hardware Requirement
| Tool | Qty |
|---|---|
| PIC32 BZ6 Curiosity Board | 2 |
| Micro USB cable | 2 |
| Android/iOS Mobile | 1 |
Software Requirement
-
Microchip Bluetooth Data (MBD) iOS/Android app available in Stores
Demo Description
FTD/SED Provisioning:
By connecting the device to the "BLE Provisioning" MBD feature, the Thread network of the combo device can be provisioned and connected to the existing Thread network , or it can create a new network (FTD) if there is no nearby network.
Sleepy End Device (SED) Send Temperature Data Periodically (Devices are Provisioned):
- The SED will periodically wake up and send temperature data to the FTD via Thread UDP.
- The temperature data will be displayed in the FTD application console.
Programming the Precompiled
.hex File/Application Example
- Combo FTD Light – One of the PIC32 BZ6 Curiosity Board is programmed with combo FTD light application which can act as Leader.
- Combo SED Sensor – Another PIC32 BZ6 Curiosity Board is programmed with combo SED sensor application which can act as Thread child.
Programming the .hex File Using MPLAB® IPE
-
Precompiled Hex files are located in below path in the FTD and SED folders respectively.
- Combo FTD
Light – "
<Harmony Content Path>\wireless_apps_pic32_bz6\apps\multiprotocol\ble_thread_prov_ftd_light\hex" - Combo SED
Light – "
<Harmony Content Path>\wireless_apps_pic32_bz6\apps\multiprotocol\ble_thread_prov_sed_sensor\hex"
- Combo FTD
Light – "
-
For more details on the steps, go to Programming A Device.
Note: Users must choose the correct Device and Tool information.
Programming the Application Using MPLAB® X IDE
-
Follow steps mentioned in the Running a Precompiled Application Example section from Related Links.
- Open and program the Application
Examples:
ble_thread_prov_ftd_light.X– Located in “<Harmony Content Path>\wireless_apps_pic32_bz6\apps\multiprotocol\ble_thread_prov_ftd_light\firmware” for FTD using MPLAB X IDEble_thread_prov_sed_sensor.X– Located in "<Harmony Content Path>\wireless_apps_pic32_bz6\apps\multiprotocol\ble_thread_prov_sed_sensor\firmware" for SED using MPLAB X IDE
For more details on how to find the Harmony Content Path, Installing the MCC Plugin section from Related Links.
On-Board Resource Usage For SEDFor FTD refer to the link : Table 6-13
| Sensor | Peripheral Used | I/O Pin | Comment |
|---|---|---|---|
| Switch | EXTINT0 | PB4 | SW1 button in curiosity board to wake up SED through button. |
| Temperature Sensor | ADC | PB6 | Read the room temperature from the MCP9700A sensor available in curiosity board |
| Timer | RTOS Systick Timer | — | Periodic timer functionality to initiate the sensor read operation and for Adv User LED control |
| User LED | GPIO | PB7 | User LED in curiosity board. To indicate Bluetooth LE advertisement/connect status |
Demo Steps
- Supply power to the PIC32 BZ6 Curiosity Boards consisting of Combo FTD light and Combo SED sensor applications by connecting a USB cable. Power Supply (PS) “Green LED” will turn ON when connect to PC.
- The application activity is shown
in "Console Log" through on board UART-USB converter. Open Terminal (for
example, Tera Term) with the following settings.Terminal Settings
- Baud Rate/Speed – 115200 (as configured in SERCOM configuration)
- Parity – None
- Data Bits – 8
- Stop Bits – 1
- Flow Control – None
- Launch the MBD mobile application
- Click on BLE
Provisioning feature and select PIC32CX BZ6 and PIC32WM BZ6 to scan for the devices.
Figure 6-41. Scanning and Connecting SED Device - The device name
"BLE_SED_SENSOR_XXXX" will be visible when scanned in the MBD mobile
application.Note: “XXXX” is a unique number associated with these combo devices
- Connect to the device and
follow the screen shots below for the commissioning procedure.
Figure 6-42. Provisioning SED Device - The Blue "User LED" will be turned ON when device is connected to mobile app.
- If the network parameters are
successfully provisioned, the device state can be seen as “Commissioned”.
The device will preserve the commissioned data, and it will be used for
commissioning from the next power cycle onwards. To clear the commissioned
data and provision new data, user has to perform a “Factory Reset” from the
“BLE provisioning” feature of the MBD application.
Figure 6-43. Device State - When the device SED join as a child the following log, as illustrated in the following figure, will appear in the console.
Demo: SED Sends Temperature Data Periodically
Protocol Exchange
The communication protocol exchange between BLE Provisioner mobile app/ BLE sensor mobile app (BLE central) and the PIC32 BZ6 module (BLE peripheral) is explained in Protocol Exchange.
