LCD Trainer Kit

15,869

188

18

About: Electrical Engineering Student. Love to make projects and learn along the way!

A few years back, I was introduced to the world of Arduino. I was fascinated by the fact that you can make things work with just typing in some lines of code. Do not like how it works? Change a few lines of code and there you have it. As soon as I got my first Arduino, like every other excited hobbyist, I tried each and every basic example circuits right from blinking an LED to displaying my name on a 16 x 2 LCD display. There are lots of tutorials on the internet along with the code. Just copy paste the code and your circuit is up and running. As time progressed I started playing with more complex components like OLED displays, sensors, etc.

After having some fun with Arduino, I realised that some things are not complete. What does lcd.print("Hello, World!") actually do? What does each pin of the display do? How does the microcontroller on the Arduino communicate with the display? We simply overlook this because a complex task of making a component like those to work is made simple for us with the help of a Library! A library is a collection of a predefined set of instructions. Most of the information is hidden in these libraries. When the main program reaches the function such as lcd.print, the program will jump into the library, look for the function and execute it. After execution, it returns back to the main program. In the above example, you might have come across such lines in the program #include . The library used here is LiquidCrystal.

Though the main program becomes small and easy to understand, it hides a lot of information and it can be confusing for newbies like us. So, in this Instructable let us try to run an LCD Display but WITHOUT a microcontroller! Yes, YOU are going to be the microcontroller. This will help us to know what all task a microcontroller does to display a text on the screen.

Let's get back to the basics!

Step 1: Things You Will Need

1) 16 x 2 LCD Display x1

2) SPDT Toggle switches x8

3) Momentary Push Button x1

4) Slide Switch x1

5) 1k Potentiometer x1

6) Micro USB breakout board x1

7) Project enclosure box x1

Step 2: Know Your LCD

The most commonly known 16 x 2 LCD Display in the hobby world will have 16 pins. We will be using the same display for the demonstration. Before going further, let us have a look at what each of the 16 pins does.

LOW - Connecting the pin to ground.

HIGH - Connecting the pin to +5V.


Pin 1: GND

Connect the pin to ground.

Pin 2: VCC

Connect the pin to +5V.

Pin 3: Contrast Adjust

The contrast of the LCD can be adjusted by providing a voltage to this pin between 0V and 5V. This can be done with the help of a potentiometer.

Pin 4: Register Select (RS)

The display has two registers viz. Data Register and Instruction Register which can be selected with the help of this pin. Pull the pin low to select instruction register and high to select data register.

The instruction register is used to send instructions such as initiate display, clear display, etc. while the data register is used to send ASCII characters on the screen.

Pin 5: Read/Write (R/W)

This pin allows you to write or read from the selected register. Pull the pin low to write or high to read.

Pin 7 to Pin 14: DB0 - DB7

These are the data bits from 0 to 7 which represent an 8-bit binary number.

Pin 6: Enable (E)

When you have set all the above pins as you want, a high to low pulse to this pin will feed all the information into the screen.

Pin 15: LED +5V

Pin 16: LED GND

The pins 15 and 16 are for the backlight LED. Connect pin 15 and 16 to +5V and GND respectively.

Step 3: Preparing the Enclosure and Layout

Choose a suitable project enclosure box. Mine has a dimension of 20x15x4 cm. Plan the layout of components to be installed on the box as shown in the picture. Be creative in choosing the layout as long as it is sensible. I actually reused this box which was originally used in some other project. It had some slots and holes already drilled and so I had to plan the layout according to it.

8x SPDT Toggle switches for D0 - D7.

1x Momentary Push Button for Enable

1x Slide Switch to select between Instruction and Data Register.

1x 1k Ohm Pot for Contrast.

Step 4: Time for Wiring

Refer to the schematic diagram attached here.

The USB micro breakout board has 5 terminals of which we will be using only two viz. VBUS (+5V) and GND since we are using USB only for power.

Connect all the upper terminals of toggle switches together as shown in the picture. This will be connected to GND. Likewise, connect all the bottom terminals together. This will be connected to +5V. Connect the first switch's middle terminal to D7 (pin 14) on LCD. Similarly, the middle terminal of the 2nd switch to D6 (pin 13) and so on till D0 (pin 7).

Connect any one terminal of the push button to +5V. Connect the other terminal to GND through a 1k resistor. Connect the same terminal to Enable (pin 6) on LCD. Connect a 100uF electrolytic capacitor across the switch with the negative side of the capacitor connected to the terminal with the resistor attached to it.

Connect the middle pin of the slide switch to pin 4 on LCD and the lower and upper terminal to +5V and GND respectively.

Connect the outer two terminals of the pot to +5V and GND respectively and the middle pin to Contrast adjustment (pin 3) on LCD.

Connect pins 1, 5 and 16 on LCD to GND

Connect pins 2 and 15 to +5V.

Step 5: Working

The actual LCD is controlled by an IC called HD44780U which can be seen as a black blob on the back of the LCD module. It is a Liquid Crystal Display Controller/Driver. The datasheet for this driver can be found here.

To get the LCD running, we have to go through a few steps. This includes initializing the LCD by giving some set of instructions followed by the actual data (characters). All the information can be found in the datasheet. But for now, I will give a quick demo on how to type HELLO! on the display.

Note: 0 means LOW (GND)

1 means HIGH (+5V)

First, turn ON the power. The backlight of the LCD should light up.

Step 1: As we will be sending Instructions, Instruction Register(IR) must be selected using the slide switch.

Step 2: Next, we will set the bits using the toggle switches as 00001111 as shown. This will turn ON the display, cursor and blinking of the cursor. Press enable push button. You should now be able to see the blinking cursor at the top left corner of the screen. Adjust the contrast using the pot if needed.

