{"id":23714372,"url":"https://github.com/calinradoni/robott1","last_synced_at":"2025-09-01T20:42:42.914Z","repository":{"id":182075730,"uuid":"503093824","full_name":"CalinRadoni/RobotT1","owner":"CalinRadoni","description":"A Telegram Bot hosted on a ESP32 board with esp32-camera and some sensors","archived":false,"fork":false,"pushed_at":"2022-10-08T20:52:25.000Z","size":61,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-12-30T20:19:14.311Z","etag":null,"topics":["esp32-cam","telegram-bot"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CalinRadoni.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE-GPLv3.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-06-13T19:46:56.000Z","updated_at":"2022-10-20T10:39:38.000Z","dependencies_parsed_at":"2023-07-18T16:52:36.338Z","dependency_job_id":null,"html_url":"https://github.com/CalinRadoni/RobotT1","commit_stats":null,"previous_names":["calinradoni/robott1"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CalinRadoni%2FRobotT1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CalinRadoni%2FRobotT1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CalinRadoni%2FRobotT1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CalinRadoni%2FRobotT1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CalinRadoni","download_url":"https://codeload.github.com/CalinRadoni/RobotT1/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239800482,"owners_count":19699127,"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":["esp32-cam","telegram-bot"],"created_at":"2024-12-30T20:19:15.494Z","updated_at":"2025-02-20T08:15:57.094Z","avatar_url":"https://github.com/CalinRadoni.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Robot T1\n\n## Introduction\n\n## Partitions\n\nThe current partition scheme allows for (using a 4MB ESP32):\n\n- two 1600 KB application partitions with OTA upgrade support\n- 832 KB for a file system\n- a `nvs_keys` partitions if/when [NVS Encryption](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-reference/storage/nvs_flash.html#nvs-encryption) will be implemented\n\n## Camera images and power save\n\nTo save power, I am powering off the camera between pictures.\n\nAfter power on the camera sensor needs time to compute `AWB`, `AGC`, `AEC` and other parameters for the current image.\n\nFirst images after power on are green and dark then quality of images improves.\n\nThe time to compute those parameters depends of the current lighting conditions, image resolution and other parameters so using a fixed amount of time to wait is not a good practice.\n\nTo improve the image quality I have implemented the following algorithm:\n\n1. power on the camera;\n2. acquire an image and read `ACG` and `AEC`;\n3. repeat the previous step until the `AGC` and `AEC` values are unchanged for a few consecutive readings. As a *safety* measure, the number\nof repeats is limited;\n4. power off the camera.\n\nWith this algorithm the first *good* image is a little purple but the next ones are OK. This behavior may be related to sensor's temperature ?\n\n**Note:** the implementation works for **ov2640** sensor because I have added the functions to read the `AEC` and `AGC` manually in `ESPCamera.cpp`. The read functions should have been added to the `esp32-camera` library.\n## I2C\n\nThe first I2C controller is mapped to the GPIO15 as SCL and GPIO14 as SDA.\n\nThe camera uses the second I2C controller.\n\n## OTA Update\n\nThe firmware can be updated from a HTTP or a HTTPS server.\n\n### Security note\n\n**Warning:** In the current version the content of `credentials.h` is added unencrypted in firmware.\nIf you publish the firmware.bin file in a public location the credentials can be viewed easily by anyone who downloads the file.\n\n### OTA Update from a HTTP server, for development\n\nFor development I use the `http.server` python module to start a simple HTTP server like this:\n\n```sh\n# display your IP address\nip address show up\n\n# allow acces to the HTTP server's port in firewall\nfirewall-cmd --zone=public --add-port=8000/tcp\n\n# for python 3.7+\npython3 -m http.server --directory ./firmware/\n# for older versions of python 3 use `cd firmware \u0026\u0026 python3 -m http.server`\n```\n\nthen send the update command to the bot:\n\n```txt\n/update http://yourIPaddress:8000/firmware.bin\n```\n\n### OTA Update from GitHub\n\nSend the update command to the bot with the full URL. As example, to load the [RobotT1](https://github.com/CalinRadoni/RobotT1)'s published firmware use:\n\n```txt\n/update https://raw.githubusercontent.com/CalinRadoni/RobotT1/main/firmware/firmware.bin\n```\n\n### OTA Update from a generic HTTPS server\n\nExtract server's certificate in a **C** compatible output format. Here is one way to do it:\n\n```sh\nserver=\"raw.githubusercontent.com\"\necho | openssl s_client -showcerts -connect \"$server\":443 2\u003e/dev/null | \\\n    sed -n '/-----BEGIN CERTIFICATE-----/,/-----END CERTIFICATE-----/H; /-----BEGIN CERTIFICATE-----/h; ${g;p};' | \\\n    sed 's/^/\"/; $!s/$/\\\\n\" \\\\/; $s/$/\"/'\n```\n\nSee the [Extract certificates from a HTTPS server](https://calinradoni.github.io/pages/220618-extract-server-certificates.html) post for details regarding the previous code.\n\nAfter you extracted the certificate it should be added to `UpdateFromWeb.cpp` and an entry for selecting it should be added to\nthe `UpdateFromWeb::SetCertificateForHost` function.\n\n## Log level\n\nIn `platformio.ini` set `CORE_DEBUG_LEVEL` to a value according to `ARDUHAL_LOG_LEVEL` definitions from [esp32-hal-log.h](https://github.com/espressif/arduino-esp32/blob/master/cores/esp32/esp32-hal-log.h):\n\n```c\n#define ARDUHAL_LOG_LEVEL_NONE       (0)\n#define ARDUHAL_LOG_LEVEL_ERROR      (1)\n#define ARDUHAL_LOG_LEVEL_WARN       (2)\n#define ARDUHAL_LOG_LEVEL_INFO       (3)\n#define ARDUHAL_LOG_LEVEL_DEBUG      (4)\n#define ARDUHAL_LOG_LEVEL_VERBOSE    (5)\n```\n\n**Note**: if you want colors define `CONFIG_ARDUHAL_LOG_COLORS` as **1** in `platformio.ini`.\n\n## License\n\nThis repository is licensed under the terms of [GNU GPLv3](http://www.gnu.org/licenses/gpl-3.0.html) license. See the `LICENSE-GPLv3.txt` file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalinradoni%2Frobott1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcalinradoni%2Frobott1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcalinradoni%2Frobott1/lists"}