This mini-tutorial will go through the process of setting up a ST7565 LCD. These LCDs are graphical which means they can display pixels, not just text. This type of LCD in particular has 128x64 pixels, which appear dark gray on a green-blue background. They have a backlight but can also be used without the light on for daytime visibility.
Another kind of LCD is the KS0108-type. These are not the same and are not compatible! Here are some comparisons
|Data pins needed|
4 or 5
internal, no extras!
As you can see there are a few differences.
If you are using an ATmega168 or ATmega8 such as used in older Arduinos you must upgrade to a '328 to use this LCD. And if you're using a '328 note that half the RAM is going to the display so you wont have a lot left over. This pretty much means you can't use something with an SD card (like a Wave Shield or Data logger Shield at the same time you will straight-up run out of RAM and it will be weird so don't bother).
We've written a tidy library for both C and Arduinoese, if you aren't using an AVR the C code is very portable and should take only a few minutes to turn into your favorite microcontroller.
Download it from github - click Download Source to grab it all. If you are using an Arduino, install the ST7565 folder which contains the library and an example sketch
We'll begin by soldering wires to the LCD. I'll use rainbow wires to make it a bit easier to tell apart but you can use whatever you'd like. The pitch of the connector is 2mm which means it won't fit into a breadboard but wires are easy to add on.
Here are the wire colors and the pins they go to:
In this tutorial we assume you're using a 5V microcontroller such as an Arduino, if your chip is running at 3v, you can basically just ignore the 4050 and do everything else!
The 4050 is a chip that will convert the high voltage of 5V down to 3V, here is a diagram
Start by connecting pin 1 of the 4050 (red) of the chip to 3.3V and pin 8 of the 4050 (black) to ground. In the following image, the two rails on the side are connected to the Ground and 3V pin from the Arduino.
Click on the photo for a bigger view if you need help with the wiring
Now the 4050 is connected to the Arduino we can connect the LCD up. We'll start with the backlight (which is optional) Brown (K) connects to ground and White (A) connects through a ~100 ohm resistor to 3V. You can also connect it to 5V through a ~270 resistor. Be sure to have some sort of resistor!
Finally the LCD power and data lines. Connect Red (VDD) to 3.3V and Black (GND) to ground. Then connect
Now you can run the ST7565 example sketch in the library which will show off some of the many ways you can use the screen.