vrijdag 7 juni 2013

128 x 64 LCD display

This blog is normally written in Dutch, but for once I'll write a page in English.

A while ago, I bought this display in the online store www.miniinthebox.com. I wrote a small review on the site, and I've been getting a few e-mails from people who also want to connect this display to their Arduino. Instead of checking my project each time to see how I got it to work, I decided to write this page and linking it back on that website.


So this is how I got it to work. This is the pinout of the display and how I connected it to my Arduino. I use the Arduino Uno R3, but this should work on any Arduino. If you use an Arduino Mega, you may need to change the pins. I use the display in serial mode, so you can leave te datalines unattached. You only need 3 Arduino pins to drive the display.

I use one extra pin to control the backlight of the display. This is not necessary, but I like it because I can let the user change the intensity of the screen using a "+" and "-" button on a keypad in my project. The output pin has to be a PWM pin (I use pin 6).

This is how I connected the display:
(please note that the names of the pins are different in this image. I can't change these, but it's pretty straight forward, just compare the pins on your real display)



The potmeter on the breadboard is 10kOhm, but anything between 10k and 100k should do just fine.

To control this display, first install the u8glib library, which can be found here. Go to the download page and pick the zipfile you need. In my Windows Vista, I only needed to extract the zipfile to the libraries folder in my Arduino root directory (extract the zipfile to something like C:\arduino-1.0.4\libraries)

To use the display, you'll need to add some code in your project to include the library, use a constructor to tell which pins to use and run some code to initialize the display. I reduced my code to what you'll need to start with. You can find the example here.

My project is also documented (in Dutch) here on this blog.


Important notes - please read! :
1. Please be sure you have a display which supports serial communication. Pin 15 is connected to ground in this scheme. The pin should be labeled "PSB". Connecting it to ground means switching to serial mode in this case. If it says something like "CS1", you have a parallel only display, and this will NOT work !

2. If you find the pin labeled "PSB", it's still possible that your board is fixed to operate in parallel mode. Take a look at these two versions of the board.

The first one has three pads close to each other, marked "P" (parallel) on the left and "S" (serial) on the right. There should be no connection between "P" and the middle pad (that's true in this case).


The second picture is another version of the display (thanks, Andrew). It has spaces labeled R9 and R10. As shown here, a zero Ohm resistor is attached to the R9 pads, which fixes it to parallel mode. You should remove this resistor if you want to work in serial mode, otherwise the scheme drawn above will shortwire your Arduino !


3. It's possible that your board has a variable resistor (potmeter - trimmer) which controls the contrast. In that case, the wiring to pin V0 is obsolete.

2 opmerkingen:

  1. Hoi Jan,
    ik heb ook zo een lcd liggen krijg hem nog niet goed aan de praat.
    de link naar de code werkt niet heb je voor mij een voorbeeld zoals je die werkend hebt gekregen?
    groetjes Hans

    BeantwoordenVerwijderen