This project aims to implement a data logger application using Silicon Labs development kits integrated with the BLE wireless stack and humidity & temperature sensors (si72xx).
The block diagram of this application is shown in the image below:
More detailed information can be found in the section How it works.
This code example referred to the following code examples. More detailed information can be found here:
- SDK version
- Software Required
- Hardware Required
- Connections Required
- Setup
- How It Works
- Report Bugs & Get Support
- 1x xG24-DK2601B EFR32xG24 Dev Kit
- 1x SparkFun Micro OLED Breakout (Qwiic) board
- 1x microSD Click
- 1x Silabs Click Shield
- 1x smartphone running the 'Simplicity Connect' mobile app
The hardware connection is shown in the image below:
-
The xG24 Dev Kit and the microSD Click can be connected to the Mikroe Silabs Click Shield via the Thunderboard socket and the mikroBus respectively, or we can use some female-to-female jumper wire to connect them directly as shown in the table below
xG24 Dev Kit microSD Click EXP10 - SPI_CS - PA7 (pin 10) CS EXP8 - SPI_SCLK - PC1 (pin 8) SCK EXP6 - SPI_MISO - PC2 (pin 6) SDO EXP4 - SPI_MOSI - PC3 (pin 4) SDI - CD GND - EXP1 (pin 1) GND EXP2 - VMCU (pin 2) +3V3 The xG24 Dev Kit and microSD Click pinout diagram is shown below:
xG24 Dev Kit microSD Click 

-
Micro OLED can be easily connected via qwiic to the xG24 Dev Kit
Mikroe Silabs Click Shield EXP header pinout diagram is shown below:
Micro OLED 2.5mm Header pinout diagram is shown below:
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. You should connect the xG24 Dev Kit to the PC using a MicroUSB cable.
Note
-
Make sure that the Third Party Hardware Drivers extension is installed as part of the SiSDK and the bluetooth_applications repository is added to Preferences > Simplicity Studio > External Repos.
-
SDK Extension must be enabled for the project to install the required components.
-
From the Launcher Home, add the BRD2601B to My Products, click on it, and click on the EXAMPLE PROJECTS & DEMOS tab. Find the example project filtering by 'data logger'.
-
Click Create button on the Bluetooth - Data Logger SD Card example. Example project creation dialog pops up -> click Create and Finish and Project should be generated.
-
Build and flash this example to the board.
-
Create a Bluetooth - SoC Empty project for the xG24 Dev Kit using Simplicity Studio 5.
-
Copy all attached files in the "inc" and the "src" folders into the project root folder (overwriting existing files).
-
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 attached gatt_configuration.btconf file.
-
Save the GATT configuration (ctrl-s).
-
-
Open the .slcp file. Select the SOFTWARE COMPONENTS tab and install the software components:
- [Services] → [Timers] → [Sleep Timer] → Set "Enable wallclock functionality"
- [Bluetooth] → [Bluetooth Host (Stack)] → [Additional Features] → [NVM Support]
- [Bluetooth] → [Application] → [Miscellaneous] → [Relative Humidity and Temperature sensor]
- [Services] → [IO Stream] → [IO Stream: USART] → vcom
- [Application] → [Utility] → [Log]
- [Platform] → [Driver] → [I2C] → [I2CSPM] → qwiic
- [Platform] → [Driver] → [I2C] → [I2CSPM] → sensor
- [Platform] → [Driver] → [SPI] → [SPIDRV] → exp
- [Platform] → [Driver] → [Button] → [Simple Button] → btn0
- [Platform] → [Board Driver] → [Si70xx - Temperature/Humidity Sensor]
- [Platform] → [Board] → [Board Control] → Enable Relative Humidity and Temperature sensor
- [Third Party Hardware Drivers] → [Storage] → microSD - microSD Click (Mikroe)
- [Third Party Hardware Drivers] → [Display & LED] → [SSD1306 - Micro OLED Breakout (Sparkfun) - I2C]
- [Third Party Hardware Drivers] → [Services] → [GLIB - OLED Graphics Library]
- [Third Party Hardware Drivers] → [Services] → [FatFS - Generic FAT Filesystem] → Set "Enable f_mkfs() function"
- [Bluetooth] → [OTA] → [In-Place OTA DFU] → uninstall
- [Platform] → [Bootloader Application Interface] → uninstall.
-
Build and flash the project to your device.
Note
Flash the application image to the device by using the .hex or .s37 output file.
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.
The GATT re-uses the SPP over BLE custom service:
- [Service] SPP Service: UUID
4880c12c-fdcb-4077-8920-a450d7f9b907- [Char] SPP Data: UUID
fec26ec4-6d71-4442-9f81-55bc21d658d6- [Notifiable] - Get notification of log data
- [Char] SPP Data: UUID
-
Initialize the peripherals, the Bluetooth stack
-
Get the logger to enable configuration from nvm
-
Initialize the OLED display
-
Mount file system on the SD card
- If failure to mount the file system then re-format it (make a new file system on the SD card)
-
Initialize the humidity & temperature sensor si7021
-
Start a periodic timer with period 10s. The timer callback will fire an external event to the BLE stack and the event handler will do:
- Get the sensor humidity & temperature sample.
- Update the OLED display with the sensor data
- Make a log entry from sensor data.
- Check the state of the BLE connection:
- If the receiver is connected and the notification is enabled then send the log entry to the receiver over the BLE notification
- If no BLE connection is made or the notification is not enabled:
- If the logger is enabled then append the log entry to the sd card
-
When a new BLE connection is made and notification of the SPP data characteristic is enabled then:
- If the log file exists on the sd card then all the logs on that file will be sent line by line over BLE notification of the SPP data characteristic. After that, the log file will be deleted
- If the log file does not exist or after sending all the log data from a file, the new log data is continuing sent over BLE notification of the SPP data characteristic
-
When pressing button 0 the callback will fire an external event to the BLE stack and the event handler will do:
- If the logger has been disabled then enable the data logger and save the config to the NVM.
- If the logger has been enabled then disable the data logger and save the config to the NVM.
- Press the button to enable/disable the logger
- Indicate wether the logger is enabled or disabled
-
The log data is sent line by line. They are separated by a line feed character.
-
The log line format:
yyyy/mm/dd hh:mm:ss Humidity = <humidity_value_percentage> RH, Temperature = <temperature_value_degree> C
-
To view the log data, we have 2 options:
-
Use Simplicity Connect Mobile Application to enable notification, the log data is received as an ASCII string
-
Use the BLE SPP app for Windows on a laptop or PC that has a Bluetooth adapter. First, we need to enter the name of the data logger (the default name is "Data Logger"). You should expect a similar output to the one below.
-
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.