Arduino PWM Led Control using arduino

Arduino PWM Led Control (1)

Looking for a simple circuit to control the light intensity of Light Emitting Diodes (LEDs) or similar lighting sources? Here is an Arduino based circuit with three independent pulse width modulated (PWM) channels to fulfil your requirements! Just follow the schematic diagram to complete the construction, and use any standard 9VDC Arduino power source to energize the system. Here, for demonstration, three different color LEDs (Red, Green and Blue) are used. You can control the brightness of these LEDs using variable resistors VR1, VR2 and VR3 respectively.

Arduino PWM Led Control (1)

Parts Needed

  • Arduino UNO board – 1
  • 5mm LEDs Red, Green, Blue – each 1
  • 100K Variable resistor – 3
  • 1K ¼ w Resistor – 3

Arduino Sketch

  1. //MULTI-LINE LED CONTROLLER using PWM
  2. //T.K.Hareendran
  3. //www.electroschematics.com
  4. // Analog inputs connected to the variable resistors
  5. const int knobPin1 = 1; //Red LED control
  6. const int knobPin2 = 2; //Green LED control
  7. const int knobPin3 = 3; //Blue LED control
  8. // PWM outputs connected to LED driver circuits
  9. const int drivePin1 = 9;//Red LED drive
  10. const int drivePin2 = 10;//Green LED drive
  11. const int drivePin3 = 11;//Blue LED drive
  12. // initial value for the variable resistors
  13. int knobValue1 = 0;
  14. int knobValue2 = 0;
  15. int knobValue3 = 0;
  16. void setup() {
  17. // set the drive pins as output:
  18. pinMode(drivePin1, OUTPUT);
  19. pinMode(drivePin2, OUTPUT);
  20. pinMode(drivePin3, OUTPUT);
  21. }
  22. void loop() {
  23. // read the variable resistors, convert it to 0 – 255
  24. knobValue1 = analogRead(knobPin1) / 4;
  25. knobValue2 = analogRead(knobPin2) / 4;
  26. knobValue3 = analogRead(knobPin3) / 4;
  27. // use the data to control the drive:
  28. analogWrite(9, knobValue1);
  29. analogWrite(10, knobValue2);
  30. analogWrite(11, knobValue3);
  31. }

Arduino PWM Led Control1 (1)

Read more: Arduino PWM Led Control

Leave a Comment

Your email address will not be published. Required fields are marked *