Controlling Fan/LED Using Arduino Uno

In this article I will explain about controlling Fan/LED using Arduino Uno.

Introduction

In this article I will explain about controlling Fan/LED using Arduino Uno. It will give the control of Fan/LED by potentiometer.

Parts
  • Arduino Uno
  • Potentiometer
  • BreadBoard
  • HookUp Wires
  • LED
Connection

Step 1: Connection from Potentiometer to Arduino Uno.
  • Take the first pin of potentiometer connected to the Gnd of the Arduino Uno.
  • Take the second pin of Vin connected to the analog pin of A0 to Arduino Uno.
  • Take the Third pin of Vcc to the 5v of Arduino Uno.
Step 2: Connection from LED to Arduino Uno.
  • Positive pin = 09
  • Negative pin = Gnd
Programming
  1. const byte POTENTIOMETER = 0;    
  2. const byte CONTROL = 9;    
  3. int reading;    
  4. int value;    
  5. void setup()    
  6. {    
  7.    pinMode(CONTROL, OUTPUT);    
  8. }    
  9. void loop()    
  10. {    
  11.    reading = analogRead(POTENTIOMETER);    
  12.    value = map(reading, 0, 1024, 0, 255);       
  13.    analogWrite(CONTROL, value);    
  14. }   
Explanation
  • When we adjust the potentiometer the LED /Fan can be controlled.
  • When the potentiometer is scrolling the brightness of the LED can be High/LOW.
  • When the potentiometer is scrolling the Speed of the Fan also changes.
Output


            Figure 1: Output
 
Read more articles on Arduino: