alphanumeric lcd arduino

Alphanumeric LCD with Shift Register on Arduino – part 1

One of the limitations of the small 8 bit microcontrollers like the Atmel ATMega family adopted by the Arduino board, is the reduced number of I/O ports. Among the main advantages of these microcontrollers: they are cheap, robust and simple to program. Therefore, also Arduino or one of its clones are cheap as well.

Microcontrollers in industrial applications are frequently used to manage almost simple circuits dedicated to a single task. We might think that an AVR microcontroller – e.g. the ATMega328p adopted by the Arduino UNO boards – has the sufficient number of pins to manage an alphanumeric LCD. In a complex industrial machine architecture that is more than sufficient.

LCD-Alpha 5

Thanks to the tons of Arduino users worldwide, we already know that the same ATMega328 microcontroller can do more than few basic functions. So why not many of them together?

In this first article we will propose to explore the power of the Arduino board with experiments, including circuitry and software, moving further to a high-level activity than a simple demonstration. Guys, with a little effort and few $$$ of components Arduino is the ideal tool to solve a lot of problems whereas other alternative solutions may be more expansive.

alphanumeric lcd arduino

The Alphanumeric LCD for Arduino will be our first circuit: using only one component, and of course the LCD, we can povide our Arduino board with at least a 16×2 alphanumeric LCD display that we will use in all our future applications. This project consumes only three I/O pins, no matter what we decide to use, connected to a Shift Register. I have experienced that an alphanumeric LCD added to Arduino as a stable add-on devices is very useful during the debug phase of the sketches and gives much more options to our projects. Especially in case of unavailability of the Arduino USB port connected to the PC.

The magic of the shift register

The shift register is an easy-to-manage component. We will dedicate a series of articles illustrating applications giving us the opportunity to develop circuits using one or more shift register saving a lot of I/O pins on our Arduino board.

Therefore you should expect that the software part (that is, the Arduino “Sketch”, more properly named firmware) covered extensively in the second part of this article, should be a bit complex. But the result is fascinating.

We should use a cheap parallel shift-out registers (it costs, depending on the country, a variable price around half dollar): the 74HC595

As a matter of fact there are two types of shift registers: shift-in (don’t worry, in future we will use this too) and shift-out parallel registers.

  • shift-in means that all the 8 bits (corresponding to 8 pins) can be set together and serially read from the input data pin.
  • shift-out is the opposite. We can send 8 bits serially to the output data pin shifted to the parallel 8-bits of the output pins.

Regardless of the type of shift-register we are using, we need only three pins in our microcontroller. One pin is used for the serial data and the other two act like a clock to notify to the shift-register when a bit is ready to be shifted (shift-out) or the microcontroller is ready to acquire a new bit for reading (shift-in).

Another important aspect is the name of the component: register. In the assembler language a register is usually a place where a series of bits are stored for special purpose. In fact, the shift-registers not only are able to shift in one direction a certain number of bits but the bit status of every pin is persistent until another byte has not been completely sent (or received). This is perfect for us, as we need to write bytes to the LCD device managing a timing series of steps (e.g. writing a new character, moving the cursor, etc.)

Alphanumeric LCD, the controlled device

At this point, the LCD Device will be connected with the 8-bits of the shift register (you can see the schematic and the circuit layout for the circuitry details).

So, what happens when we send a set of data to the LCD Device?

Our resulting sketch will be almost simple.

The most inspiring source to make this project comes from a blog post by Chris Parish proposing a similar circuit in 2010. Chris also provided a first modified version of the standard Arduino LCD Library supporting the shift register features. In 2010 Arduino libraries to manage shift registers were based on the 74LS164 component.

This arduinoshiftreglcd distributed on Google code was the only reference trying to solve the problem but included some bugs in the data timing and was not working properly.

The very valuable work by Chris consisted in modifying the 2010 version of the LiquidCrystal library distributed with the Arduino IDE (it was not supporting the shift register at all) and thanks to his work, in January 2010 the ShiftLCD Arduino library was born.

We suggest to download the ShiftLCD library from the link provided by this article. This version of the library implements the original Chris Parish ShiftLCD library with a couple of patches granting the compatibility with the most recent Arduino IDEs.

A last note about the circuit

In the mentioned circuit implemented in 2010 by Chris Parish, you can find also the use of a high impedance MOSFET to control the LCD backlight. We have removed this component from our circuit because it proved useless with the cheap LCD devices working fine with or without backlight support. Note that the devices without the backlight support cost about the half compared to those with it, anyway offering a good visibility.

The complete circuit kit, including the alphanumeric LCD ready to use can be found on the Balearic Dynamics area. Use code ELEKTRO1008 to get the discount!


In the second part of this article we will consider the usage of this tool with some software developed to simplify and shorten the sketches with the LCD device as part of our Arduino architecture.


Join the conversation!

Error! Please fill all fields.
  • kiranshashi

    I want the same a similar tutorial using 74LS164 . Is it possible.

  • kiranshashi

    Hi, What is the use of this MOSFET to Pin 15 and 16 of the LCD display.

    I mean – can I not just connect pin 15 -> 270 ohm resistor, and other end of the resistor to a +5V.

    LCD Pin 15 -> 270 ohm -> +5v
    LCD Pin 16 -> GND
    Now, I have a 16 X 2 LCD and I have given it the above format and the LCD lights up. Not sure what this Mosfet provides me.
    Appreciate a reply.
    Thanks Raveendran for replies to most of my queries.

  • Rich

    Thanks so much for this! super simple and worked right away. I have just got my first UNO r3 and 1602 LCD in a kit. Your instructions and code are easy to follow.

  • Dandi B

    Is this something close to I2C? Anyways is nice to know that I do not have to buy an expensive I2C LCD anymore. Thanks!

    • Enrico Miglino

      Hi Dandi,

      This method is a bit more “elastic” than the I2C protocol (that is anyway supported by ATMega328p processors). The I2C you mention is a real protocol and in few words it is managed by the “wires” library (here is the link: while this method can be used on any three free pins of the Arduino board, eventually leaving the I2C pins for other usage. As you will see in the next articles there are a lot of more complex things that can be done using the cheap shift registers.
      And… yes, you can avoid to buy expansive I2C displays. If you take a look to the pre-assembled kit it cost about few $ more than and I2C display (here is the link:

Looking for the latest from TI?