{"id":18604766,"url":"https://github.com/avsystem/anjay-esp32-client","last_synced_at":"2025-04-10T20:30:48.591Z","repository":{"id":42388337,"uuid":"413366049","full_name":"AVSystem/Anjay-esp32-client","owner":"AVSystem","description":"Anjay ESP-32 LwM2M client","archived":false,"fork":false,"pushed_at":"2025-02-28T14:39:56.000Z","size":129,"stargazers_count":10,"open_issues_count":3,"forks_count":6,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-03-25T03:41:31.729Z","etag":null,"topics":["anjay","c","device-management","embedded","esp","esp-idf","esp32","iot","lwm2m"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AVSystem.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-10-04T09:59:43.000Z","updated_at":"2025-02-28T14:40:01.000Z","dependencies_parsed_at":"2024-05-28T14:12:33.393Z","dependency_job_id":"7a7deaf9-78a7-4fb8-beb6-30efced8addf","html_url":"https://github.com/AVSystem/Anjay-esp32-client","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AVSystem%2FAnjay-esp32-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AVSystem%2FAnjay-esp32-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AVSystem%2FAnjay-esp32-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AVSystem%2FAnjay-esp32-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AVSystem","download_url":"https://codeload.github.com/AVSystem/Anjay-esp32-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248290019,"owners_count":21078923,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["anjay","c","device-management","embedded","esp","esp-idf","esp32","iot","lwm2m"],"created_at":"2024-11-07T02:18:56.121Z","updated_at":"2025-04-10T20:30:48.570Z","avatar_url":"https://github.com/AVSystem.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Anjay ESP32 Client\n## Overview\nThis repository contains a LwM2M Client application example for ESP32 devices, based on open-source [Anjay-esp-idf](https://github.com/AVSystem/Anjay-esp-idf) component and [Espressif IoT Development Framework](https://github.com/espressif/esp-idf).\n\nThe following boards are supported natively in the project:\n- ESP-WROVER-KIT\n- ESP32-DevKitC\n- M5StickC-Plus\n\nYou may also use other boards, by selecting the `Unknown` board and manually configuring available peripherals through Kconfig.\n\nThe following LwM2M Objects are supported:\n| Target         | Objects\n|----------------|---------------------------------------------\n| Common         | Security (/0)\u003cbr\u003eServer (/1)\u003cbr\u003eDevice (/3)\u003cbr\u003eFirmware Update (/5)\u003cbr\u003eWLAN connectivity (/12)\n| ESP-WROVER-KIT | Push button (/3347)\u003cbr\u003eLight control (/3311)\n| ESP32-DevKitC  | Push button (/3347)\n| M5StickC-Plus  | Push button (/3347)\u003cbr\u003eLight control (/3311)\u003cbr\u003eTemperature sensor (/3303)\u003cbr\u003eAccelerometer (/3313)\u003cbr\u003eGyroscope (/3343)\n\n## Compiling and launching\n1. Install ESP-IDF and its dependencies on your computer. Please follow the instructions at https://docs.espressif.com/projects/esp-idf/en/v5.3.1/esp32/get-started/index.html including `Manual Installation` up to the `Start a Project` subtitle.\n   * The project has been tested with ESP-IDF v5.3.1, but may work with other v5.x.x versions as well. Older versions are not supported.\n1. Clone the repository `git clone https://github.com/AVSystem/Anjay-esp32-client.git` and navigate to project directory\n1. Initialize and update submodules with `git submodule update --init --recursive`\n1. Run `idf.py set-target esp32` in the project directory\n1. Run `idf.py menuconfig`\n   * navigate to `Component config/anjay-esp32-client`:\n     * select one of supported boards or manually configure the board in `Board options` menu\n     * configure LwM2M client configuration in `Client options` menu\n     * configure Wi-Fi in `Connection configuration` menu\n   * navigate to `Component config/Anjay library configuration` to configure `Anjay`\n     library and its dependencies (`avs_commons` and `avs_coap`)\n1. Run `idf.py build` to compile\n1. Run `idf.py flash` to flash\n   * NOTE: M5StickC-Plus does not support default baudrate, run `idf.py -b 750000 flash` to flash it\n1. The logs will be on the same `/dev/ttyUSB\u003cn\u003e` port that the above used for flashing, 115200 8N1\n   * You can use `idf.py monitor` to see logs on serial output from a connected device, or even more conveniently `idf.py flash monitor` as one command to see logs right after the device is flashed\n\n## Connecting to the LwM2M Server\nTo connect to [Coiote IoT Device Management](https://www.avsystem.com/products/coiote-iot-device-management-platform/) LwM2M Server, please register at [https://eu.iot.avsystem.cloud/](https://eu.iot.avsystem.cloud/). The default Server URI (Kconfig option `ANJAY_CLIENT_SERVER_URI`) is set to EU Cloud Coiote DM instance, but you must manually set other client configuration options.\n\nNOTE: You may use any LwM2M Server compliant with LwM2M 1.0 TS. The server URI\ncan be changed in the example configuration options.\n\n## Connecting using NVS provided credentials\nIt is possible to use pre-built binaries to flash the board and provide credentials by flashing a NVS partition binary.\nTo do that, `esptool.py` is required, which can be installed running `pip install esptool`\n\n### Creating a merged binary for M5StickC-Plus\n```\nesptool.py --chip esp32  merge_bin --flash_mode dio --flash_size 4MB --flash_freq 40m 0x1000 build/bootloader/bootloader.bin 0x8000 build/partition_table/partition-table.bin 0x10000 build/anjay-esp32-client.bin 0x310000 build/storage.bin --output m5stickc-plus.bin\n```\n### NVS config file\nTo generate NVS partition, create a `nvs_config.csv` file with following content:\n```\nkey,type,encoding,value\nconfig,namespace,,\nwifi_ssid,data,string,[wifi_ssid]\nwifi_pswd,data,string,[wifi_password]\nwifi_inter_en,data,u8,1\nendpoint_name,data,string,[endpoint_name]\nidentity,data,string,[identity]\npsk,data,string,[psk]\nuri,data,string,[lwm2m_server_uri]\nwritable_wifi,namespace,,\nwifi_ssid,data,string,[wifi_ssid]\nwifi_pswd,data,string,[wifi_password]\nwifi_inter_en,data,u8,0\n```\nAnd fill proper values for `[wifi_ssid]`, `[wifi_password]`, `[endpoint_name]`, `[identity]`, `[psk]`, `[lwm2m_server_uri]`.\nAfter that create config partition by running:\n```\npython3 $IDF_PATH/components/nvs_flash/nvs_partition_generator/nvs_partition_gen.py generate nvs_config.csv nvs_config.bin 0x4000\n```\n### Flashing the firmware and partitions\nAfter partition is created, flash firmware and configuration using following commands (baudrate may vary depending on your board):\n```\nesptool.py -b 750000 --chip esp32 write_flash 0x0000 m5stickc-plus.bin\nesptool.py -b 750000 --chip esp32 write_flash 0x9000 nvs_config.bin\n```\nDevice will be reset and run with provided configuration.\n### TCP socket\nTo switch to TCP socket instead of UDP run `idf.py menuconfig`, navigate to `Component config/anjay-esp32-client/Client options/Choose socket` and select TCP (remember that you must also provide a proper URI in the `nvs_config.csv` file, e.g. `coaps+tcp://eu.iot.avsystem.cloud:5684`).\n### ESP32 with certificates\n1. Prepare your certificates. All certificates should have a `.der` extension and should be added to the directory where this `README.md` file is located. The names of the certificates should be as follows:\n   * client public certificate - `client_cert.der`\n   * client private certificate - `client_key.der`\n   * server public certificate - `server_cert.der`\n1. Run `idf.py menuconfig`, navigate to `Component config/anjay-esp32-client/Client options/Choose security mode` and select `Certificates`.\n### FOTA\nAfter compilation, you can perform FOTA with Coiote DM. Required binary file location:\n```\n$PROJECT_DIR/build/anjay-esp32-client/build/anjay-esp32-client.bin\n```\n### ESP32 with BG96 and FreeRTOS cellular library\n1. Prepare your BG96 module, connect it to the selected ESP32 UART interface.\n1. Run `idf.py menuconfig`\n   * navigate to `Component config/anjay-esp32-client`:\n      * select `External BG96 module` in `Choose an interface` menu\n   * navigate to `Component config/Anjay library configuration/Enable support for external BG96 module`:\n      * configure BG96 in `BG96 module configuration` menu\n      * configure PDN authentication type in `PDN authentication type` menu\n      * configure the `APN name` (and `PDN username/password` if needed)\n\n## Links\n* [Anjay source repository](https://github.com/AVSystem/Anjay)\n* [Anjay documentation](https://avsystem.github.io/Anjay-doc/index.html)\n* [Doxygen-generated API documentation](https://avsystem.github.io/Anjay-doc/api/index.html)\n* [AVSystem IoT Devzone](https://iotdevzone.avsystem.com/)\n* [AVSystem Discord server](https://discord.avsystem.com)\n* [FreeRTOS cellular library](https://www.freertos.org/cellular/index.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favsystem%2Fanjay-esp32-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favsystem%2Fanjay-esp32-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favsystem%2Fanjay-esp32-client/lists"}