Window Covering
This sample demonstrates the usage of the Matter application layer to build a window covering device. This device works as a Matter accessory device, meaning it can be paired and controlled remotely over a Matter network built on top of a low-power 802.15.4 Thread network. The sample uses buttons for gradually changing the position and movement mode of the window cover, and LEDs to show the state of these changes. The following movement modes are available:
Lift - In this movement mode, the window cover moves up and down.
Tilt - In this movement mode, the window cover slats are tilted forward or backward without the cover moving vertically.
Requirements
The sample supports the following development kits:
Hardware platforms |
Board name |
---|---|
RTL8777G HDK |
RTL8777G EVB |
Prepare Matter Environment
To set up the Matter environment, follow the steps listed in Development Setup.
Prepare CHIP Tool
The CHIP Tool (chip-tool) is a Matter controller implementation that allows commissioning a Matter device into the network and communicating with it using Matter messages, which may encode Data Model actions, such as cluster commands. The tool also provides other utilities specific to Matter, such as parsing the setup payload or performing discovery actions.
To build the target, follow the steps listed on the CHIP Tool.
Configurations
Sample Configurations
Our example samples all have default configurations.
If wanting to modify the sample configuration,
change CHIPProjectConfig.h
under the path matter/connectedhomeip/examples/<app_name>/realtek_bee/main/include
,
where app_name refers to the name of the application, for example, lighting-app.
See APP Config for more information about configuration items.
Factory Data Configurations
The factory data is disabled by default for the evb board. To use factory data, follow the section Enable Factory Data Support and Factory Data Generation in Factory Data.
Building and Downloading
Building
Navigate to the openthread directory and build window-covering app.
$ cd beeSDK/subsys/openthread/
$ rm -r build/
$ ./build.py rtl8777g window
Downloading
After a successful compilation, the app bin matter-cli-mtd_bank0_MP_dev_*.bin
will be generated in the directory build/bank0/bin
.
To download app bin into EVB board, follow the steps listed on the Downloading in Quick Start. If the factory data is enabled, also refer to Program Factory Data in Factory Data.
Then press reset button on EVB board and it will start running.
Experimental Verification
After programming the sample to your EVB board, complete the steps in the following sections.
Preparation Phase
Connect the kit to the computer using a USB cable.
Open a serial port connection to the kit using a terminal emulator (for example, Tera Term).
If the device was not erased during the programming, press and hold SW2 for more than 6.5 seconds until the factory reset takes place.
Press RST to start the Bluetooth LE advertising.
Commission the device to the Matter network. See Commissioning the Device for more information. During the commissioning process, write down the value for the window node ID for later use (<window_node_ID>).
Testing Phase
Observe that LED 0 and LED 2 are turned on, which means that the window cover is fully opened. The device starts in the lift movement mode by default.
Press SW3 20 times to fully close the cover in the lift movement mode. The brightness of LED 0 decreases with each button press until the LED turns off.
Press SW4 20 times to fully open the cover. LED 0 lights up and its brightness increases with each button press until it reaches full brightness.
Press SW1 to switch into the tilt movement mode.
Press SW3 20 times to fully tilt the cover into the closed position. The brightness of LED 2 decreases with each button press until the LED turns off.
Press SW4 20 times to fully tilt the cover into the open position. LED 2 lights up and its brightness increases with each button press until it reaches full brightness.