Introduction: How to Control an LCD Display the Easy Way - Arduino Tutorial
Controlling an LCD Display with an Arduino may sound complicated, but it should be simple and easy. In this tutorial we look at controlling an LCD display connected to your Arduino board using a few lines of code to display a message.
Step 1: Wiring Up the LCD to the Arduino Uno Board
The breadboard schematic above shows how to wire the LCD to the Arduino board in 4-bit mode.
The module I used in this example is the 1602A which uses the ST7066U controller that is compatible with the Hitachi HD44780 instruction set. The c library we use is based on the HD44780 instruction set.
The LCD Display board has 16 pins, but as we are using the display in 4 bit mode we only require 12 pins and three of those pins are grounded (Vss, RW, K)) and another two pins are connected to +5V along with the VO contrast pin indirectly connected to the power supply via a variable resistor acting as a voltage divider. So the actual amount of pins we require to be connected directly to the microcontroller's IO pins is 6.
Setting the Contrast
The contrast of the display is set by applying 0V - 5V to pin VO. We achieve this by using a 10k ohm variable resistor which acts as a voltage divider circuit. As the wiper is turned on the variable resistor the voltage changes. See the breadboard schematic above.
Step 2: Writing the Code to Display Text on the LCD
The code above is very simple and writes two lines of text to the LCD. For demonstration purposes the text message has been placed in the setup section of the code. Hhowever setting the text to be displayed in the setup section should only be used if you want an initial message to be displayed on start up. In normal programming, the text to be displayed should be in the loop or main program section of the code.
Once you've entered the code into the IDE, the next step is to upload it to the arduino board and your text should be displayed on the LCD within a matter of seconds.
I hope this Tutorial has been useful to you. If you liked it please share it with a friend.
Also, I'd really appreciate it for you to join my email subscriber list where we'll keep you up to date with our latest videos, tutorials and articles relating to microcontrollers, Arduino and other electronics information. You'll also receive our free newsletter which is exclusive to our email subscribers only !
Thanks for spending your time to read this Instructable. I really appreciate it !