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
- const byte POTENTIOMETER = 0;
- const byte CONTROL = 9;
- int reading;
- int value;
- void setup()
- {
- pinMode(CONTROL, OUTPUT);
- }
- void loop()
- {
- reading = analogRead(POTENTIOMETER);
- value = map(reading, 0, 1024, 0, 255);
- analogWrite(CONTROL, value);
- }
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: