HW-269 LED Brightness Control Using Potentiometer
by devkrishnavhora in Circuits > Arduino
29 Views, 0 Favorites, 0 Comments
HW-269 LED Brightness Control Using Potentiometer
The objective of this project is to control the brightness of the HW-269 3W LED module using a potentiometer and an Arduino Nano.
Supplies
Components Required
- Deshbot shield
- Arduino Nano
- potentiometer
- HW-269 3W LED module
Pin Connections
HW-269
HW-269 PinArduino Nano
+ - 5V
S - D11
G - GND
Potentiometer
Potentiometer PinArduino Nano
Left pin - 5V
Middle pin - A0
Right pin
GNDPin Connections
HW-269
HW-269 PinArduino Nano
+ - 5V
S - D11
G - GND
Potentiometer
Potentiometer PinArduino Nano
Left pin - 5V
Middle pin - A0
Right pin - GND
Working
The potentiometer provides an analog voltage to A0. The Arduino Nano reads this value between 0 and 1023.
The map() function converts this value from 0–1023 into a PWM brightness value of 0–255.
When the potentiometer is turned toward one side, the LED becomes dimmer. When it is turned toward the other side, the LED becomes brighter.
Arduino Code
Main Functions Used
- analogRead() — reads the potentiometer value.
- map() — converts the potentiometer value to a PWM range.
- analogWrite() — controls the LED brightness using PWM.
- D11 is used because it supports PWM on the Arduino Nano.
Result
The HW-269 3W LED brightness can be smoothly controlled using the potentiometer, from dim/off to maximum brightness.