If you are interested in smart home solutions and trying to keep up with the latest trends, you have likely heard about Matter. My name is Kamil Kasperczyk, I am a firmware engineer at Nordic Semiconductor, and I spent most of my days developing Matter and integrating it into the nRF Connect SDK. I am delighted to announce that this brand-new protocol’s 1.0 version was officially released in October last year after more than two years of work. This means that the first Matter compatible products will appear on the market very soon. Some companies, like Apple, Samsung, and Google, have already updated firmware in their existing products to enable Matter support. The Nordic Matter platform and example Matter applications integrated in the nRF Connect SDK follow the most recent versions of the Matter protocol and work with the mentioned ecosystems out-of-the-box.
This blog post will take you through the steps of setting up your own Matter network using Nordic Semiconductor’s hardware flashed with the Light Bulb firmware from nRF Connect SDK.
Table of Contents
- Thread and Wi-Fi coexistence in Matter
- Multiple Matter fabrics
- Testing Nordic Semiconductor's Matter platform with Apple, Google, and Samsung ecosystems
- Preparing the Matter Light Bulb accessories firmware
- Preparing the ecosystems' devices
- Stage 1: Commissioning of Matter over Thread Light Bulb to the Google Home ecosystem
- Stage 2: Commissioning of Matter over Wi-Fi Light Bulb to the Apple Home ecosystem
- Stage 3: Sharing Matter over Thread Light Bulb from Google to the SmartThings ecosystem
- Stage 4: Sharing Matter over Wi-Fi Light Bulb from Apple to SmartThings ecosystem
- Stage 5: Sharing Matter over Thread Light Bulb from SmartThings to Apple Home ecosystem
- Stage 6: Sharing Matter over Wi-Fi Light Bulb from Apple to Google Home ecosystem
- Setting the setup discriminator value
Thread and Wi-Fi coexistence in Matter
Matter offers support for using different wireless protocols for different use cases. This allows it to cover a wide variety of devices present in homes. Wi-Fi is typically used for devices requiring high transmission bandwidth like cameras or speakers, while Thread is targeting low-power devices that require high energy efficiency. Given that direct communication between Wi-Fi and Thread devices is not possible, due to radio technology differences, they need an additional device called Thread Border Router to route messages between the Wi-Fi and Thread interfaces. In Matter, you can use a device called a Matter controller to manage smart home products. To simplify the solution, many ecosystem providers integrate the Matter controller and Thread Border Router functionality inside of a single device, such as a hub. This way, the user is able to control all accessories from their smartphone with the same ease and does not have to worry about what technology these accessories are using underneath. The following picture shows an example of a Matter network topology that includes both Wi-Fi and Thread technologies:
For more information regarding Matter network concepts, see the nRF Connect SDK documentation.
Multiple Matter fabrics
The Matter protocol introduces the fabric term as a logical concept for grouping multiple Matter devices together by sharing the same operational credentials and root of trust. For example, a single Matter fabric may be created by the Matter controller of a specific ecosystem provider. As many of us have multiple devices at home, working with different ecosystem providers, Matter ensures interoperability between them and allows a single accessory device to belong to multiple different fabrics.
To read more information about the multi fabric feature, see the nRF Connect SDK documentation.
Testing Nordic Semiconductor's Matter platform with Apple, Google, and Samsung ecosystems
Nordic Semiconductor’s Matter over Thread solution has been available for some time and has allowed the user to test using developer setup. The first nRF Connect SDK release introducing Matter support was v1.5.0, and from the nRF Connect SDK v2.0.0 recommended setup includes the Matter CHIP Tool command line tool and a Thread Border Router running on a Raspberry Pi. Now, using this solution has become much easier thanks to the official support for Matter in on-market products, which may be already present in our homes. You just need to flash the development kit with Matter compatible firmware from the nRF Connect SDK and commission the device to a Matter network created by one of the ecosystems. Moreover, the latest nRF Connect SDK v2.2.0 release makes it possible to test not only Matter over Thread, but also the Matter over Wi-Fi solution running on the new nRF7002 DK.
In the next part of this article, I will demonstrate how to test both of Nordic Semiconductor’s available Matter solutions with Apple, Google, and Samsung SmartThings ecosystem public releases that support Matter. Every ecosystem will create a separate Matter fabric. I will show how to commission Nordic Semiconductor Matter devices and then expand the network by using Matter’s multi fabric feature to share Matter devices between ecosystems. For the user’s benefit, I will describe how to share both Nordic Matter devices using each of the ecosystems, but you should be able to create a smaller subset of the proposed topology as well.
The bare minimum set up to create Matter network and test Matter accessory is one Matter over Thread or Matter over Wi-Fi nRF development kit, and one set of devices creating the ecosystem. To complete all the steps presented in this part, you would need to prepare the following hardware:
- Matter over Thread development kit: 1x nRF52840 DK or 1x nRF5340 DK
- Matter over Wi-Fi development kit: 1x nRF7002 DK (it will be publicly available to purchase at the end of January 2023)
- Devices creating Apple Home ecosystem:
- 1x Apple iPhone with iOS 16.1 or higher system version
- 1x Apple HomePod Mini with 16.1 or higher system version
- Devices creating Google Home ecosystem:
- 1x Android smartphone with Google Home app installed (it can be the same that is used for the SmartThings app).
- 1x Google Nest Hub 2nd generation or 1x Google Nest Hub Max (this article uses Google Nest Hub 2nd generation)
- Devices creating SmartThings ecosystem:
- 1x Android smartphone with SmartThings app installed (it can be the same that is used for the Google Home app).
- 1x Smart Home Hub working with SmartThings and supporting Wi-Fi and Thread technologies (for example, Aeotec Smart Home Hub, as used in this article)
- 1x Wi-Fi Access Point supporting IPv6 connected to the Internet (for example, Asus RT-AC1300G, as used in this article)
- 1x PC with nRF Connect SDK 2.2.0 installed
Preparing the Matter Light Bulb accessories firmware
To prepare the Matter Light Bulb accessory, you must build and flash the nRF Connect SDK’s Matter Light Bulb sample for nRF52840 DK or nRF5340 DK and for nRF7002 DK targets. This way, you will get Matter over Thread and Matter over Wi-Fi accessories, respectively.
By default, all samples use the same Matter device discriminator that is equal to 3840 (0xF00), so in case of using multiple devices, the Matter controller will not be able to distinguish which one should be commissioned and it will select the first one discovered. In this article, the default configuration is used for both devices, but to avoid the mentioned problem, choose different values for both devices.
Preparing the ecosystems' devices
The first thing you need to do is to make sure that you have rooms created in all ecosystems’ applications and the appropriate hubs are visible in them. It is also necessary that all devices (hubs and phones) are connected to the same Wi-Fi access point network. The following pictures show examples of device control within mobile applications from Apple, Google, and SmartThings:
Stage 1: Commissioning of Matter over Thread Light Bulb to the Google Home ecosystem
The first stage of this guide will be commissioning a Matter over Thread Light Bulb to the Matter fabric. The Google Home fabric will be used as an example, but this stage could be done with any other ecosystem as well. The Matter Light Bulb example for the development kit uses test Vendor ID (0xFFF1) and Product ID (0x8005). For development purposes, Google Home ecosystem requires devices with a test VID to have a Matter integration in the Google Home Developer Console. Make sure the same Google account is used in the Developer Console and Google Home application.
To perform the commissioning, complete the following steps:
1. Make sure a Matter integration for the Light Bulb's test VID and PID is registered in the Google Home Developer Console.
2. Turn on the nRF52840 DK.
3. Press and hold Button 1 on the DK for over 6 seconds to trigger the factory reset of the device and begin Bluetooth LE advertising.
4. Open the Google Home app on the smartphone.
5. Click + Add icon in the bottom right corner.
6. In the next screens, select New device and your home name, as presented on the following pictures:
After finding the advertising device you will see the Scan Matter QR code screen:
7. Scan the attached QR code with your phone’s camera:
8. On the next screen, agree to connect the device to your Google Account and wait for the commissioning process to complete. The following pictures show this step:
9. When the commissioning is done, the app will ask you to select Matter device location and name. Select your created room name and any name. The following pictures show this step:
10. The Light Bulb device should now be visible on the Devices tab of the Google Home app. Tap the Light Bulb device tile to turn it on and off or swipe left and right to adjust the brightness of the light. You should be able to observe that the LED2 of the nRF52840 DK changes state accordingly.
11. You can also long-press on the Light Bulb device tile to enter the lighting controller. In this screen, you can move the slider to change the light brightness. The LED2 of the nRF52840 DK should align with those changes as well.
Stage 2: Commissioning of Matter over Wi-Fi Light Bulb to the Apple Home ecosystem
In the second stage of the guide, the Matter over Wi-Fi Light Bulb will be commissioned to a different Matter fabric than the one used in the previous step. I will use Apple’s fabric as an example. The setup procedure looks very similar to the one described in the previous stage, where we set up a Matter over Thread Light Bulb in the Google Home ecosystem. After completing this stage, the topology of the created network will look like the following image. The Matter over Wi-Fi Light Bulb will belong to the Apple fabric, and the Matter over Thread Light Bulb to the Google Home fabric:
Complete the following steps:
1. Turn on the nRF7002 DK.
2. Press and hold Button 1 on the DK for over 6 seconds to trigger the factory reset of the device and begin Bluetooth LE advertising.
3. Open the Apple Home app on the iPhone.
4. Click the + icon in the top right corner and select the Add Accessory option, as seen in the following image:
5. In the next screen, scan the following QR code with the iPhone’s camera:
6. Confirm adding accessory to Apple Home with the Add to “Apple Home” button and wait for the commissioning procedure to complete, as seen on the following images:
7. During the commissioning, you will be informed that the device you are adding is an uncertified accessory. This is expected, as the Light Bulb example application is not an officially certified on-market product. Confirm the addition by clicking Add anyway, as seen on the following picture:
8. When the commissioning is done, you will be asked to select the Light location in your home and select the Matter accessory name. After finalizing those steps, you should see the message that the Light was added to your home, as shown on the pictures below:
9. The Light Bulb device should be visible in the main view of your room. Tap on the Light Bulb symbol to turn it on and off. You should be able to observe that the LED2 of the nRF7002 DK changes state accordingly.
10. You can also click on the Light Bulb name to enter the detailed view. In this window, you can move the slider to change the light brightness. The LED2 of the nRF7002 DK should align with those changes as well.
Stage 3: Sharing Matter over Thread Light Bulb from Google to the SmartThings ecosystem
So far, both the Matter over Thread and the Matter over Wi-Fi devices were commissioned to separate Matter fabrics, but the great advantage of Matter is the ability of sharing the devices between different fabrics. In other words, it means it’s possible to access the same device from different ecosystems at the same time. The first example of using Matter's multi-fabric feature will be sharing the Matter over Thread Light Bulb from Google to the SmartThings fabric. The goal for this stage is to achieve the following Matter network topology:
Complete the following steps:
1. Open the Google home app.
2. Click and hold the Thread Light Bulb name to open the detailed view.
3. Click on the device settings gear icon in the top right corner of the screen. The following view will appear:
4. To commission the device to the new fabric, the controller from the Google Home fabric must open the commissioning window for the new controller. To do this, in the next screens, select the options Linked Matter apps & services, Link apps & services, and Use pairing. After that, the pairing code for the new controller will appear on the screen, as seen on the pictures below:
In this article, I used a single mobile phone to host Google Home and SmartThings applications. For this reason, I had to use a pairing code as the sharing method. With more than one phone, I could share the QR code from one smart phone and scan it with the other one.
5. Open the SmartThings app.
6. Click on the + icon in the top right corner and select the Add device option.
7. Click on the Scan button in the Scan for nearby devices section. The application will start scanning, which may take up to 1 minute.
8. After discovering the Matter device, click the Add button.
9. In the next screens, confirm starting commissioning with the Start button and select the device location. The following pictures show the described step:
10. Verify that you are authorized to commission the device:
a. Select Enter PIN code instead and then insert the PIN code displayed by the Google Home app. After that the commissioning will start.
b. During the process you will be prompted with a message informing you that the device is not certified. Again, this is similar to the previous messages of this kind mentioned earlier and it appears because the Light Bulb application is not an official product. Confirm the information using the Continue button.
11. Once the commissioning is done, you will be asked to select the device name and it will be registered to the SmartThings cloud. After the registration is complete, you will see the Thread Light Bulb in your room view.
12. Tap on the Light Bulb symbol to turn it on and off. You will see that the LED2 of the nRF52840 DK changes the state accordingly to the selected state.
13. Click on the Light Bulb name to enter the detailed view. In this window, you can change the light brightness using the slider in the Dimmer section.
Stage 4: Sharing Matter over Wi-Fi Light Bulb from Apple to SmartThings ecosystem
The next phase is very similar to the previous one. The difference is that this time, the Matter over Wi-Fi device will be shared using the Apple Home ecosystem. The process will be almost identical, with some minor differences related to the Apple Home application UI. For this reason, some parts related to the SmartThings app will not be repeated in a very detailed way. After completing this stage, the Matter network topology should look in the following way:
Complete the following steps:
1. Open Apple Home app.
2. Click on the Wi-Fi Light Bulb name to open the detailed view.
3. Click on the device settings gear icon in the bottom right corner of the screen and scroll down to see the following screen:
4. Open the commissioning window for the SmartThings controller by clicking on the Turn On Pairing Mode button. The message with the printed Setup Code will appear, as shown on the following picture:
5. Open the SmartThings app and add a new device in the same way as described in the Stage 3 steps, and in the verification step, insert the setup code printed by the Apple Home app. The following pictures show some parts of this process:
6. After the commissioning is done, the new Wi-Fi device should be visible in the main room view. You will be able to control it in the same way as the Thread Light Bulb, that is by clicking on the icon or using the slider.
Stage 5: Sharing Matter over Thread Light Bulb from SmartThings to Apple Home ecosystem
It’s time to add the Matter over Thread Light Bulb to the Apple fabric. In the previous stages, the Apple and Google controllers were used to share the devices. Now, to present all possible use cases, the SmartThings controller will be used for this purpose. After completing this stage, the Matter network topology will look in the following way:
1. Open SmartThings app.
2. Click on the Thread Light Bulb name to open the detailed view.
3. Click on three dots icon in the top right corner of the screen.
4. Select the Share with other services option, as shown in the picture below:
5. Open the commissioning window for the Apple controller by clicking on Share device button. As a result, you will see the printed QR code that can be used by another controller for commissioning purposes.
6. Open the Apple Home app.
7. Click on the + icon on the top right corner and select the Add Accessory option.
8. Scan the QR code displayed by the SmartThings app using the Apple application. The commissioning will start and proceed in the same way as in previous stages.
9. Once the commissioning is done, the new Thread device should be visible in the main room view. You can control it in the same way, as the already present Wi-Fi Light Bulb device.
Stage 6: Sharing Matter over Wi-Fi Light Bulb from Apple to Google Home ecosystem
The last part left in this tutorial is adding the Matter over Wi-Fi Light Bulb to the Google Home ecosystem. As an example, I will share it using the Apple Home app, but it can be done using the SmartThings app as well. The Matter network will have the following final shape:
Complete the following steps:
1. Open the Apple Home app.
2. Click on the Wi-Fi Light Bulb name.
3. Click on the settings gear icon and scroll down to the bottom of the list.
4. Click on the Turn On Pairing Mode button. This will result in displaying the Setup Code on the screen.
5. In the Google Home app, click on + Add icon in the bottom right corner.
6. Click Set up without QR code in the Scan Matter QR code section and insert the setup code displayed in the Apple Home app. The commissioning will start and proceed in the same way as in previous stages.
7. Once the commissioning is done, the new Wi-Fi device should be visible in the main room view. You can control it in the same way, as the already present Thread Light Bulb device.
Setting the setup discriminator value
According to the Matter specification, every Matter device should use a unique setup discriminator value that is a 12-bit unsigned integer.
The setup discriminator value can be set for the specific device by modifying the CHIP_DEVICE_CONFIG_USE_TEST_SETUP_DISCRIMINATOR value in the src/chip_project_config.h file.
To allow the Matter controller to distinguish advertisements from two Matter devices, you can for example assign them the 0xFA0 and 0xFB0 values.
After changing the default discriminator configuration, re-building the firmware, and flashing it to the development kit, you will not be able to use the onboarding QR codes provided in this article anymore.
To generate new QR codes, complete the following steps:
- Connect the development kit to the PC using an USB cable.
- Open the DK’s serial port using your favorite serial port monitor app and the baudrate of 115200 bits per second. The nRF52840 DK has only one serial port, but the nRF5340 DK and the nRF7002 DK have two serial ports, as those devices have two separate cores. Select the port with the higher number to see logs from the application core. After that, you should be able to see the application logs.
- Find a message similar to the following one in the application logs:
I: 649 [SVR]Copy/paste the below URL in a browser to see the QR Code:
I: 655 [SVR]https://project-chip.github.io/connectedhomeip/qrcode.html?data=MT%3A6FCJ142C00KA0648G00
- Open URL in the web browser to display the QR code that will provide the device with onboarding information necessary to commission the device.
Do you want more content like this? Feel free to like this blog post, and give us a comment below about your experience using Nordic Semiconductor's platform. If you would like to learn more about how to develop Matter products with the nRF Connect SDK, see the Nordic Semiconductor's Matter webinars.