This project aims to implement a doorlock system using Silicon Labs development Kits and external sensors integrated with the BLE wireless stack.
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:
- 1x Bluetooth Low Energy Development Kit. For example, SparkFun Thing Plus Matter - MGM240P - BRD2704A
- 1x SparkFun RFID Qwiic Kit - ID12LA Board
- 1x SparkFun Micro OLED Breakout (Qwiic)
- 1x smartphone running the 'Simplicity Connect' mobile app
The hardware connection is shown in the image below:
The I2C connection is made from the Silicon Labs's Kit to the RFID board and the Micro OLED Breakout by using the qwiic cable.
Listed below are the port and pin mappings for working with this example.
-
Board: BRD2704A - SparkFun Thing Plus Matter - MGM240P
GPIO Pin Connection Pin function GPIOB PB00 GPIO input SCL PB03 I2C Clock SDA PB04 I2C Data -
Board: BRD2601B - EFR32xG24 Dev Kit- xG24
GPIO Pin Connection Pin function GPIOB PB02 GPIO input SCL PC04 I2C Clock SDA PC05 I2C Data -
Board: BRD2703A - EFR32xG24 Explorer Kit - XG24
GPIO Pin Connection Pin function GPIOB PB02 GPIO input SCL PC04 I2C Clock SDA PC05 I2C Data -
Board: BRD4108A - BG22 Bluetooth SoC Explorer Kit - BG22
GPIO Pin Connection Pin function GPIOB PC07 GPIO input SCL PD02 I2C Clock SDA PD03 I2C Data -
Board: BRD4314 Bluetooth Module Explorer Kit
GPIO Pin Connection Pin function GPIOB PB00 GPIO input SCL PD02 I2C Clock SDA PD03 I2C Data
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:
-
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 your hardware to MyProducts, click on it, and click on the EXAMPLE PROJECTS & DEMOS tab. Find the example project filtering by "rfid".
-
Click the Create button on the Bluetooth - Door Lock RFID (ID-12LA) example. Example project creation dialog pops up -> click Create and Finish and Project should be generated.
-
Create a "Bluetooth - SoC Empty" using Simplicity Studio v5. Use the default project settings.
-
Copy all attached files in inc and src folders into the project root folder (overwriting existing the app.c file).
-
Install the software components:
-
Open the .slcp file in the project.
-
Select the SOFTWARE COMPONENTS tab.
-
Install the following components:
- [Services] → [Timers] → [Sleep Timer]
- [Bluetooth] → [Bluetooth Host (Stack)] → [Additional Features] → [NVM Support]
- [Services] → [IO Stream] → [IO Stream: USART] → default instance name: vcom
- [Application] → [Utility] → [Log]
- [Platform] → [Driver] → [I2C] → [I2CSPM] → instance name: qwiic. Configure this instance to suit your hardware.
- [Third Party Hardware Drivers] → [Display & LED] → [SSD1306 - Micro OLED Breakout (Sparkfun) - I2C]
- [Third Party Hardware Drivers] → [Service] → [GLIB - OLED Graphics Library]
- [Third Party Hardware Drivers] → [Wireless Connectivity] → [ID-12LA - RFID Reader (Sparkfun) - I2C]
-
-
Import the GATT configuration:
-
Open the .slcp file in the project.
-
Select the CONFIGURATION TOOLS tab and open the Bluetooth GATT Configurator.
-
Click on the Import button and import the attached gatt_configuration.btconf file.
-
Save the GATT configuration (ctrl-s).
-
-
Build and flash this example to the board.
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.
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 changes were adding a new custom service (RFID Door Lock) which are 4 characteristics:
-
Mode:
-
[Readable] - Get mode value
-
[Writable] - Set operation mode (0 - normal, 1 - register, remove, 2 - show)
-
-
Remove Card:
- [Writable] - Provide card slot id to remove it from the registered cards.
-
Get card ID:
- [Readable] - Get selected card's ID
- [Writable] - Set selected card slot (default is 0).
-
Open Lock:
- [Writable] - Write 1 to open the lock.
-
Initialize the peripherals, the Bluetooth stack
-
Initialize the OLED display, show the 'Silabs' logo on the screen
-
Initialize and load the NVM3 configurations
-
Wait for the sensor to be booted and initialize the sensor with the configurations from NVM3:
-
Initialize RFID
-
Initialize application
-
After the sl_bt_evt_system_boot_id event arrives, the application sets up the security manager to bond with an iOS/Android device. And then start advertising.
-
Handle GATT event to help users configure the Use Simplicity Connect Mobile Application and get the result from the algorithm calculation over the EFR32 connect mobile application
![]() |
![]() |
---|
- Show LOCKED/UNLOCKED label
- LOCKED
- Show BLE connection status
- UNLOCKED
- RFID Card
- Show the used card's ID
- BLE
- Show CONNECTED label
- RFID Card
- Show CONFIG label
- Show the number of registered cards (max. 10)
- Show REMOVED label
- Show the number of registered cards (max. 10)
- Show ADDED label
- Show added/removed card's ID
- Has registered cards
- Show each slot data for 4 seconds
- Show slot index.
- Show card ID
- Show each slot data for 4 seconds
- Card slot is empty
- Show NO CARDS and "-" labels
Below are illustrations for each case
Follow the below steps to test the example with the Simplicity Connect application:
-
Open the Simplicity Connect app on your smartphone and allow the permission requested the first time it is opened.
-
Find your device in the Bluetooth Browser, advertising as RFID Door Lock, and tap Connect. Then you need accept the pairing request when connected for the first time.
Note: The pairing process on Android and iOS devices is different. For more information, refer to Bluetooth security.
![]() |
![]() |
---|
The parameters of this example application can be easily configured via BLE characteristics. Values for the characteristics are handled by the application as ASCII strings. Tap on the main service to see the available characteristics. Please refer GATT Configurator to choose the correct characteristic. Read
Push the read button to request the value of a characteristic. (See ASCII fields.) Write
For setting a parameter select a characteristic and tap on its write button. Type a new value in the ASCII field and push the Send button.