https://github.com/saeed-dev2/esp32_pwm_led_control
"Control an LED using PWM with the ESP32 and ESP-IDF. The LED alternates between 75% on and 25% off every 5 seconds. This project demonstrates PWM configuration and usage with the LEDC driver in ESP-IDF"
https://github.com/saeed-dev2/esp32_pwm_led_control
Last synced: about 2 months ago
JSON representation
"Control an LED using PWM with the ESP32 and ESP-IDF. The LED alternates between 75% on and 25% off every 5 seconds. This project demonstrates PWM configuration and usage with the LEDC driver in ESP-IDF"
- Host: GitHub
- URL: https://github.com/saeed-dev2/esp32_pwm_led_control
- Owner: Saeed-dev2
- Created: 2024-08-11T11:51:31.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-08-22T17:47:46.000Z (over 1 year ago)
- Last Synced: 2025-04-30T16:50:00.976Z (10 months ago)
- Language: C
- Size: 15.6 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ESP32 PWM LED Control
## Project Overview
This project showcases how to control an LED using Pulse Width Modulation (PWM) with the ESP32 microcontroller and ESP-IDF framework. The LED is programmed to be on for 75% of the time and off for 25% of the time, repeating this cycle every 5 seconds.
## Features
- Configures PWM for precise LED control.
- Duty cycle set to 75% on and 25% off.
- Complete on-off cycle duration of 5 second.
## Components
- **ESP32 Development Board**
- **LED**
- **Current-Limiting Resistor** (220Ω to 1kΩ)
## Prerequisites
1. **ESP-IDF:** Ensure you have ESP-IDF v4.4.4 or later installed. Follow the [ESP-IDF Getting Started Guide](https://docs.espressif.com/projects/esp-idf/en/latest/esp32/get-started/) for installation instructions.
## Hardware Connections
### **Connecting the LED to ESP32**
1. **ESP32 GPIO to LED:**
- **LED Anode (Longer Leg)**: Connect to GPIO 18 on the ESP32.
- **LED Cathode (Shorter Leg)**: Connect to one end of the current-limiting resistor.
2. **Current-Limiting Resistor to Ground:**
- Connect the other end of the current-limiting resistor to the GND pin on the ESP32.
**Note:**
- **GPIO 18**: Used for PWM output.
- **Current-Limiting Resistor**: Protects the LED by limiting current.
- **GND**: Common ground to complete the circuit.
Ensure to use a current-limiting resistor between 220Ω and 1kΩ to prevent damage to the LED and ensure correct operation.
## Installation and Setup
1. **Clone the Repository:**
```sh
git clone https://github.com/Saeed-dev2/ESP32_PWM_LED_Control.git
```
2. **Install Dependencies:**
Install the required libraries and components:
```
idf.py install
```
3. **Configure the Project:**
Configure project settings with:
```
idf.py menuconfig
```
4. **Build the Project:**
Compile the project using:
```
idf.py build
```
5. **Flash the Firmware:**
Upload the firmware to your ESP32 board:
```
idf.py flash
```
6. **Monitor Serial Output:**
Observe the serial output:
```
idf.py monitor
```
Exit the monitor by pressing `Ctrl+]`.
## Author:
`M.Saeed`