One of the key features of the XBee 3 BLU module is its ability to exchange data using Bluetooth Low Energy (BLE). BLE enables wireless communication between the XBee device and other BLE-enabled devices like smartphones, tablets, or computers.

This makes BLE ideal for a variety of applications. Some common use cases include:

  • Wireless sensor data collection: BLE allows sensor data from the XBee to be wirelessly transmitted to a mobile device, enabling remote monitoring without the need for cables.

  • Remote control applications: Using BLE, you can send control commands wirelessly to the XBee, which can then interact with connected peripherals such as motors, actuators, or LEDs.

  • Data logging and reporting: BLE can be used to log data from the XBee and transfer it to a smartphone or other BLE-enabled device for analysis or display.

Example: Exchange data between your XBee 3 BLU and a smartphone

In this section, you will learn how to communicate with your XBee 3 BLU device through its Bluetooth interface, using XBee Studio and the XBee Mobile app to send and receive data. This exercise will help you understand how data can be transferred between different communication interfaces, allowing you to send data over BLE and output it through the serial interface and vice versa:

  1. Connect your device to a PC where XBee Studio is installed.

    This section assumes that you know how to connect the XBee 3 BLU device to a PC. For more information on how to connect an XBee device to a PC, see the Step 2 - Set up the hardware page from the getting started section.
  2. Open XBee Studio.

  3. Wait for your device to be discovered.
    A module that’s never been configured should be discovered automatically, but if you have problems discovering your local device, see the Device discovery tools section of XBee Studio User Guide to learn how to do it manually.

  4. Click on the device. The Dashboard page appears. It contains the device information, connection interface and a list of quick actions.

    BLE can be enabled either through Quick Actions, which simplify the configuration process (only valid for the supported actions), or manually through the Settings view.
    1. Go to the Settings page of your device and:

      1. Set the Bluetooth Identifier (BI) setting to XBee_BLU_1.

      2. Set the Bluetooth Enable (BT) setting to Enabled [1].

      3. Configure the authentication to communicate with your device by clicking the Configure button on the Bluetooth Authentication setting. Type a new password in the Password field of the Basic configuration section in the popup.

        Memorize this password because you will use with the mobile application.
        You can change the password at any time following the above process.
      4. Click the Write settings button on the top toolbar and wait for the settings to be written to the device.

    1. In the Quick Actions section of the Dashboard page of your device click the Bluetooth Configuration quick action.

      1. Set the Enable Bluetooth Low Energy interface checkbox to enabled.

      2. Enter a value of your choice in the Identifier field.

        In order to use the XBee Mobile app, you should start the Identifier value with the word XBee. If you don’t want to, remember to disable the filter in the app when you use it for the first time.
      3. Enter a value of your choice in the Password field.

        Memorize this password because you will use with the mobile application.
        You can change the password at any time following the above process.
      4. Click the Apply button and wait for the settings to be written to the device.

  5. Verify the module is working in API mode. You can do this using Quick Actions to simplify the process or manually in the Settings page:

    1. Click on the Settings item in the sidebar of the tab, located within the Configuration section.

    2. Search for the setting you want to update, in this case AP. You can use the search box at the top toolbar within the device tab.

    3. Change the value of the setting to API Mode Without Escapes [1].

    4. Write the value to the non-volatile memory of your device by clicking the Write setting button (pencil icon) on the right side of the selected setting. This triggers a write operation on the device.

    1. Find the Operating mode quick action and click it. A popup appears, letting you change the operating mode.

    2. Set the operating mode to API Mode Without Escapes

      1. Click the Apply button and wait for the configuration to be written to the device.

  6. Click the XBee Console item in the sidebar of the tab, located within the Development section.

    XBee Studio XBee Console
    1. Open the connection by clicking on the plug adapter icon on the top toolbar.

  7. Open the Console of the XBee Mobile app to output the packets sent/received by the Bluetooth interface.

    1. Wait for your device to be discovered and select it once it appears in the list.

    2. Enter the Bluetooth authentication password of your device.

    3. Click the Console option in the main page of the device. The console is displayed. On the top part you can see the Packets log, and at the bottom the Send packets section.

Send data to a smartphone

The goal of this step is to use XBee Studio to send a packet from the serial interface to the Bluetooth interface, where it will be transmitted wirelessly via Bluetooth and then read using the XBee Mobile app.

The XBee 3 BLU module includes an API frame known as the User Data Relay Frame, which allows you to transfer data between different communication interfaces within the module. In this case, the data is sent from the serial interface to the Bluetooth interface.

For more information on User Data Relay frames, refer to User Data Relay frames.
  1. In XBee Studio, expand the bottom part of the console by clicking the Send data button on the bottom left side of the page.

  2. Click the Add packet button (plus sign in the bottom toolbar on the right).

  3. In the popup window, click Create an API frame.

    1. After the window expands, select the 0x2D - User Data Relay option in the Frame type combo box.

    2. Select the Bluetooth [01] option in the Dest. interface combo box.

    3. In the RF data field, enter a test string; for example, Test Data to Bluetooth interface.

  4. Click Save.

  5. Assuming the setup step was completed and XBee Mobile app is open on your smartphone or tablet, select the frame you created in the Send data table in the lower part of the page. To do that, click the Send selected packet button at the bottom right corner.

  6. The frame is sent (listed in a blue box in the Console log).

  7. Back in the XBee Mobile app, a packet must have been outputted in the Packets log section of the Console with the text specified in the packet created on XBee Studio.

  8. You can inspect the sent and the received packets in the respective applications to see their contents.

Send data to the XBee device

The goal of this step is to transmit data from the Bluetooth interface to the serial interface. You can use the XBee Mobile app to send a packet via Bluetooth to the Bluetooth interface. This packet is then sent to the serial interface, where it is conveyed to the serial console and read using XBee Studio.

As seen in the above step, the XBee 3 BLU module includes an API frame known as the User Data Relay Frame, which allows you to transfer data between different communication interfaces within the module.

For more information on User Data Relay frames, refer to User Data Relay frames.
  1. In XBee Mobile app, click the Add new packet button (plus sign icon) on the bottom part of the Console page.

    1. Type the packet name, so it can be easily identified for future use.

    2. Select the SERIAL option in the XBee interface combo box.

    3. In the Data field, enter a test string; for example, Test Data to serial interface.

  2. Select the Bluetooth [01] option in the Dest. interface combo box.

  3. In the RF data field, enter a test string; for example, BLE Test Data.

  4. Click Add.

  5. Assuming the setup step was completed and XBee Studio is open on your PC, select the frame you created in the Send packets table in the lower part of the Console page of the XBee Mobile app. To do that, click the SEND SELECTED PACKET button at the bottom.

  6. The frame is sent (listed next to a blue arrow in the Console log).

  7. Back in XBee Studio, a packet must have been outputted in the Console log section of the XBee Console page in a red box.

  8. You can inspect the sent and the received packets in the respective applications to see their contents.