{"id":16239217,"url":"https://github.com/nopnop2002/esp-idf-web-gpio","last_synced_at":"2025-06-21T16:34:22.008Z","repository":{"id":108987908,"uuid":"382592420","full_name":"nopnop2002/esp-idf-web-gpio","owner":"nopnop2002","description":"GPIO control using web browser","archived":false,"fork":false,"pushed_at":"2025-05-08T18:58:53.000Z","size":370,"stargazers_count":14,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-05-08T19:46:04.504Z","etag":null,"topics":["browser","esp-idf","esp32","gpio","gpio-pins","gpio-port","http","http-server","web-server"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nopnop2002.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"zenodo":null}},"created_at":"2021-07-03T10:56:39.000Z","updated_at":"2025-05-08T18:58:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"fe51eaac-cc95-4282-a045-686d71884098","html_url":"https://github.com/nopnop2002/esp-idf-web-gpio","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nopnop2002/esp-idf-web-gpio","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-web-gpio","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-web-gpio/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-web-gpio/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-web-gpio/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nopnop2002","download_url":"https://codeload.github.com/nopnop2002/esp-idf-web-gpio/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-web-gpio/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261158351,"owners_count":23117819,"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":["browser","esp-idf","esp32","gpio","gpio-pins","gpio-port","http","http-server","web-server"],"created_at":"2024-10-10T13:42:45.677Z","updated_at":"2025-06-21T16:34:16.976Z","avatar_url":"https://github.com/nopnop2002.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# esp-idf-web-gpio\nGPIO control using web browser.   \n\n![web-gpio-1](https://user-images.githubusercontent.com/6020549/124352292-84d99d00-dc3a-11eb-8f8a-45472e45eebe.jpg)\n\nYou can change gpio direction and gpio value using built-in web server.   \n\n![web-gpio-2](https://user-images.githubusercontent.com/6020549/124352331-a2a70200-dc3a-11eb-9161-4053ef0315f5.jpg)\n![web-gpio-3](https://user-images.githubusercontent.com/6020549/124352333-a3d82f00-dc3a-11eb-879f-2fb976e43646.jpg)\n\n# Software requirements\nESP-IDF V5.0 or later.   \nESP-IDF V4.4 release branch reached EOL in July 2024.   \nESP-IDF V5.1 is required when using ESP32-C6.\n\n# Installation\n\n```\ngit clone https://github.com/nopnop2002/esp-idf-web-gpio\ncd esp-idf-web-gpio/\nidf.py menuconfig\nidf.py flash\n```\n\n\n# Configuration   \nYou have to set this config value with menuconfig.   \n\n![config-main](https://user-images.githubusercontent.com/6020549/124352357-c1a59400-dc3a-11eb-9bde-6a3fc43ef755.jpg)\n![config-app](https://user-images.githubusercontent.com/6020549/124352358-c36f5780-dc3a-11eb-875b-88899585923f.jpg)\n\nYou can use static ip.   \n![config-static](https://user-images.githubusercontent.com/6020549/124352360-c5d1b180-dc3a-11eb-9cdb-82162f31cf14.jpg)\n\nYou can connect using mDNS host name.\n![config-mDNS](https://user-images.githubusercontent.com/6020549/124352362-c79b7500-dc3a-11eb-85be-199e1ea3bae6.jpg)\n\n![web-gpio-mdns](https://user-images.githubusercontent.com/6020549/134443304-64e76a3a-beec-4072-ab68-131d9bec01fd.jpg)\n\n\n# Definition GPIO   \nThe GPIO pin number to control is defined in csv/gpio.csv.   \nThe file gpio.csv has three columns.   \nIn the first column you need to specify the GPIO number.   \nOn the ESP32, GPIO up to 39.   \nOn the ESP32-S2, GPIO up to 46.   \nOn the ESP32-S3, GPIO up to 48.   \nOn the ESP32-C2, GPIO up to 18.   \nOn the ESP32-C3, GPIO up to 19.   \nThis project don't care about the maximum number of GPIO.   \nThis project don't care if the number is valid. You need to define it carefully.   \n   \nIn the second column you have to specify the GPIO Initial direction.   \nThe GPIO direction is either I(for INPUT) or O(for OUTPUT).   \nOn the ESP32, GPIOs 35-39 are input-only so cannot be used as outputs.   \nOn the ESP32-S2, GPIO 46 is input-only so cannot be used as outputs.   \nThis project don't care if GPIO is input-only. You need to define it carefully.   \n   \nIn the last column you have to specify the GPIO Initial value for OUTPUT.   \nINPUT pin don't care.   \n\n```\n12,O,0\n13,O,1\n14,I,0\n15,I,0\n```\n\nThe simplest circuit connects GPIO12 and GPIO14, and GPIO13 and GPIO15.   \nIf you change the value of GPIO12, the value of GPIO14 will change.   \nIf you change the value of GPIO13, the value of GPIO15 will change.   \n\n# Using RESTful API   \n|API|Method|Resource Example|Description|\n|:-:|:-:|:-:|:-:|\n|/api/gpio/info|GET||Client can get gpio information|\n|/api/gpio/mode|POST|{\"gpio\":12, \"mode\":\"INPUT\"}\u003cbr\u003e{\"gpio\":12, \"mode\":\"OUTPUT\"}|Client can set gpio direction|\n|/api/gpio/value|POST|{\"gpio\":12, \"value\":0}\u003cbr\u003e{\"gpio\":12, \"value\":1}|Client can set gpio value|\n\n# Using RESTful API with curl command   \n\n## /api/gpio/info   \n\n```\n$ curl 'http://esp32-server.local:8080/api/gpio/info' | python -m json.tool\n  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current\n                                 Dload  Upload   Total   Spent    Left  Speed\n100   254  100   254    0     0   1881      0 --:--:-- --:--:-- --:--:--  1881\n[\n    {\n        \"id\": 0,\n        \"gpio\": 12,\n        \"mode\": \"OUTPUT\",\n        \"value\": 0\n    },\n    {\n        \"id\": 1,\n        \"gpio\": 13,\n        \"mode\": \"OUTPUT\",\n        \"value\": 1\n    },\n    {\n        \"id\": 2,\n        \"gpio\": 14,\n        \"mode\": \"INPUT\",\n        \"value\": 0\n    },\n    {\n        \"id\": 3,\n        \"gpio\": 15,\n        \"mode\": \"INPUT\",\n        \"value\": 1\n    }\n]\n```\n\n## /api/gpio/mode   \n```\n$ curl -X POST -H \"Content-Type: application/json\" -d '{\"gpio\":12, \"mode\":\"INPUT\"}' http://esp32-server.local:8080/api/gpio/mode\nGPIO mode set successfully\n\n$ curl -X POST -H \"Content-Type: application/json\" -d '{\"gpio\":12, \"mode\":\"OUTPUT\"}' http://esp32-server.local:8080/api/gpio/mode\nGPIO mode set successfully\n\n```\n\n## /api/gpio/value   \n```\n$ curl -X POST -H \"Content-Type: application/json\" -d '{\"gpio\":12, \"value\":1}' http://esp32-server.local:8080/api/gpio/value\nGPIO value set successfully\n\n$ curl -X POST -H \"Content-Type: application/json\" -d '{\"gpio\":12, \"value\":0}' http://esp32-server.local:8080/api/gpio/value\nGPIO value set successfully\n```\n\n# How to browse image data using built-in http server   \nEven if there are files in SPIFFS, the esp-idf http server does not support this:   \n```\nhttpd_resp_sendstr_chunk(req, \"\u003cimg src=\\\"/spiffs/picture.jpg\\\"\u003e\");\n```\n\nYou need to convert the image file to base64 string.   \n```\nhttpd_resp_sendstr_chunk(req, \"\u003cimg src=\\\"data:image/jpeg;base64,\");\nhttpd_resp_sendstr_chunk(req, (char *)BASE64_ENCODE_STRING);\nhttpd_resp_sendstr_chunk(req, \"\\\"\u003e\");\n```\n\nImages in base64 format are stored in the icons folder.   \nI converted using the base64 command.   \n```\n$ base64 png/box-in-icon.png \u003e icons/box-in-icon.txt\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnopnop2002%2Fesp-idf-web-gpio","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnopnop2002%2Fesp-idf-web-gpio","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnopnop2002%2Fesp-idf-web-gpio/lists"}