-
-
Notifications
You must be signed in to change notification settings - Fork 442
[PXCT-80] Nano Matter - Videos/Support Tutorials #2303
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mcmchris
merged 18 commits into
launch/nano-matter
from
mcmchris/nano-matter/videos-to-tutorial
Dec 3, 2024
Merged
Changes from 12 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
294d40e
Temperature Sensor Tutorial
mcmchris bd7aa6b
First Tutorial finished
mcmchris 5267a20
typo
mcmchris 953f8e4
Tuto 2 initiated
mcmchris ce8798f
codes added
mcmchris b2efed8
V2 hardware
mcmchris d7b361f
tutorial 2 advance
mcmchris b9c1e6f
Almost finished v2
mcmchris 8c4dc77
v2 ready
mcmchris 3dc05a5
Tutorials ready
mcmchris 9428a65
YouTube videos added
mcmchris 1e596b4
YouTube videos added 2
mcmchris 418c209
matter fan gif added
mcmchris cb8b020
smart relay animation added
mcmchris 7300115
rgb light animation added
mcmchris 2abed46
temp sensor animation added
mcmchris be319ea
Julian feedback applied all 4 tutorials
mcmchris 39d416e
rephrase
mcmchris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file added
BIN
+369 KB
...ardware/03.nano/boards/nano-matter/tutorials/matter-fan/assets/add-device-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+738 KB
.../hardware/03.nano/boards/nano-matter/tutorials/matter-fan/assets/add-device.png
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+232 KB
...rdware/03.nano/boards/nano-matter/tutorials/matter-fan/assets/bsp-install-2.png
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+768 KB
.../hardware/03.nano/boards/nano-matter/tutorials/matter-fan/assets/diagram-v4.png
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+35.7 KB
...nt/hardware/03.nano/boards/nano-matter/tutorials/matter-fan/assets/download.png
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.89 MB
.../hardware/03.nano/boards/nano-matter/tutorials/matter-fan/assets/matter-fan.gif
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+152 KB
...dware/03.nano/boards/nano-matter/tutorials/matter-fan/assets/matter-setup-2.png
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.45 KB
content/hardware/03.nano/boards/nano-matter/tutorials/matter-fan/assets/matter_fan.zip
Binary file not shown.
Binary file added
BIN
+385 KB
...re/03.nano/boards/nano-matter/tutorials/matter-fan/assets/serial-monitor-v4.png
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.16 MB
...ardware/03.nano/boards/nano-matter/tutorials/matter-fan/assets/thumbnail-v4.png
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
224 changes: 224 additions & 0 deletions
224
content/hardware/03.nano/boards/nano-matter/tutorials/matter-fan/content.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,224 @@ | ||
--- | ||
title: 'Matter Smart Fan' | ||
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
difficulty: beginner | ||
compatible-products: [nano-matter] | ||
description: 'Learn how to build a Matter fan with speed control.' | ||
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
tags: | ||
- IoT | ||
- Matter | ||
- BLE | ||
- Fan | ||
- Motor | ||
author: 'Christopher Méndez' | ||
hardware: | ||
- hardware/03.nano/boards/nano-matter | ||
software: | ||
- ide-v1 | ||
- ide-v2 | ||
- web-editor | ||
- iot-cloud | ||
--- | ||
|
||
## Overview | ||
|
||
This tutorial will teach you how to create a Matter fan for keeping you cool. | ||
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
 | ||