Step 3: Set the toggle switches as 00110000 as shown and press Enable. This will set the display to accept 8-bit data, enable first out of the two lines and set the font size to 5x8.

Step 4: Set the slide switch to Data Register (DR) so that we can now send some characters.

Refer to the document attached hereby to find out the bits for each character

Step 5: To display H, set the toggle switches to 01001000 and press enable. Repeat the same for every character.

Step 6: To display E, set the toggle switches to 01000101 and press enable.

Step 7: To display L, set the toggle switches to 01001100 and press enable twice.

Step 8: To display O, set the toggle switches to 01001111 and press enable.

Step 9: To display !, set the toggle switches to 00100001 and press enable.

Well done! You must now see HELLO! on the screen.

Step 6: Enjoy!

We just learnt that just to type in a few letters on the display there are a lot many steps involved in the process. In this way, we can learn what a microcontroller does to communicate with the displays. We just saw a few instructions out of the many. You can have fun with it and learn along the way!

Now we can understand how and why the libraries are created and also the hard work which goes behind the making of a library for a device.

Thank you for sticking till the end. Hope you all love this project and learnt something new today. Let me know if you make one for yourself. Subscribe to my YouTube channel for more upcoming projects. Thanks once again!

Electronics Tips & Tricks Challenge

First Prize in the
Electronics Tips & Tricks Challenge

Share

    Recommendations

    • Optics Contest

      Optics Contest
    • Make it Glow Contest 2018

      Make it Glow Contest 2018
    • Plastics Contest

      Plastics Contest

    18 Discussions

    0
    None
    jasoberon

    2 days ago

    Great!!! This is very useful as it encourages makers to better understand what is going on inside LCD

    0
    None
    ollie.jane

    11 days ago

    This has already been done over a year ago by The 8-Bit Guy.

    1 reply
    0
    None
    brightled

    5 days ago

    this should be built and understood long before anyone uses arduino...Back in the mid 70's i built an 8001 machine that worked the same way only diff was we used hex and not bcd...learning without the arduino and libs make a real engineer

    0
    None
    GirishP1

    8 days ago on Step 6

    great n simplified tutorials to understand for all...
    keep it up...
    n thnx too :)

    0
    None
    strooom

    11 days ago

    This is very useful as it encourages makers to better understand what is going on inside, deeper down. Too often people mix together a few arduino libraries without understanding what's really going on, and at the first glitch they are lost..
    I have 1 remark on your design : I think it is important to 'debounce' the E (enable) signal. If not, some contact bounce of the switch may cause multiple commands or bytes being sent, instead of just one. You could debounce with an RC filter, ideally you clean up the flanks with a schmitt-trigger, eg a 4093.
    I've written a HD44780 driver, as well as a so-called BigFont driver. They are both on my Github : https://github.com/Strooom?tab=repositories

    0
    None
    BaldEagle1

    11 days ago

    Very nice project. I have been looking for a project like this for a long time. Will probably build my panel using 1/4 inch plywood.

    0
    None
    williedec

    12 days ago

    In step 4 the instructions call for a 1k resistor to ground on the enable switch; however the schematic shows a 10k resistor. Which is it? Also the instructions call for a 100 uf capacitor across the enable switch but no capacitor is shown on the schematic.

    0
    None
    whataslacker

    17 days ago

    Nice Job. Now I just need a handy English to binary dictionary. 01001110 01101001 01100011 01100101 00100000 01001010 01101111 01100010 00100001 00100000 01001110 01101111 01110111 00100000 01001001 00100000 01101010 01110101 01110011 01110100 00100000 01101110 01100101 01100101 01100100 00100000 01100001 00100000 01101000 01100001 01101110 01100100 01111001 00100000 01000101 01101110 01100111 01101100 01101001 01110011 01101000 00100000 01110100 01101111 00100000 01100010 01101001 01101110 01100001 01110010 01111001 00100000 01100100 01101001 01100011 01110100 01101001 01101111 01101110 01100001 01110010 01111001 00101110

    1 reply
    0
    None
    BruceC94

    17 days ago

    Brilliant idea! We need more like this, peeking behind the curtain to understand how the magic works.

    1
    None
    cnc002

    18 days ago

    Excellent project! For around the last 30 years I worked I was a field engineer (before retiring) and specialized in Computer Numerical Control industrial machine tools. One thing I insisted on when training operators and programmers for the machinery was that they learn how to write the part programs by hand without using a CAD/CAM system. This way if a problem occurs due to the CAM software writing some incorrect or incompatible code, the programmer can usually diagnose the problem. If they rely solely on the CAM software and don't know how the code functions it is highly unlikely they can correct the problem(s) without help from someone who does know how it works. Your project uses the same logic as I used back then by teaching how the "nuts and bolts" of LCD's work. It also tends to be a lesson in basic binary system.

    Again, very good job!

    Randy Abernathy

    0
    None
    RoaRobClub

    18 days ago on Step 5

    Nice looking panel.
    I had built something similar 5-6 years ago using dipswitches instead of toggle switches for data lines so the trainer could be much smaller.
    For youngsters, this bigger and stronger panel is better.
    I also had issues with switch bounce on the read line, making double letters sometimes. Hope you are able to overcome that with this design.

    0
    None
    David Zebrovski

    18 days ago

    I really liked this project. People like you drive the hive mind ^_^). Keep up the good work.
    Its so nice to see people doing serious fundametal prototyping and not plugging modules like monkeys. Hehe

    0
    None
    Tominaz

    18 days ago

    Really nice job. Thanks for the info. Should make interfacing a lot easier

    1
    None
    taifur

    19 days ago

    Nice!