Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Bluetooth - Barometer I2C

Technology badge License badge SDK badge Required board Build badge Flash badge RAM badge

Type badge Type badge Type badge Type badge Type badge

Overview

This project shows an example of Bluetooth - Barometer I2C using the Silicon Labs BGM220-EK4314A BGM220 Bluetooth Module Explorer Kit.

This example is intended to make a pressure and temperature measurement every second when the Bluetooth connection is open. The measurement can be seen via Bluetooth Pressure and Temperature characteristics under the Environmental Sensing service by reading it manually, or it can also be automatically updated using notifications. The application uses a Mikore Pressure 3 Click using mikroE mikroBUS-socket I2C connection. This example can be used as a barometer pressure sensor in the weather station an altitude sensor and so on.


Table Of Contents


SDK version


Software Required


Hardware Required


Connections Required

The Pressure 3 Click board can just be "clicked" into its place. Be sure that the board's 45-degree corner matches the Explorer Kit's 45-degree white line.

The following picture shows the system view of how it works.

hardware_connection


Setup

To test this application, you can either create a project based on an example project or start with a "Bluetooth - SoC Empty" project based on your hardware.

Note

Based on an example project

  1. From the Launcher Home, add your hardware to My Products, click on it, and click on the EXAMPLE PROJECTS & DEMOS tab. Find the example project filtering by "barometer".

  2. Click Create button on the Bluetooth - Barometer I2C example. Example project creation dialog pops up -> click Create and Finish and Project should be generated. create_project

  3. Build and flash this example to the board.

Start with a "Bluetooth - SoC Empty" project

  1. Create a Bluetooth - SoC Empty project for your hardware using Simplicity Studio 5.

  2. Copy all attached files in the inc and src folders into the project root folder (overwriting existing).

  3. Import the GATT configuration:

    • Open the .slcp file in the project.

    • Select the CONFIGURATION TOOLS tab and open the Bluetooth GATT Configurator.

    • Find the Import button and import the configuration bluetooth_rfid_notify/config/btconfig/gatt_configuration.btconf file.

    • Save the GATT configuration (ctrl-s).

  4. Open the .slcp file. Select the SOFTWARE COMPONENTS tab and install the software components:

    • [Services] → [IO Stream] → [IO Stream: USART] → default instance name: vcom
    • [Application] → [Utility] → [Log]
    • [Third Party Hardware Drivers] → [Sensors] → [DPS310- Pressure 3 Click (Mikroe) - I2C]
  5. Install printf float

    • Open Properties of the Project.

    • Select C/C++ Build → Settings → Tool Settings → GNU ARM C Linker → General. Check Printf float.

      install_float

  6. Build and flash the project to your device.

Note

A bootloader needs to be flashed to your board if the project starts from the "Bluetooth - SoC Empty" project, see Bootloader for more information.


How It Works

GATT Database

The application is based on the Bluetooth - SoC Empty example. Since the example already has the Bluetooth GATT server, advertising, and connection mechanisms, only minor changes are required.

Advertisement Packet Device name: Silabs Barometer I2C

GATT Database

  • Device name: Silabs Barometer I2C
  • [Service] Environmental Sensing
    • [Char] Pressure
      • [R] Read pressure value.
      • [N] Notify to update pressure value automatically.
    • [Char] Temperature
      • [R] Read temperature value.
      • [N] Notify to update temperature value automatically.

Testing

After the barometer sensor initialization is successful. Bluetooth advertising will be started. When the connection is opened, the application gets the temperature and pressure from the sensor every second. If the connection is closed, also the barometer measurement timer is stopped.

Follow the below steps to test the example with the Simplicity Connect application:

  1. Open the Simplicity Connect app on your smartphone and allow the permission requested the first time it is opened.

  2. Find your device in the Bluetooth Browser, advertising as Silabs Barometer I2C, and tap Connect.

  3. When the device is connected, you can read the temperature and pressure values manually. If you want these values updated automatically, you have to enable the Notify property for them, so the client device is notified about the value updated.

    project_teting

  4. You can launch Console that's integrated into Simplicity Studio or use a third-party terminal tool like Tera Term to receive the data from the USB. A screenshot of the console output is shown in the figure below.

    console_log


Report Bugs & Get Support

To report bugs in the Application Examples projects, please create a new "Issue" in the "Issues" section of bluetooth_applications repo. Please reference the board, project, and source files associated with the bug, and reference line numbers. If you are proposing a fix, also include information on the proposed fix. Since these examples are provided as-is, there is no guarantee that these examples will be updated to fix these issues.

Questions and comments related to these examples should be made by creating a new "Issue" in the "Issues" section of bluetooth_applications repo.