Matter protocol support

Posted on
  • Hi Espruino hackers,

    An effort has started to add support for Espruino in node-matter:­scussions/67.
    You are welcome to join the effort if you are interested in having your Espruino devices part of your Matter ecosystem!

    More context:

    1. Matter is a new IoT protocol which is supposed to unify smart devices and will launch at the end of this year. It is supported by all the big ones and hopefully will make all IoT devices intercompatible!
    2. node-matter is a re-implementation of the Matter protocol in Typescript (which compiles to javascript). While it is currently built on top on node.js APIs, the dependency is minimal and it should be able to run on Espruino APIs (and even on web APIs...).

    Hardware requirements:

    1. The non-minified js library is about 650k, so it will fit on an Espruino device with 1M flash. Probably minifying it will bring it down to under 200k.
    2. Matter requires strong crypto for communication. Probably an Espruino with AES support will be required.

    Let me know if you have any questions about Matter!


    • Marco

    Disclaimer: I am the author of node-matter

  • Hi! What kind of communications are used for these devices? Is it over Wifi, or something else?

    I've got to say though - 650k may not seem big to you, but for a microcontroller it's huge. Even on devices with 1MB flash, Espruino takes up some of that space so it's unlikely to fit unminified, and even if it fits there's no guarantee it won't use up a bunch of RAM when it runs. It could be quite an uphill struggle.

  • Matter protocol is mostly agnostic of the communication type.
    Thread is the recommended wireless protocol, but it works as well with WiFi / BLE or a combo (BLE for initial discovery and WiFi for operation).

    node-matter library only supports UDP communication right since this is what is natively supported by node. BLE support is in progress.
    I see that Espruino supports UDP / BLE / WiFi (and hopefully soon Thread) so those will be supported at some point.

    Most of the SoC listed as supporting Matter are 1 MB Flash, 256 KB RAM.
    I don't think my library will have a smaller rom / ram footprint that the official version, so I would expect similar requirements. Maybe it is possible to support 512 KB Flash, 96 KB RAM.

    For a very simple Matter device, it should be possible to really dumb down the protocol using canned answers for all requests (instead of serializing an object) so support even lower specs. However the Crypto will still require a good chunk a code and cannot be dumbed down...

  • Thread is the recommended wireless protocol, but it works as well with WiFi / BLE or a combo (BLE for initial discovery and WiFi for operation).

    Isn't it based on IP protocol? There is curently no support for IP over BLE in Espruino so it is basically just about wifi devices. To me it looks like only the unofficial ESP32 port is matching your ram/flash requirements.

  • BLE / IP: Yes, it is based mostly based on IP except for the initial provisioning where point-to-point connection is done over BLE or WiFi direct.
    A bridge can be used to bring a BLE device on an IP network, but Thread protocol is supposed to solve this by allowing the device to directly join a Thread network.
    So maybe bringing Matter to Espruino will only make sense after Thread is supported? (note: Thread support should only be a firmware change, since it uses the same hardware as BLE / WiFi).

    RAM/Flash requirements: I think Bangle.js 2 has the correct specs
    Most of the other official boards have 64kB RAM, 512kB Flash, so maybe this should be set as the target.

  • Most of the other official boards have 64kB RAM, 512kB Flash, so maybe this should be set as the target.

    Then you are looking at <40kB RAM and 40-100kB Flash free on those.

    Thread support should only be a firmware change

    Adding Thread running concurrently with BLE is even more overhead than adding just 6LoWPAN over BLE (and both should provide more or less the same thing?). And in both cases you also need some ipv6 stack (like lwIP) on top of that to send/receive UDP, all this takes some additional RAM and Flash. And of course a lot of developer time to get this working. I think you may be underestimating complexity of all this 'firmware thing' a bit :-)

    Espruino on ESP32 + wifi looks much easier for starting this now. Or for official boards start here

  • Nordic SDK provides all of this in C and it can be compiled with espruino on their NRF52840 Dongle. Its got 1MB of flash and 256kb of ram which should be plenty for both the C libraries in combination with espruino. Nordic already has some matter examples so this is more about going from C to javascript on the matter app layer.

  • Yes with 52840 it looks doable, it just needs someone to do it :-)

    Espruino for 52840 currently uses nRF5 SDK15.3 so I guess the nRF5 SDK for Thread and Zigbee v3.2.0 could be the easiest start as it is based on 15.3 too.

    there is even guide how to add it to existing BLE application here­sdk_tz_v3.2.0/thread_multiprotocol_ble_h­owto.html?cp=8_7_2_2_10_3_1_6

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview

Matter protocol support

Posted by Avatar for mfucci @mfucci