I put together this project to showcase the ability to use my SenseCAP Indicator to trigger home automation related behavior. It's pretty neat as you can create endless dashboards for your home with this approach.
Steps to ReproduceNote: At the present this code has not been merged into the main branch of the SenseCAP Indicator ESP32 repository. As such it will need to be currently accessed via my fork and and the associated feature branch. Apologies for the inconvenience for the time being.
- Clone my fork of the SenseCAP_Indicator_ESP32 github repository
- Switch to the local branch "timo614-indicator-matter"
- Prepare your environment for SenseCAP Indicator (requires a specific version of the ESP IDF currently and a patch)
- Prepare your local environment for Matter
- Activate ESP IDF and ESP Matter
- Set the target of your device to ESP32S3
- Build, flash, and monitor
- Configure your device and enjoy
In short those are all the steps you need to take to get this running on your machine. I'll walk through them now in a bit more detail to help you get configured.
First you'll need to clone my fork and switch to the indicator matter branch this can be done via the following:
git clone https://github.com/Timo614/SenseCAP_Indicator_ESP32.git
cd SenseCAP_Indicator_ESP32
git checkout timo614-indicator-matter
Next you'll need to prepare your environment by following this guide from Seeed Studio for working with the SenseCAP Indicator. Please ensure you install version IDF 5.0.1 and the associated patch Seeed Studio provided for the 120M Octal RAM support.
After installing ESP-IDF you'll need to install ESP-Matter. You can follow Espressif's guide for installing. I've used the following branch successfully for testing with my device on this version of ESP-IDF: https://github.com/espressif/esp-matter/tree/release/v1.1
Once ESP-IDF and ESP-Matter are installed locally you will want to activate them in your shell. Doing so allows you to use the associated tooling for building, monitoring and flashing your device.
As the device is a SenseCAP Indicator it includes an ESP32S3 so you'll need to set the target for this device. First cd into the associated examples directory and then run the set-target command.
cd examples/indicator_matter
idf.py set-target esp32s3
These commands move you into the example directory for this project and then setup the project such that the sdkconfig is built from the sdkconfig.defaults present in the directory. Part of this process pulls down a set of managed components from Espressif included as part of the build process.
Next, with the indicator plugged in, you should first erase the flash to avoid any chance of issues arising.
idf.py erase-flash
With that out of the way you can begin the build process, I suggest building, flashing, and monitoring but building and flashing is enough to have the demo in a running state.
idf.py build flash monitor
Now that it's built you can begin the process of provisioning. As soon as the application loads up it shows the default QR code set to the test PID and VID for Matter. See the demo video for a full set of features and how to access them now that you're in!
BackgroundSeeed Studio has a call to the community to take on some project ideas they have to enhance their wiki and showcase their products. I was excited about grabbing one of the tasks they mentioned as I have a SenseCAP Indicator and had wanted to experiment with it more heavily. In addition I saw it as a good opportunity to learn about the Matter protocol.
The SenseCAP Indicator is a neat little device that has dual MCUs that control different elements of the experience. The RP2040 is used to handle gathering the sensor data which is then communicated to the ESP32S3 which allows for its use in various projects. Seeed Studio provides some basic firmware which gives a neat experience showcasing the device with the associated accessory for determining VOC, Temperature, Humidity, and CO2.
For this project my goal was to take this firmware, adapt it to work with the Matter SDK, and setup a demo dashboard to trigger activation on the Matter side.
IdeaThe project at its core is really just an application of the existing device in a new way.
The different elements of the project consisted of:
- Adjusting the C project to be a C++ one such that I could include the Matter SDK as a dependency
- Working through memory limitations as I based this off the Indicator Basis demo from Seeed Studio so it the project already was constrained given its existing application
- Selecting devices that could work for the Google Home environment
- Working through some limitations of the SDK vs project needs
The Matter SDK from Espressif is an SDK that allows an end developer to get up and running with Matter fairly quickly. It ties well into the ESP event loop allowing for you to listen for events to update the state of your device.
For the project I converted it to C++ and adjusted the build files such that they could run the Matter SDK. After getting things running and putting together some logic to initialize the devices I immediately noticed memory issues. From here I began a long process of performance tuning the sdkconfig where possible to free up as much memory as I could. This helped somewhat and I was able to begin provisioning.
Soon after this I was able to get the devices setup and reporting via the Matter SDK. To avoid sending too much I decided to move the update call for persisting the temperature and humidity into a event that runs every 10 seconds vs as soon as the sensor reports its state.
Things were working pretty well at this point but after this I went to implement a new dashboard with lvgl and ended up running into further memory constraints. I considered rewriting how the dashboard was generated to use less memory but I had already sunk a lot of time into the project so I didn't want to go too far out of scope here. In the end I removed the on device graphs for the sensor data to keep the memory in check and undid some of the sdkconfig changes I made.
One ask I had was to use binding clusters in place of the automation to trigger the lights on and off. I looked into it further and noticed that Google and Apple do not surface these clusters so decided to limit the project here to just triggering via automation for now.
Challenges- Espressif's Matter SDK on the newer side, documentation regarding its use is limited outside of examples
- Limited home test environments available for my use
- Beta nature of the apps and SDK
- Memory constraints on the device / already doing a lot
The major challenge encountered with this project was the Espressif's Matter SDK is very new and there just aren't a lot of examples out there of folks using it for their projects. I did manage to find a lot of great resources via their github and the folks who post issues and threads there. Many times I was able to reference these to see how they solved some of the same problems I was experiencing.
In addition to that I struggled with the fact I do not own most of the home controller environments on the market. I have a Home Assistant Yellow which I used with the Matter Beta there but I don't have any of the major players like Apple, Google, or Amazon's ones. I had initially assumed things would work fairly the same if I used consistent devices they supported but quickly learned that wasn't the case. Google, for example, requires that you sign up for a developer account and setup the test PID and VID prior to being able to use it to sign up.
For development and field trial purposes, a project and integration with the corresponding VID and PID combination must be created in the Developer Console. The user commissioning the device must either be a member of the project or be included in the list of field trial users.
https://developers.home.google.com/matter/get-started
I was able to find a demo app for android from google but oddly when I connect devices to it it only notices the first device. I assume it's just a limitation of the demo application itself though as when I tried with Google home and an approved developer account it did notice all of my associated devices I just couldn't associate it as I didn't have the environment / controller.
The beta nature of the applications and SDK has bitten me a few times with this project. For example that demo application above. In addition applications like Home Assistant are still new with Matter so things like door locks don't work entirely (I found an issue with someone else also experiencing this on their github). I imagine these smaller issues will be worked through as the SDK further matures and environments update so it's really just how new it is at all. The Home Assistant one in particular is really a featured environment and has been a pleasure to work with. The issues I've experienced have been mostly minor like it not properly deleting an old instance of the device when I've wiped and removed it while testing, etc.
While it was a fun project the memory considerations during that initial setup period do make Matter a bit harder to add to existing memory heavy projects. In retrospect I think having it only load the provisioning aspects initially and restarting to make sure it frees up the associated memory after it no longer needs the bluetooth enabled may be a good call and something I'd consider for future projects.
SummaryIn short I think the project was a success. I got to experiment with lvgl, Matter, and was able to work with my SenseCAP Indicator something I had hoped to do for some time but hadn't put the resources into doing. I've already begun planning for future projects like when my SenseCAP T1000 comes I plan on making a little Google Map showing its location on the device.
A reflection: I enjoyed the idea of call to projects and hope other companies do outreach in similar ways in the future as well. It's fun to have a set of ideas like this to work from and give members of the community a chance to execute on it.
Comments
Please log in or sign up to comment.