Matter was launched in November with 190 certified products. This is a major inflection point for the IoT as the standard opens the door for services that may now seamlessly control any device from any manufacturer. In the first blog of this series, we introduced Arm virtual Hardware (AVH) and demonstrated how AVH is used to start development with the Matter stack. In the second blog, we demonstrated Python running on AVH to control a light using the Matter protocol. In this blog, we will get closer in the development to the actual scenario for a Matter product where commissioning happens over Bluetooth and then controlled over WiFi. Following this blog, we will introduce a virtual mobile phone to perform the commissioning over BLE then hand over control to a Matter hub over WiFi. One step at a time…
1. Follow the “Package Ubuntu Server Firmware for AVH” guide on a Linux computer (or virtual) machine to create a AVH Ubuntu 22.04 OS image.
Lighting app device
2. In the Device tab, click the Create Device button.
3. Click the Raspberry Pi 4 board.
4. Click the Next button to continue.
5. Click the “browse” link on right-hand side and select the Ubuntu Server 22.04 image from earlier.
6. Once uploaded, click Next.
7. Enter a device name and click the Create Device button. Any name is fine. We used ubuntu-lighting
8. Wait for the virtual device to be created and start up. To interact with the virtual board click the Console tab.
9. Use username: ubuntu and password: ubuntu to log into the console and change your password.
10. As per the Step 1 of the Building Matter – Installing prerequisites on Raspberry Pi 4 section, edit /etc/systemd/system/dbus-fi.w1.wpa_supplicant1.service with sudo and a text editor of your choice. Change the ExecStart line to
ExecStart=/sbin/wpa_supplicant -u -s -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf
11. Create the file /etc/wpa_supplicant/wpa_supplicant.conf with sudo and a text editor of your choice. Add the following:
12. Restart wpa_supplicant:
sudo systemctl restart wpa_supplicant.service sudo systemctl daemon-reload
13. Install dependencies
sudo apt-get update sudo apt-get -y install git gcc g++ python3 pkg-config libssl-dev libdbus-1-dev libglib2.0-dev libavahi-client-dev ninja-build python3-venv python3-dev python3-pip unzip libgirepository1.0-dev libcairo2-dev libreadline-dev
14. Press tab to select “Ok” when presented with the following prompt, then press enter.
15. Clone repo and setup sub modules
git clone https://github.com/project-chip/connectedhomeip.git cd connectedhomeip ./scripts/checkout_submodules.py --shallow --platform linux
16. Setup dev environment (takes 5-10 minutes).
./scripts/build/gn_bootstrap.sh source scripts/activate.sh
17. Build lighting-app example.
cd examples/lighting-app/linux gn gen out/debug ninja -C out/debug
18. Disable the Ethernet interface.
sudo ip link set dev eth0 down
19. Run lighting-app example.
1. Open a new browser window: https://app.avh.arm.com
2. Repeat steps 2-9 and 13-16 from above, change the devices name to something different like ubuntu-chip-tool in step 6.
3. Build chip-tool example.
cd examples/chip-tool gn gen out/debug ninja -C out/debug
4. Install network manager.
sudo apt -y install network-manager
5. Enable Wi-Fi and set Wi-Fi SSID credentials (SSID: Arm, password: password) – (based on https://ubuntu.com/core/docs/networkmanager/configure-wifi-connections).
sudo nmcli r wifi on sudo nmcli d wifi connect Arm password password
6. Disable the Ethernet interface.
sudo ip link set dev eth0 down
1. Commission the lighting device to the AVH virtual Wi-Fi network using:
./out/debug/chip-tool pairing ble-wifi 42 Arm password 20202021 3840
- 42 – is the node-id chip-tool will assign the device
- Arm – is the Wi-Fi SSID
- Password – is the Wi-Fi network password
- 20202021 – is the setup pin code
- 3840 – is the discriminator
The selected option of “ble-wifi” specifies to the chip-tool application that the sequence requested is commission over BLE then pass control over WiFi. The application will setup BLE to discover the lighting device on the other AVH RPi. BLE is active by default in the Ubuntu server image.
2. Turn the light on
./out/debug/chip-tool onoff on 42 1
3. Turn off the light
./out/debug/chip-tool onoff off 42 1
If needed, device config can be cleared using the following command:
rm -rf /tmp/chip_*
Our goal is to enable all developers to start exploring the Matter SDK as quickly as possible with minimal friction and I hope this example helps.
AVH was created to run from a command-line interface using scripts as the end goal is automation. AVH was also designed to integrate with modern CI/CD tools such as GitHub Actions. The web-based user interface is to help developers experiment with this breakthrough technology. You can the access API and integration with CI/CD tools to perform autonomous tests at network scale.
The IoT runs on Arm, and we have a responsibility to create greater opportunities for innovation and scale by continually raising the bar on performance, simplified development, and software reuse for the whole value chain. As such, we introduced Arm Virtual Hardware, a transformative offering, designed to enable software development on virtual hardware in the cloud. This allows the Arm ecosystem to easily adopt sophisticated modern cloud-based development and CI/CD techniques, without the need for large custom hardware farms.