https://github.com/pythonicforge/pwm_led_servo_control
A PWM-powered Arduino project that smoothly controls LED brightness and servo motor position using a potentiometer
https://github.com/pythonicforge/pwm_led_servo_control
arduino embedded-systems led-controller potentiometer pwm servo-motor
Last synced: 9 months ago
JSON representation
A PWM-powered Arduino project that smoothly controls LED brightness and servo motor position using a potentiometer
- Host: GitHub
- URL: https://github.com/pythonicforge/pwm_led_servo_control
- Owner: pythonicforge
- License: mit
- Created: 2025-03-10T07:25:58.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2025-03-10T07:41:12.000Z (9 months ago)
- Last Synced: 2025-03-28T11:18:48.403Z (9 months ago)
- Topics: arduino, embedded-systems, led-controller, potentiometer, pwm, servo-motor
- Language: C++
- Homepage:
- Size: 505 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# _**PWM-Controlled LED & Servo Using Potentiometer 🎛️✨**_
### **Project Overview**
This Arduino project demonstrates **Pulse Width Modulation (PWM)** by controlling the brightness of an **LED** and the position of a **servo motor** using a **potentiometer**. As you turn the potentiometer knob, the LED smoothly dims or brightens, while the servo motor rotates accordingly.
### **How It Works**
- The **potentiometer** reads an **analog input** (0–1023) from **pin A0**.
- The **analog value** is mapped to two ranges:
- **0–255** for LED brightness (PWM output to pin **10**).
- **0–180°** for servo motor rotation (signal to pin **9**).
- The **analogWrite()** function adjusts LED brightness.
- The **servo.write()** function moves the servo.
### **Circuit Connections**
- **Potentiometer:**
- Left pin → **GND**
- Middle pin → **A0** (Analog Input)
- Right pin → **5V**
- **LED:**
- Anode (+) → **Pin 10** (via **resistor**)
- Cathode (–) → **GND**
- **Servo Motor:**
- VCC (Red) → **5V**
- GND (Black/Brown) → **GND**
- Signal (Yellow/Orange) → **Pin 9**
### **Demo (Tinkercad Simulation)**
[🔗 View the Project Simulation](https://www.tinkercad.com/things/b9VSYczKi9e-potentiometer-controlled-servo-and-led?sharecode=OkY8jpuE1gOwOtlxa4Cks5bIVmKN4RTRY4rDctx_wZQ)
### **Future Improvements**
- Add an **OLED display** to show live PWM and servo angle values.
- Use a **button** to toggle between different PWM modes.
### **License**
This project is open-source and available under the [**MIT License**](LICENSE).