Comments: Graphic LCD Hookup Guide
Looking for answers to technical questions?
We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.
If you've found an issue with this tutorial content, please send us your feedback!
-------------------- Tech Support Tips/Troubleshooting/Common Issues --------------------
PCB and Screen Dimensions
The overall size of the board is 45mm vertically and horizontally. For the screen, it's about 40mm horizontal and 34mm vertical. The depth I measured from the top of the screen to the front of the board is about 3.75mm. If you measure the overall height, it's about 5.1mm high from the top of the screen to the legs of the screen.
Here is an image of the dimensions
![https://raw.githubusercontent.com/SparkfunTechSupport/Dimensional-diagrams/master/LCD-10168/Graphic%20LCD%2084x48.jpg](https://raw.githubusercontent.com/SparkfunTechSupport/Dimensional-diagrams/master/LCD-10168/Graphic%20LCD%2084x48.jpg =300x300)
Contrast
If the display is not showing pixels even with the correct logic levels and example code, it may just have slight variances in the way that they were manufactured. You can see the pixels faintly on the screen at an angle or pushing down on the LCD. You will need to try and set the contrast where it says
setContrast(40)
on line 87 to a value of60
. There is probably some variances in the LCD’s contrast which might explain why certain LCDs have issues displaying defined pixels on the screen.Scrolling Text
For code to scroll text, try looking at this blog post => [ http://blog.stuartlewis.com/2011/02/12/scrolling-text-with-an-arduino-and-nokia-5110-screen/comment-page-1/ ].
I only got the code sample to work by restoring the commented code in the LCDWrite() function.
I simply dropped the SPI.transfter call and left the commented code of shiftOut.
In addition, I used the following setting in the lcdBegin() function to get the best results of contrast and other capabilities:
Concerning the off-by-one error...
The line defining the bitmap for the backslash character will cause problems if there isn't a space after the backslash character:
Without a space after the
\
the following line will be treated as part of the//
comment and thus ignored and this will cause an off-by-one error for all following characters.Hey all - I found Russky's comment extremely helpful. Changing
to this:
solved my problems.
Also regarding the off-by-one character issue: there seems to be an error in the ASCII[] array. The array item for the character ']' is listed twice:
Deleting one of those lines solves the off-by-one problem.
Cheers!
For those interested, I was able to scroll images across the screen by simply adding a simple new function of getPixel that allowed me to essentially loop over my image, getting the current value at a location, then placing that value slightly left or right on the display, over and over, scrolling the image left or right.
Hope this helps others!
Anyone know how to write a function that would scroll a bitmap (such at the sample xkcd cartoon) across the screen coming from completely off the screen on one side to off the screen on the other side?
I've done something simple with using GotoXY, but that has problems with the wrapping of the image. I think I need to write parts of the xkcd bitmap to parts of the displayMap array but I'm finding that difficult to calculate how to do that.
I followed the writeup for the hookup and copied the code provided into a sketch. The code compiles and runs, but I don't see anything on the display. I DO see the LED backlight brightness changing, so the coad has uploaded and runs...
I've played around with a few things. I can modify the LED backlight, and can send data to the serial monitor with debug statements configured to show the bytes that LCDWrite is sending out the data line. So it's TRYING to do something. I've experimented with the screen contrast and have tried changing the write method from SPI back to the commented out shiftOut statement.
I've also downloaded the sketch: http://dlnmh9ip6v2uc.cloudfront.net/datasheets/LCD/Monochrome/Nokia_5110_Example.pde which runs and displays to the LCD, but there is something weird going on with the ASCII table. Sometimes it works, but also I'm getting values that are off by one, and other values that are gibberish.
Any suggestions?
Same thing just happened to me with an UNO. The example code didn't work, so I re-wired to match the default pin settings in the sketch linked by Member #551051 and now both the example code and the linked sketch work correctly:
const int scePin = 7; // SCE - Chip select, pin 3 on LCD
const int rstPin = 6; // RST - Reset, pin 4 on LCD
const int dcPin = 5; // DC - Data/Command, pin 5 on LCD
const int sdinPin = 4; // DN(MOSI) - Serial data, pin 6 on LCD
const int sclkPin = 3; // SCLK - Serial clock, pin 7 on LCD
const int blPin = 9; // LED - Backlight LED, pin 8 on LCD
For the code that doesn't work, I'd really expect the problem to be contrast. Try using the same contrast as that of the sketch that works (I notice that one sets it to 55 and another to 40). Maybe even try every possible contrast value (0-127) with a for loop after you've drawn something.
For the sketch that does work for you, which characters are printing gibberish or wrong values? Is it repeatable?
I'm having the same problem described above. I've tried contrast values from 0-127 with no luck. I also tried the sketch mentioned above and it works, with some ASCII table weirdness. The lower-case letters seem to be shifted. The display reads 'Hfmmp Wpsme!'
When I click on the link to download LCD Assistant I get a message that I'm being blocked. Anyone else getting that or am I just special?
For me the PCD8544 is what I use instead of the typical 16x2 lcd screens. Not only can you do more with it, I think ease of use and connecting it up is about the same.