In this write-up, there are various methods to control the brightness but in this article, we will use a potentiometer to change it by which we can vary the brightness of the LCD.
How to control the brightness of the LCD with Arduino
The most convenient method to control the brightness of the LCD which is interfaced with Arduino is by using a potentiometer(commonly known as a variable resistor). The “VO” pin of the LCD which is next to the “VDD” pin is responsible for the contrast of the LCD. We can control the contrast of the LCD by putting different resistance to the “VO” pin of the LCD using a potentiometer, VO is also known as “VEE” on some LCDs:
We will simply write an Arduino code for displaying the “LinuxHint” the on the LCD and control the brightness with the potentiometer using the code:
//included the library of LCD
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
//declare Arduino pins to LCD (RS, E, D4, D5, D6, D7) pins
void setup(){
lcd.begin(16,2);
//declared the 16x2 LCD
lcd.print("LinuxHint");
//printed on the LCD
}
void loop(){
}
The circuit diagram for the above circuit will be like this:
The components required for the above circuit are:
- A potentiometer
- Arduino Uno
- Breadboard
- 16×2 LCD
- Connecting wires
The hardware circuit for the above circuit diagram is:
In this hardware configuration of the circuit, we have connected the LCD with a potentiometer in such a way:
LCD terminals | Arduino Nano pins |
---|---|
VSS | Ground |
VDD | +5 volts |
VO | The output pin of a potentiometer |
RS | 12 |
RW | Ground |
E | 11 |
D4 | 5 |
D5 | 4 |
D6 | 3 |
D7 | 2 |
A | +5 volts |
K | Ground |
By varying the value of resistance with a potentiometer, we are changing the value of resistance at the LCD pin VO, due to which the brightness will be changed. The working of the above hardware configuration is:
Conclusion
The Vo pin of the LCD is used to control the contrast of the display on the LCD and we can control this brightness of the LCD by using a potentiometer on pin Vo of the LCD. In this write-up, the brightness of the LCD is controlled using the potentiometer and explained in detail. This methodology to control the brightness of the LCD is convenient and mostly used.