Skip to content

JoyNgaru/ESP32-LED-Brightness-OTA-Control

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

# ESP32 LED Brightness Control with OTA Firmware Updates

This project implements an LED brightness control system on an ESP32 microcontroller using Pulse Width Modulation (PWM) and integrates Over-the-Air (OTA) firmware updates. The LED brightness can be adjusted through a web interface, with real-time updates via WebSocket communication.

## Features

- **PWM-based LED Brightness Control**: Adjust the brightness of the LED using PWM on the ESP32.
- **Web Interface with Slider**: Control LED brightness through a user-friendly webpage with a slider.
- **Real-Time WebSocket Communication**: Send and receive brightness updates instantly between the web interface and ESP32.
- **Over-the-Air (OTA) Updates**: Update the firmware remotely without needing a physical connection to the device.

## Components Used

- **ESP32** microcontroller
- **LED** for brightness control (connected to a PWM-capable pin)

## Getting Started

### Prerequisites

- **Arduino IDE**: Ensure that you have installed the [Arduino IDE](https://www.arduino.cc/en/software).
- **ESP32 Board Manager**: Install the ESP32 board in the Arduino IDE. You can find instructions [here](https://randomnerdtutorials.com/installing-the-esp32-board-in-arduino-ide-windows-instructions/).
- **Libraries**:
  - `WiFi.h`
  - `ESPAsyncWebServer.h`
  - `ArduinoOTA.h`
  - `AsyncTCP.h`
  - `ESPAsyncWebSocket.h`

### Installation

1. Clone this repository:
   ```bash
   git clone https://github.com/your-username/ESP32-LED-Brightness-OTA-Control.git
  1. Open the project in the Arduino IDE.
  2. Install any missing libraries using the Arduino Library Manager or add them manually.

Usage

  1. Connect to WiFi: Replace YOUR_SSID and YOUR_PASSWORD in the code with your WiFi credentials.
  2. Upload the Code:
    • Connect your ESP32 to your computer and upload the code from the Arduino IDE.
    • Open Serial Monitor to verify WiFi connection and see the IP address assigned to the ESP32.
  3. Access the Web Interface:
    • Open a web browser and enter the ESP32’s IP address to access the LED control interface.
    • Use the slider to adjust the brightness. Changes will be reflected in real-time through WebSocket.
  4. OTA Updates:
    • After the first upload, subsequent updates can be done OTA via the Arduino IDE by selecting Tools > Port > esp32 with the correct IP address.

Code Explanation

  • PWM Control: PWM is set up on the LED pin, allowing brightness control based on the slider's input value.
  • Web Server and WebSocket:
    • A basic web server serves the HTML interface with a slider.
    • WebSocket communication enables real-time brightness adjustments between the ESP32 and the client.
  • OTA Setup: Initializes OTA functionality, allowing firmware updates over WiFi without a physical connection.

Project Structure

ESP32-LED-Brightness-OTA-Control/
├── ESP32-LED-Brightness-OTA-Control.ino  # Main code file
└── README.md                             # Project documentation

Resources

  1. ESP32 OTA with Arduino IDE - Random Nerd Tutorials
  2. ESP32 OTA Programming - Circuit Digest

Contributing

Feel free to fork this project and submit a pull request. Please ensure that any contributions are well-documented and tested.

License

This project is open-source and available under the MIT License.


Acknowledgments


About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages