This project demonstrates the use of a Potentiometer to control two LEDs.
Also Visit
Objective:
To control two LEDs with a potentiometer. (One Fade-IN and the other Fade-OUT)
Project Overview
The "Lumina-Cross Sync" project is a fundamental study in Analog-to-Digital Transformation. It demonstrates how a single manual input (the rotation of a potentiometer) can be used to control two independent output streams in a Complementary Relationship. As one LED increases in luminosity (fades in), the other decreases at an identical rate (fades out). This is a foundational concept in audio mixing, lighting transitions, and motor balancing algorithms.
Technical Deep-Dive
- The Potentiometer as a Voltage Divider:
- The Physics of Resistance: A 10k potentiometer acts as a variable voltage divider. As the wiper moves along the resistive element, it provides a varying voltage between 0V and 5V to the Arduino's Analog-to-Digital Converter (ADC).
- 10-bit Resolution: The Arduino's ADC translates this 0-5V signal into a digital value ranging from 0 to 1023. This provides 1024 unique steps of resolution for the input position.
- Complementary PWM Logic:
- The Map Function: Since Arduino's PWM (Pulse Width Modulation) output operates on an 8-bit scale (0 to 255), the firmware utilizes the
map()function to scale the 10-bit input value. - Inverse Calculation: To achieve the cross-fade, the software calculates two distinct PWM values:
Value_A = map(potVal, 0, 1023, 0, 255)Value_B = 255 - Value_A
- This mathematical inverse ensures that at the physical "Center Point" of the potentiometer, both LEDs are at exactly 50% duty cycle.
- The Map Function: Since Arduino's PWM (Pulse Width Modulation) output operates on an 8-bit scale (0 to 255), the firmware utilizes the
Engineering & Implementation
- Current Limiting & Signal Integrity:
- The 220-Ohm Standard: To prevent thermal runaway in the LEDs and avoid exceeding the Arduino GPIO's 40mA limit, 220-ohm resistors are used. These are calculated based on a typical 2.0V forward voltage ($V_f$) and a desired 15mA current ($I$).
- PWM Frequency Dynamics:
- The Arduino UNO generates PWM at approximately 490Hz (Pins 3, 9, 10, 11) or 980Hz (Pins 5, 6). Because this frequency is significantly higher than the human eye's Flicker Fusion Threshold (~60Hz), the varying duty cycle is perceived as a smooth change in brightness rather than a rapid blink.
- Calibration & Constraints:
- Zero-Drift Mitigation: Potentiometers can occasionally exhibit "Jitter" at the extreme ends of their rotation due to electrical noise. Professional implementations use the
constrain()function to ensure the values never exceed the 0-255 range, protecting the PWM registers from overflow errors.
- Zero-Drift Mitigation: Potentiometers can occasionally exhibit "Jitter" at the extreme ends of their rotation due to electrical noise. Professional implementations use the
Conclusion
By mastering the relationship between analog sensing and digital output, this project provides the essential building blocks for more complex HMI (Human Machine Interface) designs found in professional synthesizer mixers and industrial control panels.
The Art of Balance: Mastering the inverse relationship of light through silicon logic.