|
||
Thanks to the seamless compatibility of the Nano Matter with almost any Matter network we can easily integrate our fan with Amazon Alexa, Google Assistant, Apple Home, Home Assistant and even custom assistants. | ||
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
We have prepared a short demo in video format in case you are a visual learner. | ||
|
||
<iframe width="100%" height="480" src="https://www.youtube.com/embed/AiFm4T9EfnA" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe> | ||
|
||
## Hardware and Software Requirements | ||
### Hardware Requirements | ||
|
||
- [Nano Matter](https://store.arduino.cc/products/nano-matter) (x1) | ||
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- Grove motor driver module (x1) | ||
- DC motor (x1) | ||
- Breadboard (x1) | ||
- Jumper wires | ||
- Google Nest Hub Max (Thread Border Router) (x1) | ||
- [USB-C® cable](https://store.arduino.cc/products/usb-cable2in1-type-c) (x1) | ||
|
||
### Software Requirements | ||
|
||
- [Arduino IDE 2.0+](https://www.arduino.cc/en/software) or [Arduino Cloud Editor](https://create.arduino.cc/editor) | ||
- [Google Home App](https://home.google.com/get-app/) | ||
|
||
### Download the Project Code | ||
|
||
[](assets/matter_fan.zip) | ||
|
||
Download the complete project code [here](assets/matter_fan.zip). | ||
|
||
### Board Core and Libraries | ||
|
||
The **Silicon Labs** core contains the libraries and examples you need to work with the board's components, such as its Matter, Bluetooth® Low Energy, and I/Os. To install the Nano Matter core, navigate to **File > Preferences** and in the **Additional boards manager URLs**, add the following: | ||
|
||
`https://siliconlabs.github.io/arduino/package_arduinosilabs_index.json` | ||
|
||
Now navigate to **Tools > Board > Boards Manager** or click the Boards Manager icon in the left tab of the IDE. In the Boards Manager tab, search for `Nano Matter` and install the latest `Silicon Labs` core version. | ||
|
||
 | ||
|
||
## Project Setup | ||
|
||
### Schematic Diagram | ||
|
||
Use the following connection diagram for the project: | ||
|
||
 | ||
|
||
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
### Programming | ||
|
||
In the Arduino IDE upper menu, navigate to **Tools > Protocol stack** and select **Matter**. | ||
|
||
 | ||
|
||
Copy and paste the following sketch: | ||
|
||
```arduino | ||
#include <Matter.h> | ||
#include <MatterFan.h> | ||
|
||
#define fan_pin D4 | ||
|
||
MatterFan matter_fan; | ||
|
||
void setup() | ||
{ | ||
Serial.begin(115200); | ||
Matter.begin(); | ||
matter_fan.begin(); | ||
|
||
pinMode(BTN_BUILTIN, INPUT_PULLUP); | ||
pinMode(LEDR, OUTPUT); | ||
digitalWrite(LEDR, HIGH); | ||
|
||
pinMode(fan_pin, OUTPUT); | ||
|
||
Serial.println("Matter fan"); | ||
|
||
if (!Matter.isDeviceCommissioned()) { | ||
Serial.println("Matter device is not commissioned"); | ||
Serial.println("Commission it to your Matter hub with the manual pairing code or QR code"); | ||
Serial.printf("Manual pairing code: %s\n", Matter.getManualPairingCode().c_str()); | ||
Serial.printf("QR code URL: %s\n", Matter.getOnboardingQRCodeUrl().c_str()); | ||
} | ||
while (!Matter.isDeviceCommissioned()) { | ||
delay(200); | ||
} | ||
|
||
Serial.println("Waiting for Thread network..."); | ||
while (!Matter.isDeviceThreadConnected()) { | ||
delay(200); | ||
decommission_handler(); | ||
} | ||
Serial.println("Connected to Thread network"); | ||
|
||
Serial.println("Waiting for Matter device discovery..."); | ||
while (!matter_fan.is_online()) { | ||
delay(200); | ||
decommission_handler(); | ||
} | ||
Serial.println("Matter device is now online"); | ||
} | ||
|
||
void loop() | ||
{ | ||
decommission_handler(); | ||
static uint8_t fan_last_speed = 0; | ||
uint8_t fan_current_speed = matter_fan.get_percent(); | ||
|
||
if (fan_current_speed != fan_last_speed) { | ||
fan_last_speed = fan_current_speed; | ||
Serial.print("Fan speed: "); | ||
Serial.print(fan_current_speed); | ||
Serial.println("%"); | ||
int speed = map(fan_current_speed, 0, 100, 0, 255); | ||
analogWrite(fan_pin, speed); | ||
} | ||
|
||
static bool fan_last_state = false; | ||
bool fan_current_state = matter_fan.get_onoff(); | ||
|
||
if (fan_current_state != fan_last_state) { | ||
fan_last_state = fan_current_state; | ||
if (fan_current_state) { | ||
Serial.println("Fan ON"); | ||
} else { | ||
Serial.println("Fan OFF"); | ||
} | ||
} | ||
} | ||
|
||
void decommission_handler() | ||
{ | ||
// If the button is not pressed or the device is not commissioned - return | ||
if (digitalRead(BTN_BUILTIN) != LOW || !Matter.isDeviceCommissioned()) { | ||
return; | ||
} | ||
|
||
// Store the time when the button was first pressed | ||
uint32_t start_time = millis(); | ||
// While the button is being pressed | ||
while (digitalRead(BTN_BUILTIN) == LOW) { | ||
// Calculate the elapsed time | ||
uint32_t elapsed_time = millis() - start_time; | ||
// If the button has been pressed for less than 10 seconds, continue | ||
if (elapsed_time < 10000u) { | ||
yield(); | ||
continue; | ||
} | ||
|
||
// Blink the LED to indicate the start of the decommissioning process | ||
for (uint8_t i = 0u; i < 10u; i++) { | ||
digitalWrite(LED_BUILTIN, !(digitalRead(LED_BUILTIN))); | ||
delay(100); | ||
} | ||
|
||
Serial.println("Starting decommissioning process, device will reboot..."); | ||
Serial.println(); | ||
digitalWrite(LED_BUILTIN, LED_BUILTIN_INACTIVE); | ||
// This function will not return | ||
// The device will restart once decommissioning has finished | ||
Matter.decommission(); | ||
} | ||
} | ||
``` | ||
|
||
This is a very simple code that consist of the Arduino basic sketch parts: | ||
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- In the `setup()` function we initialize the Matter connectivity and the fan output pin. | ||
- In the `loop()` function we listen to any fan control command sent from the smartphone or voice assistant and then adjust the fan speed setting the PWM signal accordingly. | ||
|
||
Once you uploaded the example code to the Nano Matter, open the Serial Monitor and reset the board. | ||
|
||
 | ||
|
||
There you will find the URL that generates the QR for the Matter device commissioning. | ||
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Commissioning | ||
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
Copy and paste the QR code URL on your favorite web browser and a unique QR code will be generated for your board. | ||
|
||
Go to your **Google Home** app, navigate to **devices** and tap on **Add**, select the **Matter-enabled device** option and scan the QR code. | ||
|
||
 | ||
|
||
 | ||
|
||
## Final Results | ||
|
||
Finally, you will be able to control the fan from your smartphone, hub or asking your personal assistant. | ||
|
||
 | ||
|
||
## Conclusion | ||
|
||
In this tutorial we have learned how to create a Matter enabled fan that can be controlled from our smartphone and personal assistant. The Nano Matter allows us to seamlessly integrate the fan as a commercial product with our current smart home ecosystem. | ||
mcmchris marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
### Next Steps | ||
|
||
You can take this solution even further by adding an external knob to adjust the fan speed manually or integrating an AC motor driver to control an actual ceiling fan. |
Binary file added
BIN
+369 KB
...ano/boards/nano-matter/tutorials/matter-relay-lightbulb/assets/add-device-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+738 KB
....nano/boards/nano-matter/tutorials/matter-relay-lightbulb/assets/add-device.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+232 KB
...no/boards/nano-matter/tutorials/matter-relay-lightbulb/assets/bsp-install-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+757 KB
....nano/boards/nano-matter/tutorials/matter-relay-lightbulb/assets/diagram-v3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+35.7 KB
...03.nano/boards/nano-matter/tutorials/matter-relay-lightbulb/assets/download.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+152 KB
...o/boards/nano-matter/tutorials/matter-relay-lightbulb/assets/matter-setup-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.49 KB
...03.nano/boards/nano-matter/tutorials/matter-relay-lightbulb/assets/matter_smart_relay.zip
Binary file not shown.
Binary file added
BIN
+464 KB
...oards/nano-matter/tutorials/matter-relay-lightbulb/assets/serial-monitor-v3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.95 MB
...nano/boards/nano-matter/tutorials/matter-relay-lightbulb/assets/smart-relay.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.59 MB
...ano/boards/nano-matter/tutorials/matter-relay-lightbulb/assets/thumbnail-v3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.