Introduction
- In this article, I will explain how to control Light/Fan using Arduino Mega 2560. Light and fan will be controlled by the potentiometer.
- We can adjust the potentiometer and light and fan will be controlled by us.
Parts Of List
- Arduino Mega 2560
- Potentiometer
- LED
- Bread board
- Hookup wires
Potentiometer:
- It has three terminals.
- It has a sliding or rotating contact that forms an adjustable voltage divider.
- It acts as a variable resistor (or) rheostat.
Figure 1: potentiometer
Connection:
Step 1: Potentiometer to ArduinoMega2560
Step 2: Connection From LED To Arduino Mega 2560
Postive pin = 06
Negative pin = Gnd
Programming
- const byte POTENTIOMETER = 0;
- const byte CONTROL = 6;
- int reading;
- int value;
- void setup()
- {
- pinMode(CONTROL, OUTPUT);
- }
- void loop()
- {
- reading = analogRead(POTENTIOMETER);
- value = map(reading, 0, 1024, 0, 255);
- analogWrite(CONTROL, value);
- }
- Through this we can control Light /fan using potentiometer.
- If we adjust the potentiometer on the decreasing side the light brightness decreases.
- Also the fan speed also decreases.
- If we adjust the potentiometer on the increasing side the light brightness increases.
- Also the fan speed increased.
Output:

Figure 2: Output
Read more articles on Arduino:

Sr KarthigaPosted May 25, 2016, 8:23 AM
thank you santhakumar sir
Sr KarthigaPosted May 25, 2016, 8:22 AM
thank you vivek sir
Santhakumar MunuswamyPosted May 21, 2016, 2:34 AM
Thank you for nice work
Vivek KumarPosted Apr 27, 2016, 9:30 AM
Nice one
Sr KarthigaPosted Apr 21, 2016, 10:49 PM
Thank you debasis sir
Sr KarthigaPosted Apr 21, 2016, 10:48 PM
Thank you gowtham sir
Sr KarthigaPosted Apr 21, 2016, 10:48 PM
Thank you Rahul Saxena sir
Sr KarthigaPosted Apr 21, 2016, 10:48 PM
Thank you Shakti Singh Dulawat sir
Debasis SahaPosted Apr 21, 2016, 1:30 PM
Nice One..
Gowtham KPosted Apr 21, 2016, 1:20 PM
Good One, Thanks for sharing:)
Rahul Kumar SaxenaPosted Apr 21, 2016, 9:10 AM
Good one
Shakti Singh DulawatPosted Apr 21, 2016, 6:38 AM
Simply awesome , Nice step and very well explain
Sr KarthigaPosted Apr 20, 2016, 10:57 PM
thank you vignesh mani sir
Sr KarthigaPosted Apr 20, 2016, 10:57 PM
which clg
Vignesh ManiPosted Apr 20, 2016, 3:53 PM
Nice
Tamilan SPosted Apr 20, 2016, 2:57 PM
I also paavai