Online tech learner logo
Online Tech Learner
  • Please enable News ticker from the theme option Panel to display Post

Matter development, BLE commissioning and Wi-Fi using Arm Virtual Hardware – Internet of Things (IoT) blog – Arm Community blogs

Matter development, BLE commissioning and Wi-Fi using Arm Virtual Hardware – Internet of Things (IoT) blog – Arm Community blogs

[ad_1]

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.

Preparation 

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

1. Assuming you are already registered then please log in here. If not, then please register here and return to this step once the registration is completed.

2. In the Device tab, click the Create Device button. 

Arm Virtual Hardware - Create Device

3. Click the Raspberry Pi 4 board.

Arm Virtual Hardware - Raspberry Pi Board

4. Click the Next button to continue.

Arm Virtual Hardware - Raspberry Pi Select

5. Click the “browse” link on right-hand side and select the Ubuntu Server 22.04 image from earlier.

Arm Virtual Hardware - Ubuntu

6. Once uploaded, click Next.

Arm Virtual Hardware - Configure Device

7. Enter a device name and click the Create Device button. Any name is fine. We used ubuntu-lighting

Arm Virtual Hardware - Create Device

8. Wait for the virtual device to be created and start up. To interact with the virtual board click the Console tab.Arm Virtual Hardware - virtual board

9. Use username: ubuntu and password: ubuntu to log into the console and change your password.

Arm Virtual hardware - Console

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:

ctrl_interface=DIR=/run/wpa_supplicant
update_config=1

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.

Arm Virtual Hardware services

15. Clone repo and setup sub modules

 

git clone https://github.com/project-chip/connectedhomeip.git --branch v1.0.0
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.

./out/debug/chip-lighting-app --wifi

Chip-tool device

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

Using Chip-tool

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_*

Next steps

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.

Resources:

Register for Arm Virtual Hardware

[ad_2]

Source link

administrator

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *