Appliance control using potentiometer and microcontroller
Components and Supplies -
- Arduino Uno
- 1 Potentiometer
- 1 LED
- 1 Resistor
Introduction -
The project is a potentiometer sensor made with an arduino uno, potentiometer, LED and resistor.The aim of this project is to blink the LED according to the resistance of potentiometer.By using the serial function we will print our name in the serial monitor.
Arduino Uno -
Arduino UNO is a microcontroller board based on the ATmega328P. It has 14 digital input/output pins (of which 6 can be used as PWM outputs), 6 analog inputs, a 16 MHz ceramic resonator, a USB connection, a power jack, an ICSP header and a reset button. It contains everything needed to support the microcontroller; simply connect it to a computer with a USB cable or power it with a AC-to-DC adapter or battery to get started.
Potentiometer -
A potentiometer is an electronic device that measures the EMF (electromotive force) of a cell as well as the cell’s internal resistance. It’s also used to compare the EMFs of various cells. In most applications, it may also be used as a variable resistor.
LED -
LED or Light Emitting Diode is a light source device. It releases light when current passes through it. The LED concept is based on a semiconductor device where holes and electrons recombine to produce energy in the form of photons.
Resistor -
A passive electrical component with two terminals that are used for either limiting or regulating the flow of electric current in electrical circuits. The main purpose of the resistor is to reduce the current flow and to lower the voltage in any particular portion of the circuit.
Connections -
- Connect the led cathode to GND and anode to the 6th digital pin of arduino uno through a resistor.
- Connect the terminal 1 of the potentiometer to the 5v pin of the arduino uno.
- Connect the terminal 2 of the potentiometer to the GND pin of the arduino uno.
- Connect the wiper pin of the potentiometer to A0 analog pin of the arduino uno.
Code -
int ptm=A0;
int led=6;
int ptmValue=0;
void setup()
{
pinMode(6, OUTPUT);
pinMode(A0, INPUT);
Serial.begin(9600);
}
void loop()
{
ptmValue=analogRead(A0);
digitalWrite(led, ptmValue/4);
Serial.print(“Utkarsh”);
delay(1000); // Wait for 1000 millisecond(s)
}
Working -
Declare pulse time modulation to A0.Declare 1 LED with int data type with value 6.Declare pulse time modulation value to 0.In setup function initialize the LED with the parameters first one is value of the used digital pin and second one is OUTPUT.Initialize the analog pin with pinMode function with the parameters A0 analog pin and INPUT. To print the value we will use the serial.begin function with the value 9600.In loop function use analogread function with parameter A0 analog pin and initialize it to ptmvalue.Use digitalWrite function to blink the LED with the parameters variable name of the LED and ptmValue/4.The last step is to print our name to the serial monitor.For this we will use serial.print function and pass name as parameter in serial.print function.
Application -
- Audio control: Both linear, and rotary potentiometers, are used to control audio equipment for changing the loudness and other audio related signals.
- Television: They are used to control the picture brightness, color response and contrast.
- Motion control: In order to create a closed-loop control, potentiometers are used as position feedback devices known as a servomechanism.
- Transducers: As these give large output signals, they find applications in the design of displacement transducers.