{"id":21009694,"url":"https://github.com/lily-osp/esp-robot-control","last_synced_at":"2026-04-11T04:31:57.557Z","repository":{"id":262653936,"uuid":"887930410","full_name":"lily-osp/esp-robot-control","owner":"lily-osp","description":"This project allows you to control a robotic system using an ESP8266 or ESP32 via a web-based interface. It supports motor control, obstacle avoidance, and a robotic arm with preprogrammed movements.","archived":false,"fork":false,"pushed_at":"2024-11-29T08:57:05.000Z","size":440,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-01-20T11:11:51.684Z","etag":null,"topics":["arduino","esp32","esp8266","robotics","webcontrol"],"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/lily-osp.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}},"created_at":"2024-11-13T14:26:21.000Z","updated_at":"2024-11-29T08:57:09.000Z","dependencies_parsed_at":"2024-11-19T09:17:36.111Z","dependency_job_id":"984d529b-442e-4d79-ae92-7cd5f3b69230","html_url":"https://github.com/lily-osp/esp-robot-control","commit_stats":null,"previous_names":["lily-osp/esp8266-robot-control","lily-osp/esp-robot-control"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lily-osp%2Fesp-robot-control","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lily-osp%2Fesp-robot-control/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lily-osp%2Fesp-robot-control/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lily-osp%2Fesp-robot-control/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lily-osp","download_url":"https://codeload.github.com/lily-osp/esp-robot-control/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243431436,"owners_count":20289891,"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":["arduino","esp32","esp8266","robotics","webcontrol"],"created_at":"2024-11-19T09:17:36.794Z","updated_at":"2025-10-07T03:33:42.308Z","avatar_url":"https://github.com/lily-osp.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Robot Control with Web Interface\n\nThis project enables control of a robot with obstacle avoidance and a robot arm through a web interface using an ESP8266/esp32. The controller connects to Wi-Fi and accepts HTTP commands to manage the motor, robot arm, and sensors.\n\n## Features\n\n### Main\n- **Wi-Fi Control**: Control the robot over a Wi-Fi network using a web interface.\n- **Obstacle Avoidance**: Uses ultrasonic sensor data to automatically avoid obstacles.\n- **Robot Arm Control**: Manage various robotic arm movements, including a gripper, base rotation, and joint movements.\n- **Configurable Speed**: Set motor speed through the web interface.\n- **Position Management**: Save and execute robot arm positions, along with predefined actions like scanning, picking, and waving.\n- **Motor Control**: Forward, backward, turn, and stop commands.\n- **mDNS Support**: Access the device using a hostname (e.g., `http://serbot.local`).\n\n### Parts\n\n#### Body Control\n- **Directional Movement**\n  - Forward/Backward movement\n  - Left/Right turns\n  - Rotate left/right\n  - Emergency stop\n- **Speed Control**\n  - Adjustable speed via slider (0-255)\n- **Obstacle Avoidance**\n  - Enable/Disable obstacle avoidance\n  - Autonomous navigation mode\n\n#### Arm Control\n- **Joint Control**\n  - Base rotation (left/right)\n  - Shoulder movement (up/down)\n  - Elbow movement (up/down)\n  - Gripper control (open/close)\n- **Pre-defined Movements**\n  - Home position\n  - Scan position\n  - Pick object\n  - Drop object\n  - Wave gesture\n- **Position Memory**\n  - Save up to 3 custom positions\n  - Load saved positions\n- **Command Recording**\n  - Record movement sequences\n  - Play recorded sequences\n  - Clear recordings\n\n## Hardware Requirements\n\n- **ESP8266 (NodeMCU or similar)** or **ESP32**\n- **Motor Driver (L298N recommended)**\n- **Ultrasonic Sensor (HC-SR04)**\n- **Servos (for robot arm joints and gripper)**\n- **Power Supply (suitable for motors and servos)**\n\n## Pin Configuration\n\nThe table below lists the GPIO configurations for ESP8266 and ESP32. The board selector in the code (`bool isESP32`) should be set to `true` for ESP32 and `false` for ESP8266.\n\n\n### Motor Controller Pins\n\n| Component             | ESP8266 GPIO | ESP8266 Alias | ESP32 GPIO | ESP32 Alias | Description                           |\n|-----------------------|--------------|---------------|------------|-------------|---------------------------------------|\n| Motor 1 IN1           | GPIO5        | D1            | GPIO25     | IO25        | Motor 1 Direction Control Pin 1       |\n| Motor 1 IN2           | GPIO4        | D2            | GPIO26     | IO26        | Motor 1 Direction Control Pin 2       |\n| Motor 2 IN1           | GPIO0        | D3            | GPIO27     | IO27        | Motor 2 Direction Control Pin 1       |\n| Motor 2 IN2           | GPIO2        | D4            | GPIO14     | IO14        | Motor 2 Direction Control Pin 2       |\n| Motor 1 Enable (ENA)  | GPIO14       | D5            | GPIO12     | IO12        | PWM pin for Motor 1 speed control     |\n| Motor 2 Enable (ENB)  | GPIO12       | D6            | GPIO13     | IO13        | PWM pin for Motor 2 speed control     |\n\n\n### Ultrasonic Sensor Pins\n\n| Component             | ESP8266 GPIO | ESP8266 Alias | ESP32 GPIO | ESP32 Alias | Description                           |\n|-----------------------|--------------|---------------|------------|-------------|---------------------------------------|\n| Trigger Pin           | GPIO13       | D7            | GPIO32     | IO32        | Trigger for distance measurement      |\n| Echo Pin              | GPIO15       | D8            | GPIO33     | IO33        | Echo to receive distance              |\n\n\n### Robot Arm Pins\n\n| Component             | ESP8266 GPIO | ESP8266 Alias | ESP32 GPIO | ESP32 Alias | Description                           |\n|-----------------------|--------------|---------------|------------|-------------|---------------------------------------|\n| Base Servo            | GPIO16       | D0            | GPIO17     | IO17        | Base rotation control                 |\n| Shoulder Servo        | GPIO3 (RX)   | RX            | GPIO18     | IO18        | Shoulder joint control                |\n| Elbow Servo           | GPIO1 (TX)   | TX            | GPIO19     | IO19        | Elbow joint control                   |\n| Gripper Servo         | GPIO9        | SD2 / S2      | GPIO21     | IO21        | Gripper open/close control            |\n\n\n### Notes:\n\n- **Aliases for ESP8266**: NodeMCU board pins (e.g., D1, D2) map to ESP8266 GPIO pins.\n- **Aliases for ESP32**: Use `IO` followed by the GPIO number as a naming convention.\n- **Special Pins**: GPIO9 (SD2 on ESP8266) and GPIO10 (SD3) are typically used for flash operations on ESP8266. Use these cautiously.\n- **PWM on ESP32**: ESP32 supports multiple PWM channels, improving servo control and motor speed adjustment.\n- **UART Pins**: Be aware of RX/TX pins (`GPIO3` and `GPIO1`) if used for debugging or communication.\n\nEnsure proper power supply and grounding to avoid performance issues or damage to the components.\n\n**Additional Notes for ESP32**:\n- The ESP32 supports more PWM channels and higher resolution, allowing smoother servo movements.\n- Ensure pins for `Trigger` and `Echo` are free from internal pull-ups or pull-downs to avoid conflicts with the ultrasonic sensor.\n\n**Wi-Fi and mDNS**:\n- The project includes mDNS support for both ESP8266 and ESP32, allowing access to the web interface using the hostname `http://serbot.local`.\n\n## Code Modifications for Board Selection\n\n- In the source code, ensure the following line is updated based on the board in use:\n\n  ```cpp\n  bool isESP32 = true;  // Set to true for ESP32, false for ESP8266\n  ```\n\nThis boolean configures the correct pin definitions and initializes the appropriate libraries for the selected board.\n\n## Quick Start\n\n1. Connect the hardware as per the pin configuration table.\n2. Flash the code to the selected board.\n3. Access the web interface via `http://serbot.local` once the device connects to Wi-Fi.\n\n## Troubleshooting\n\n- **Connection Issues**: Ensure Wi-Fi credentials are correctly configured, and the board is within range.\n- **Servo Jitters**: Use a stable power supply for motors and servos, especially with ESP32 where higher currents may be drawn.\n\n#### GPIO images\n\n![GPIO Table](pinout.png)\n\n## Software Requirements\n\n- **Arduino IDE** with ESP8266 and ESP32 support.\n- **Libraries**:\n  - `WiFi.h`: For Wi-Fi connectivity (ESP32).\n  - `ESP8266WiFi.h`: For Wi-Fi connectivity (ESP8266).\n  - `WebServer.h` (ESP32) or `ESP8266WebServer.h` (ESP8266): For creating the HTTP server.\n  - `ESPmDNS.h` or `ESP8266mDNS.h`: For mDNS service.\n\n## Hardware Requirements\n\n- **Microcontroller**: ESP8266 or ESP32.\n- **Motors and Driver**: L298N or similar motor driver.\n- **Ultrasonic Sensor**: HC-SR04 or similar.\n- **Servos**: For robotic arm control.\n- **Power Supply**: Compatible with the microcontroller and motors/servos.\n\n## Setup Instructions\n\n### 1. Clone Repository\n```bash\ngit clone https://github.com/lily-osp/esp-robot-control.git\ncd esp-robot-control\n```\n\n### 2. Select Your Board\nSet the `isESP32` boolean in the code to match your board:\n- `true` for ESP32\n- `false` for ESP8266\n  \n  ```cpp\n  const bool isESP32 = true; // Set to false if using ESP8266\n  ```\n\n### 3. Install Libraries\nEnsure the required libraries are installed in the Arduino IDE:\n1. Open Arduino IDE.\n2. Install **ESP8266** or **ESP32** boards via the Board Manager.\n3. Install additional libraries via the Library Manager.\n\n### 4. Configure Wi-Fi\nUpdate the `ssid` and `password` in the code with your Wi-Fi credentials:\n```cpp\nconst char* ssid = \"YOUR_WIFI_SSID\";\nconst char* password = \"YOUR_WIFI_PASSWORD\";\n```\n\n### 5. Upload the Code\n1. Connect your ESP8266/ESP32 to your computer via USB.\n2. Select the appropriate board and port in the Arduino IDE.\n3. Upload the code.\n\n### 6. Connect the Hardware\nWire the components to your microcontroller as per the pin definitions in the code.\n\n### 7. Access the Web Interface\n1. Open the Serial Monitor to find the assigned IP address.\n2. Open a web browser and enter the IP to access the control interface.\n\n## Web Interface and Commands\n\nThe web interface provides buttons and controls for the following actions:\n\n- **Movement Commands**: `mv` (move forward), `bk` (move backward), `lt` (turn left), `rt` (turn right), `rl` (rotate left), `rr` (rotate right), `st` (stop).\n- **Speed Control**: `spd [value]` - Set the motor speed, where `[value]` is a number between 0-255.\n- **Obstacle Avoidance**:\n  - `oa on`: Enable obstacle avoidance mode.\n  - `oa off`: Disable obstacle avoidance.\n  - `oa nav`: Start navigation using obstacle detection.\n- **Robot Arm Commands**:\n  - `b [dir]`: Move base. `dir` can be `f` (forward), `b` (back), `l` (left), or `r` (right).\n  - `s [dir]`: Move shoulder. `dir` can be `u` (up), `d` (down).\n  - `e [dir]`: Move elbow. `dir` can be `u` (up), `d` (down).\n  - `g [dir]`: Move gripper. `dir` can be `o` (open), `c` (close).\n- **Position and Recording**:\n  - `stream`: Start recording arm movements.\n  - `m pos [number]`: Save current position as a specific number.\n  - `m save [number]`: Move to a saved position.\n  - `m [action]`: Perform predefined actions, e.g., `home`, `scan`, `pick`, `drop`, `wave`, etc.\n\n### UI preview\n\n\u003cdiv align=\"center\"\u003e\n  \u003cdiv style=\"display: flex; justify-content: center; gap: 20px; margin-bottom: 20px;\"\u003e\n    \u003cimg src=\"01.png\" alt=\"Body Control Interface\" width=\"400\" title=\"Body Control Tab\"/\u003e\n    \u003cimg src=\"02.png\" alt=\"Arm Control Interface\" width=\"400\" title=\"Arm Control Tab\"/\u003e\n  \u003c/div\u003e\n  \u003cp\u003e\u003cem\u003eLeft: Body Control Interface - Right: Arm Control Interface\u003c/em\u003e\u003c/p\u003e\n\u003c/div\u003e\n\n### Control Commands\n\nHere’s the completed table with example usage for each command:\n\n| **Category**          | **Command**  | **Description**                      | **Example Usage**                                   |\n|-----------------------|--------------|---------------------------------------|----------------------------------------------------|\n| **Body Movement**      | `mv`         | Move forward                          | `http://\u003cesp_ip\u003e/command?cmd=mv`                   |\n|                       | `bk`         | Move backward                         | `http://\u003cesp_ip\u003e/command?cmd=bk`                   |\n|                       | `lt`         | Turn left                             | `http://\u003cesp_ip\u003e/command?cmd=lt`                   |\n|                       | `rt`         | Turn right                            | `http://\u003cesp_ip\u003e/command?cmd=rt`                   |\n|                       | `rl`         | Rotate left                           | `http://\u003cesp_ip\u003e/command?cmd=rl`                   |\n|                       | `rr`         | Rotate right                          | `http://\u003cesp_ip\u003e/command?cmd=rr`                   |\n|                       | `st`         | Stop                                  | `http://\u003cesp_ip\u003e/command?cmd=st`                   |\n|                       | `spd X`      | Set speed (X: 0-255)                  | `http://\u003cesp_ip\u003e/command?cmd=spd%20150`            |\n| **Arm Movement**       | `b +/-`      | Base rotation                         | `http://\u003cesp_ip\u003e/command?cmd=b%20+` or `cmd=b%20-` |\n|                       | `s +/-`      | Shoulder movement                     | `http://\u003cesp_ip\u003e/command?cmd=s%20+` or `cmd=s%20-` |\n|                       | `e +/-`      | Elbow movement                        | `http://\u003cesp_ip\u003e/command?cmd=e%20+` or `cmd=e%20-` |\n|                       | `g o/c`      | Gripper open (`o`) / close (`c`)      | `http://\u003cesp_ip\u003e/command?cmd=g%20o` or `cmd=g%20c` |\n| **Pre-defined Movements** | `m h`    | Home position                         | `http://\u003cesp_ip\u003e/command?cmd=m%20h`                |\n|                       | `m s`        | Scan position                         | `http://\u003cesp_ip\u003e/command?cmd=m%20s`                |\n|                       | `m p`        | Pick object                           | `http://\u003cesp_ip\u003e/command?cmd=m%20p`                |\n|                       | `m d`        | Drop object                           | `http://\u003cesp_ip\u003e/command?cmd=m%20d`                |\n|                       | `m w`        | Wave                                  | `http://\u003cesp_ip\u003e/command?cmd=m%20w`                |\n| **Position Memory**    | `m pos X`    | Save position (X: 1-3)                | `http://\u003cesp_ip\u003e/command?cmd=m%20pos%201`          |\n|                       | `m save X`   | Load position (X: 1-3)                | `http://\u003cesp_ip\u003e/command?cmd=m%20save%201`         |\n| **Recording**          | `stream`     | Start recording                       | `http://\u003cesp_ip\u003e/command?cmd=stream`               |\n|                       | `done`       | Stop recording                        | `http://\u003cesp_ip\u003e/command?cmd=done`                 |\n|                       | `play`       | Play recording                        | `http://\u003cesp_ip\u003e/command?cmd=play`                 |\n|                       | `clear`      | Clear recording                       | `http://\u003cesp_ip\u003e/command?cmd=clear`                |\n| **Obstacle Avoidance** | `oa on`      | Enable OA                             | `http://\u003cesp_ip\u003e/command?cmd=oa%20on`              |\n|                       | `oa off`     | Disable OA                            | `http://\u003cesp_ip\u003e/command?cmd=oa%20off`             |\n|                       | `oa nav`     | Auto navigation using OA              | `http://\u003cesp_ip\u003e/command?cmd=oa%20nav`             |\n\n## User Interface\n\nThe interface features a modern, retro-styled design with:\n- Responsive layout\n- Tab-based navigation\n- Touch-friendly controls\n- Visual feedback\n- Dark theme\n- Intuitive icons\n- Status notifications\n\n## Troubleshooting\n\n- **Cannot Connect to Wi-Fi**: Double-check the SSID and password. Restart the ESP8266.\n- **Commands Not Working**: Ensure all components are wired correctly. Check for any loose connections or power supply issues.\n- **Servo or Motor Issues**: Verify that the power supply is adequate for servos and motors.\n\n### Common Issues\n1. **Can't connect to WiFi**\n   - Verify credentials\n   - Check WiFi signal strength\n   - Ensure ESP32 is powered properly\n\n2. **Commands not responding**\n   - Check serial monitor for errors\n   - Verify IP address\n   - Check network connectivity\n\n3. **UI not loading**\n   - Clear browser cache\n   - Check browser console for errors\n   - Verify all CDN resources are loading\n\n## Notes\n\n- **Power Considerations**: Ensure that the ESP8266 has a stable 3.3V power supply. Motors and servos may require separate power sources if they draw significant current.\n- **Pin Limitations**: The ESP8266 has limited PWM pins, so configure carefully based on your hardware setup.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flily-osp%2Fesp-robot-control","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flily-osp%2Fesp-robot-control","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flily-osp%2Fesp-robot-control/lists"}