Try to implement LED Blinky on Matter Template Example code.

I want to modify the example code which is provided by Matter SDK and there are several examples are there are Light bulb example code, Light Switch example code and Template code as well. Now I just right now simply wants to understand the code and modify it.


But it very complex to understand the code so can you please provide or explain the basic flow of Template like how it works. 

And also, I want to modify that code want to do some practical's like blink an LED but i did not know exactly where in that code I have to Change.

Please your help will be appreciated. 

  • Yes Marte that work is done.

    Now I can add new clusters as you said Matter Temperature Sensor I selected and Generate their files as well. 

    When I open callback-stub.cpp file I can See the clusters of Temperature Sensor.

    But Now I have an doubt that How can I add My PIR Sensor with the Temperature Cluster which I created.

    Also Can You me some reference about once I created the cluster of Temperature Sensor and after that at which place in code I have to modify for Implement PIR Sensor on Matter SDK.

  • Hi,

    You should test the sensor standalone before integrating it with Matter, to ensure that the sensor is working correctly and that you are able to get data from it. 
    I recommend starting with DHT: Aosong DHT Digital-output Humidity and Temperature Sensor. This is using DHT22 by default, but if you do not have the dht22 property in the overlay file, then it will use DHT11 instead.

    You will have to create an overlay file for your board (nrf52840dk_nrf52840.overlay) similar to the nrf52dk_nrf52832.overlay that is already in the sample, just with DHT11. Your overlay file should look similar to this:

    / {
    	dht11 {
    		compatible = "aosong,dht";
    		status = "okay";
    		dio-gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
    	};
    };

    Best regards,
    Marte

  • Yes Marte, We done above implementation of DHT Sensor.

    We got the temperature and humidity as an Output of DHT11 Sensors that we have for it.

    Now I want to ask that how Can I Integrate it with Matter?

  • Hi,

    I recommend taking a look at the Thingy53 Matter weather station application. This is using the temperature and humidity sensor on the Thingy53 to update the temperature and humidity measurements, so it should be similar to what you are doing.

    Most of the relevant code can be found in app_task.cpp.

    The function UpdateClustersState(), calls sensor_sample_fetch() to fetch new data from the sensor. This is the same as is used in the DHT sample. If fetching sensor data was successful, it calls UpdateTemperatureClusterState() to update the MeasuredValue attribute of the Temperature Measurement cluster. UpdateClustersState() is called regularly using a timer, similar to the SensorTimer in the Adding clusters to Matter application.

    If you have followed the guide and implemented everything there, what you need to do to get the actual measurements is to change SensorMeasureHandler() to be more like the Matter weather station application as explained above. If you only want to have it as a temperature sensor and only update the Temperature Measurement cluster, you can ignore UpdateClustersState() and only add code similar to UpdateTemperatureClusterState() in your SensorMeasureHandler().

    Additionally, you must make sure to add the necessary configurations in prj.conf and nrf52840dk_nrf52840.overlay. For nrf52840dk_nrf52840.overlay you need to add dht11 as in my previous reply. In prj.conf you need to add the following:

    CONFIG_SENSOR=y
    CONFIG_GPIO=y

    Best regards,
    Marte

  • Hey  ,

    First of all Thank you for above kind and brief reply,

    Today I will follow the points and try to implement it as you mention me in above reply and then I will tell you the outcome of  it.

    At the same time I am also facing one more issue regarding Chip-Tool is that, Right now I am accessing Matter Light Bulb device using Chip-Tool which is I am Operating using My Android Mobile but now Problem is that if other user also wants to access that Matter device via there Android phone at that time they did not able to Pair it and it shows them Pairing Failed Message.

    Can You please help me on that topic as well. 

Related