Driving an HD44780 Display using a Shift Register and a Raspberry Pi

In my last instructable, I covered how to run a shift register using a Raspberry Pi, and kind of hinted that one thing you could do with it is run an HD44780 based display.Ā  Thatā€™s what this instructable will cover.Ā  This instructable is also the third one in a series leading up to my long awaited and greatly anticipated Voiceberry Pi.

Iā€™m happy to say that the next instructable in the series will be the Voiceberry Pi itself!Ā  Not much longer to wait.
Driving an HD44780 Display using a Shift Register and a Raspberry Pi
Introduction

The HD44780 is a very common driver for LCD displays like the one shown below.Ā  Normally, the circuitry is built right into the display, and you just have to connect a ribbon or headers to your circuit.Ā  Thatā€™s what Iā€™ll e covering here.

My display was purchased off eBay, and is a 40 character by 2 lines. Itā€™s a bit bulky, and has more characters than what I need for what Iā€™ve got planned (that Voiceberry Pi again), but itā€™s a great display otherwise.

One advantage of HD44780 driven displays is that there is a ton of information out there on how to use them, and even a good amount of information on how to use them with the Raspberry Pi.Ā  Because of this, I wonā€™t go into too much detail on how to run the display from the Raspberry Pi, but instead Iā€™m going to focus using the shift register to drive the display.

Two great sources of information on using the HD44780 are this blog entry, and this geocities website, which actually has an HD44780 simulator.Ā  That simulator really lets you get a handle on the various commands, and how to give them.Ā  Itā€™s kind of awesome.

Step 1: Planning Connecting the display

The first step is to setup the shift register, which is already covered in my previous instructable.Ā  Once that is setup, the data pins, clock and data/command pin will be hooked up to the first six bits of the shift register.Ā  But Iā€™m getting ahead of myself.Ā Ā  Let me start with the pinout of the display:

1: Ground
2: Vcc (+5V)
3: Contrast
4: Register Select (RS).Ā  Used to select data (HIGH) or command (LOW)
5: Read/Write (R/W). Write (LOW) Read (HIGH)
6: Enable (kind of like a clock pin)
7: Data 0
8: Data 1
9: Data 2
10: Data 3
11: Data 4
12: Data 5
13: Data 6
14: Data 7

Data 0-3 (pins 7-10) arenā€™t used in 4 bit mode, which is what weā€™ll be running.Ā  I use 4 bit mode for two reasons.Ā  First, I canā€™t run 8 bit mode, and control the RS and Enable pinsĀ  off the shift register at the same time.Ā  10 pins needed, 8 pins available.Ā  I could run a second shift register, but that would be a waste of 6 pins (10 pins needed, 16 pins available).Ā  Second, the tutorial I first saw used 4 bit mode.Ā  Stick with what other people know, I guess.
Driving an HD44780 Display using a Shift Register and a Raspberry Pi board
A few notes about how the RW, contrast, RS and E pins work.Ā  The RW pin is a read/write pin, and allows you to read data from the display, or write data to the display.Ā  The Pi canā€™t handle voltage coming back at the GPIO pins very well, so we want this pin to be stuck in the write mode.Ā  That means weā€™ll tie it to ground.Ā  This will prevent the possibility of the data pins going HIGH on us, and causing problems with the Pi.

Contrast is controlled by going from the contrast pin to a potentiometer, then to ground.

Next, the RS pin, as already hinted at, tells the display if it is receiving data (characters to display) or commands (like ā€œclear the displayā€).Ā  This pin will need to be able to be switched between HIGH and LOW, so it will be hooked up to one of the outputs of our shift register.

Finally, the E pin is what tells the display that the values presented on the data and RS pins is (are?) valid, and that the display should act on it.Ā  For this reason, this will be the last pin connected to our shift register.Ā  That way, when the data gets to the E pin, everything else will be setup.

Since the data pins need to be hooked up as well, it looks like the shift register will have outputs 1-6 hooked up as:

1: Data 0
2: Data 1
3: Data 2
4: Data 3
5: RS
6: E

 

For more detail: Driving an HD44780 Display using a Shift Register and a Raspberry Pi


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top