{"id":24803899,"url":"https://github.com/nopnop2002/esp-idf-uart2udp","last_synced_at":"2026-05-16T18:38:06.769Z","repository":{"id":274719204,"uuid":"923846723","full_name":"nopnop2002/esp-idf-uart2udp","owner":"nopnop2002","description":"UART to UDP bridge for ESP-IDF","archived":false,"fork":false,"pushed_at":"2025-06-13T23:27:27.000Z","size":64,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-14T00:25:58.420Z","etag":null,"topics":["esp-idf","esp32","gateway","rsyslog-client","uart","udp"],"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":"2025-01-28T23:25:43.000Z","updated_at":"2025-06-13T23:27:30.000Z","dependencies_parsed_at":null,"dependency_job_id":"c9dca676-ddd7-45b3-acf8-e586b6d515c7","html_url":"https://github.com/nopnop2002/esp-idf-uart2udp","commit_stats":null,"previous_names":["nopnop2002/esp-idf-uart2udp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/nopnop2002/esp-idf-uart2udp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-uart2udp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-uart2udp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-uart2udp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-uart2udp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nopnop2002","download_url":"https://codeload.github.com/nopnop2002/esp-idf-uart2udp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nopnop2002%2Fesp-idf-uart2udp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266405405,"owners_count":23923536,"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","status":"online","status_checked_at":"2025-07-21T11:47:31.412Z","response_time":64,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["esp-idf","esp32","gateway","rsyslog-client","uart","udp"],"created_at":"2025-01-30T06:13:46.751Z","updated_at":"2026-05-16T18:38:01.736Z","avatar_url":"https://github.com/nopnop2002.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# esp-idf-uart2udp\nUART to UDP bridge for ESP-IDF.   \n\n![Image](https://github.com/user-attachments/assets/a81ce56e-623d-4b42-88eb-07e5c5cb055a)\n\n# Software requirements\nESP-IDF V5.0 or later.   \nESP-IDF V4.4 release branch reached EOL in July 2024.   \n\n\n# Installation\n\n```\ngit clone https://github.com/nopnop2002/esp-idf-uart2udp\ncd esp-idf-uart2udp/\nidf.py menuconfig\nidf.py flash\n```\n\n# Configuration\n![Image](https://github.com/user-attachments/assets/c72c8e65-54ba-4222-a8fa-0bbfd769b6f4)\n![Image](https://github.com/user-attachments/assets/6e4fdd49-a535-4304-a2e9-a347c3f70e1f)\n\n## WiFi Setting\nSet the information of your access point.   \n![Image](https://github.com/user-attachments/assets/6f00ec25-023f-4d48-b864-69a3261bdd0b)\n\n## UART Setting\nSet the information of UART Connection.   \n![Image](https://github.com/user-attachments/assets/2903cf03-06d3-449f-a032-21d33652ff4d)\n\n## UDP Setting\nSet the information of UDP Connection.   \n![Image](https://github.com/user-attachments/assets/10be168a-0604-4177-b0c8-4a7967beaccd)\n\nThere are the following four methods for specifying the UDP Address.\n- Limited broadcast address   \n The address represented by 255.255.255.255, or \\\u003cbroadcast\\\u003e, cannot cross the router.   \n Both the sender and receiver must specify a Limited broadcast address.   \n\n- Directed broadcast address   \n It is possible to cross the router with an address that represents only the last octet as 255, such as 192.168.10.255.   \n Both the sender and receiver must specify the Directed broadcast address.   \n __Note that it is possible to pass through the router.__   \n\n- Multicast address   \n Data is sent to all PCs belonging to a specific group using a special address (224.0.0.0 to 239.255.255.255) called a multicast address.   \n I've never used it, so I don't know anything more.\n\n- Unicast address   \n It is possible to cross the router with an address that specifies all octets, such as 192.168.10.41.   \n Both the sender and receiver must specify the Unicast address.\n\n\n# Write this sketch on Arduino Uno.   \nYou can use any AtMega microcontroller.   \n\n```\nunsigned long lastMillis = 0;\n\nvoid setup() {\n  Serial.begin(115200);\n}\n\nvoid loop() {\n  while (Serial.available()) {\n    String command = Serial.readStringUntil('\\n');\n    Serial.println(command);\n  }\n\n  if(lastMillis + 1000 \u003c= millis()){\n    Serial.print(\"Hello World \");\n    Serial.println(millis());\n    lastMillis += 1000;\n  }\n\n  delay(1);\n}\n```\n\nStrings from Arduino to ESP32 are terminated with CR(0x0d)+LF(0x0a).   \n```\nI (1189799) UART-RX: 0x3ffc8458   48 65 6c 6c 6f 20 57 6f  72 6c 64 20 31 30 30 31  |Hello World 1001|\nI (1189799) UART-RX: 0x3ffc8468   0d 0a\n```\n\nThe Arduino sketch inputs data with LF as the terminator.   \nSo strings from the ESP32 to the Arduino must be terminated with LF (0x0a).   \nIf the string output from the ESP32 to the Arduino is not terminated with LF (0x0a), the Arduino sketch will complete the input with a timeout.   \nThe default input timeout for Arduino sketches is 1000 milliseconds.   \nIf the string received from UDP does not have a LF at the end, this project will add a LF to the end and send it to Arduino.   \nThe Arduino sketch will echo back the string it reads.   \n```\nI (1285439) UART-TX: 0x3ffc72f8   61 62 63 64 65 66 67 0a                           |abcdefg.|\nI (1285459) UART-RX: 0x3ffc8458   61 62 63 64 65 66 67 0d  0a                       |abcdefg..|\n```\n\n\n# Wireing   \nConnect ESP32 and AtMega328 using wire cable   \n\n|AtMega328||ESP32|ESP32S2/S3|ESP32C2/C3/C6||\n|:-:|:-:|:-:|:-:|:-:|:-:|\n|TX|--|GPIO16|GPIO2|GPIO1|(*1)|\n|RX|--|GPIO17|GPIO1|GPIO0||\n|GND|--|GND|GND|GND||\n\n(*1) 5V to 3.3V level shifting is required.   \n\n__You can change it to any pin using menuconfig.__   \n\n\n# Windows Application   \nI used [this](https://sourceforge.net/projects/sockettest/) app.   \nThis application runs both a UDP-Listener (UDP-Server) and a UDP-Client simultaneously.   \n\n- Listen from ESP32   \n\tSpecify the port number and press the Start Listening button.   \n\tThis application works as a UDP-Listener (UDP-Server) and communicates with the UDP-Client of ESP32.   \n\t![Image](https://github.com/user-attachments/assets/30bb42e3-6828-4926-bbe5-7f068ef4a052)   \n\t![Image](https://github.com/user-attachments/assets/c0ef903a-d0a8-4b68-b653-349fc01ac183)   \n\n- Send to ESP32   \n\tSpecify the IP Address of ESP32 and port number and press the Send button.   \n\tThis application works as a UDP-Client and communicates with the UDP-Server of ESP32.   \n\t![Image](https://github.com/user-attachments/assets/f1d0002b-4f97-4ef4-8bf9-77eec030551e)   \n\tInstead of an IP address, you can use an mDNS hostname.   \n\t![Image](https://github.com/user-attachments/assets/5aafff5a-3bab-481d-b65f-98e3dc6fd25e)   \n\n\nWe can use [this](https://www.hw-group.com/software/hercules-setup-utility) app.   \nThis application runs both a UDP-Listener (UDP-Server) and a UDP-Client simultaneously.   \n![Image](https://github.com/user-attachments/assets/62eb14da-fae5-4aa1-90e7-8d4cb81d500b)   \n\n\n# Python script   \nudp-client.py is UDP-Client.   \nudp-server.py is UDP-Listener (UDP-Server).   \n\n\n# Linux Application\nI searched for a GUI tool that can be used with ubuntu or debian, but I couldn't find one.   \n\n\n# Android Application\nI used [this](https://play.google.com/store/apps/details?id=com.jca.udpsendreceive) app.   \n![Image](https://github.com/user-attachments/assets/17d60387-0a17-49a5-af3d-7e13879495b3)\n\n\n# Using linux rsyslogd as logger   \nWe can forward the UART input to rsyslogd on your Linux machine.\n```\n+-------------+          +-------------+         +-------------+ \n| Arduino Uno |--(UART)-\u003e|    ESP32    |--(UDP)-\u003e|  rsyslogd   |\n+-------------+          +-------------+         +-------------+ \n```\n\nConfigure with port number = 514.   \n![Image](https://github.com/user-attachments/assets/bf4cadb5-40d8-49ea-a1b9-dee23fa70c63)\n\nThe rsyslog server on linux can receive logs from outside.   \nExecute the following command on the Linux machine that will receive the logging data.   \nPlease note that port 22 will be closed when you enable ufw.   \nI used Ubuntu 22.04.   \n\n```\n$ cd /etc/rsyslog.d/\n\n$ sudo vi 99-remote.conf\nmodule(load=\"imudp\")\ninput(type=\"imudp\" port=\"514\")\n\nif $fromhost-ip != '127.0.0.1' and $fromhost-ip != 'localhost' then {\n    action(type=\"omfile\" file=\"/var/log/remote\")\n    stop\n}\n\n$ sudo ufw enable\nFirewall is active and enabled on system startup\n\n$ sudo ufw allow 514/udp\nRule added\nRule added (v6)\n\n$ sudo ufw allow 22/tcp\nRule added\nRule added (v6)\n\n$ sudo systemctl restart rsyslog\n\n$ ss -nulp | grep 514\nUNCONN 0      0            0.0.0.0:514        0.0.0.0:*\nUNCONN 0      0               [::]:514           [::]:*\n\n$ sudo ufw status\nStatus: active\n\nTo                         Action      From\n--                         ------      ----\n514/udp                    ALLOW       Anywhere\n22/tcp                     ALLOW       Anywhere\n514/udp (v6)               ALLOW       Anywhere (v6)\n22/tcp (v6)                ALLOW       Anywhere (v6)\n```\n\nUART input goes to /var/log/remote.   \n```\n$ tail -f /var/log/remote\nJun  6 11:05:04 Hello World 6721000\nJun  6 11:05:05 Hello World 6722000\nJun  6 11:05:06 Hello World 6723000\nJun  6 11:05:07 Hello World 6724000\nJun  6 11:05:08 Hello World 6725000\nJun  6 11:05:09 Hello World 6726000\nJun  6 11:05:10 Hello World 6727000\nJun  6 11:05:11 Hello World 6728000\nJun  6 11:05:12 Hello World 6729000\nJun  6 11:05:13 Hello World 6730000\nJun  6 11:05:14 Hello World 6731000\nJun  6 11:05:15 Hello World 6732000\n```\n\nOne advantage of using rsyslogd is that you can take advantage of log file rotation.   \nRotating log files prevents the log files from growing forever.   \nThe easiest way to rotate logs is to add /var/log/remote to /etc/logrotate.d/rsyslog.   \nThere are many resources available on the Internet about rotating log files.   \n```\n$ ls -l /var/log/remote*\n-rw-r--r-- 1 syslog syslog    6264 Jun  6 10:35 /var/log/remote\n-rw-r--r-- 1 syslog syslog 1219823 Jun  6 10:33 /var/log/remote.1\n```\n\n\n# References\n\nhttps://github.com/nopnop2002/esp-idf-uart2web\n\nhttps://github.com/nopnop2002/esp-idf-uart2bt\n\nhttps://github.com/nopnop2002/esp-idf-uart2mqtt\n\nhttps://github.com/nopnop2002/esp-idf-vcp2udp\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnopnop2002%2Fesp-idf-uart2udp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnopnop2002%2Fesp-idf-uart2udp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnopnop2002%2Fesp-idf-uart2udp/lists"}