Arduino Uno-Based Simple Light Dimmer


Introduction

This project focuses on creating a basic light dimmer using Arduino Uno. The dimmer will allow you to adjust the brightness of an LED using PWM (Pulse Width Modulation). This project introduces the concept of controlling light intensity with Arduino.

Arduino Uno’s ability to generate PWM signals makes it suitable for this task. We will use an LED and a potentiometer to control the brightness of the LED. This project is a great introduction to PWM and analog control with Arduino.

Let’s go through the materials required and the steps to create your simple light dimmer.

Materials

  • Arduino Uno board
  • LED
  • Potentiometer (10k ohm)
  • 220 ohm Resistor
  • Jumper Wires
  • Breadboard
  • USB Cable
  • Computer with Arduino IDE

Instructions

  1. Connect the LED to the Arduino:
    • Long leg (anode) of LED to digital pin 9, and short leg (cathode) to GND through a 220 ohm resistor.
  2. Connect the potentiometer to the Arduino:
    • One leg of potentiometer to 5V on Arduino
    • The other leg of potentiometer to GND on Arduino
    • Middle leg of potentiometer to analog pin A0 on Arduino
  3. Open the Arduino IDE on your computer.
  4. Write the following code in the Arduino IDE and upload it to your Arduino board.

const int ledPin = 9;
const int potPin = A0;
void setup() {
pinMode(ledPin, OUTPUT);
}
void loop() {
int potValue = analogRead(potPin);
int ledBrightness = map(potValue, 0, 1023, 0, 255);
analogWrite(ledPin, ledBrightness);
delay(10);
}

Explanation

This project demonstrates how to use Arduino to control the brightness of an LED using PWM. The potentiometer is used to adjust the brightness by varying the PWM duty cycle. The analogRead function reads the potentiometer value, and the map function scales this value to match the PWM range of the LED.

By varying the position of the potentiometer, you can change the brightness of the LED smoothly. This project introduces basic PWM concepts and how to use analog input with Arduino.

Conclusion

Creating a light dimmer with Arduino Uno is an engaging way to learn about PWM and analog control. This project shows how to control the intensity of an LED and introduces fundamental concepts of light control with Arduino.

Feel free to experiment with different types of LEDs and control methods. Arduino’s flexibility allows for various applications, and this project is just one example of its potential.

Thank you for following this tutorial. We hope you enjoyed building your light dimmer and found it informative. Stay tuned for more Arduino projects and tutorials!

Leave a Comment

Your home address. Best home security cameras : comprehensive guide to choosing the right one.