Skip to content

Sensor-Driven-Automation/ESP32-WebSocket-RC-Car

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚗 ESP32 WiFi RC Car Controller

Dashboard

License: MIT Arduino WebSockets

A comprehensive solution for wirelessly controlling an RC car through WiFi using an ESP32 microcontroller. Control your RC car in real-time from any device with a web browser!

✨ Features

  • Web-based Control Interface: Modern, responsive UI accessible from any device
  • Real-time Control: Low-latency WebSocket communication for immediate responsiveness
  • Multiple Control Methods:
    • On-screen touch controls
    • Keyboard input (WASD/Arrow keys)
    • Floating control panel for mobile devices
  • Status Indicators: Real-time connection status and feedback
  • No App Required: Works in any modern web browser

🛠️ Hardware Requirements

  • ESP32 Development Board
  • L298N Motor Driver Module
  • 4x DC Motors
  • RC Car Chassis
  • 7.4V-12V Battery Pack
  • Jumper Wires

📋 Pin Connections

ESP32 L298N Motor Driver
GPIO13 ENA (Enable Motor A)
GPIO15 IN1 (Input 1 Motor A)
GPIO14 IN2 (Input 2 Motor A)
GPIO27 ENB (Enable Motor B)
GPIO26 IN3 (Input 3 Motor B)
GPIO25 IN4 (Input 4 Motor B)

📊 System Architecture

The system consists of two main server endpoints:

  1. HTTP Server (Port 80): Serves the web control interface
  2. WebSocket Server (Port 81): Handles real-time bidirectional communication

🚀 Getting Started

Prerequisites

Installation Steps

  1. Clone this repository

    https://github.com/Sensor-Driven-Automation/ESP32_WebSocket_RC_Car.git
    
  2. Open the project in Arduino IDE

    • Open wifi_car_controller.ino in Arduino IDE
  3. Configure WiFi settings

    • Update the SSID and password in the code:
    const char *ssid = "YOUR_WIFI_SSID";
    const char *password = "YOUR_WIFI_PASSWORD";
  4. Upload to ESP32

    • Select your ESP32 board from Tools > Board
    • Select the correct port from Tools > Port
    • Click the Upload button
  5. Find ESP32's IP Address

    • Open Serial Monitor (9600 baud)
    • Look for the IP address in the startup messages
  6. Connect and Control

    • Open a web browser on any device connected to the same WiFi network
    • Navigate to the ESP32's IP address
    • Use the web interface to control the RC car

🎮 Control Commands

Command Description Button Keyboard
0 Stop ⏹️ Space
1 Forward ⬆️ W / Up Arrow
2 Backward ⬇️ S / Down Arrow
4 Left Turn ⬅️ A / Left Arrow
8 Right Turn ➡️ D / Right Arrow

🧩 Project Structure

  • wifi_car_controller.ino: Main code file with ESP32 implementation
  • WebSocketServer.h: Custom WebSocket server implementation
  • index.h: Web interface HTML content
  • /docs: Additional documentation
  • /schematics: Circuit diagrams

🌟 Web Interface

The web interface provides:

  • Real-time connection status
  • Multiple control methods (touch, keyboard)
  • Visually pleasing design with particle effects
  • Mobile-friendly responsive layout
  • Floating control panel for easier mobile control

🛠️ Customization

Adjusting Motor Speed

You can implement PWM control for variable speed:

// In setup()
ledcSetup(0, 5000, 8);  // Channel 0, 5kHz, 8-bit resolution
ledcSetup(1, 5000, 8);  // Channel 1, 5kHz, 8-bit resolution
ledcAttachPin(ENA, 0);  // Attach ENA to channel 0
ledcAttachPin(ENB, 1);  // Attach ENB to channel 1

// Instead of digitalWrite(ENA, HIGH):
ledcWrite(0, speed);  // speed: 0-255

Adding Features

  • Battery level monitoring
  • Headlights control
  • Speed adjustment
  • Custom movement patterns

📱 Browser Compatibility

Tested and working on:

  • Chrome (Desktop & Mobile)
  • Firefox (Desktop & Mobile)
  • Safari (Desktop & Mobile)
  • Edge

👥 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🙏 Acknowledgments

📞 Contact

For questions or support, please open an issue on GitHub.


Made with ❤️ by Ayush Verma and Ayush Mishra

About

A comprehensive solution for controlling an RC car wirelessly through WiFi using an ESP32 microcontroller. The system provides a responsive web-based interface accessible through any browser, allowing real-time control of the car's movements with minimal latency.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages