Struggling with the Nokia 5110

I have just started to try using the Nokia 5110 LCD. The version I have is the red pCB which came from here: http://www.ebay.com.au/itm/170817974147?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

The pin arrangement is slightly different from most but I don’t think the problems lie there.

The code comes from a blog

and can be downloaded from

I don’t think the code is really the problem. The sketch does work. It is an hours/minutes elapsed timer display with a neat little bar graph below, to show seconds. The essential start is

// Pawel
// This works with UNO but streaks
#define PIN_SCE 7
#define PIN_RESET 6
#define PIN_DC 5
#define PIN_SDIN 4
#define PIN_SCLK 3
#define LCD_CMD 0

#define LCD_C LOW
#define LCD_D HIGH

#define LCD_X 84
#define LCD_Y 48

static const byte Digits[][4][18] =

The pin arrangement is.

Nokia 5110 Uno pins

  1. RST 6
  2. CE 7
  3. DC 5
  4. DIN 4
  5. CLK 3
  6. VCC 3V3
  7. LIGHT 5V
  8. GND GND

The first problem was probably a clash of pins, as it would not work on my proto shield. Pin 3 is already in use for the thermometers and is pulled high by a 4k7. I guess I can relocate that to the vacant pin 8. In the meantime I am running the 5110 with the bare EtherTen.

Now that I have the display actually displaying something, I cannot get the backlight to work. I did have it work momentarily, which was a real surprise. At the time, I had the wires that I thought should work it in my hands, not actually connected to anything. I have not been able to duplicate this trick. Nothing happens if the 5v line is disconnected.

The screen has vertical streaks and a cascading vertical shadow, like seeing a TV on the movies. The density of those streaks is determined by the number of active pixels in a vertical line. The bar graph dopes not contribute to the streaking - not enough pixels, I guess. While I have been writing this, the streaking first became less dense, even below a “1”, and the cascade much less apparent, then it became more dense.

The reset appears to work the same if I put it in RST rather than pin 6. Theree is nothing fancy about the circuit. The LCD is on a breadboard and eight jumpers therefrom to the Arduino.

I would be glad if those with more experience could comment.

The screen has vertical streaks and a cascading vertical shadow, like seeing a TV on the movies.

That's caused by too high of bias voltage settings in the initialization routines. Read the datasheet and play with the numbers a little and it will be gone.

Essentially the code works and the hardware setup is correct. You just need to fine tune certain things. You are 99% there.

Thanks

I have now tried two more sketches on my 5110. The firsat new one is here.
http://content.solarbotics.com/products/sample_code/nokia_5110_example.pde
This is a collection of text and graphic images. There is no streaking, even though there are some areas with a lot of vertically aligned pixels, but it is quite disappointing in that the display seems to have gone to the other extreme. It seems washed out and hard to read.

The next sketch is here
http://blog.stuartlewis.com/2011/02/12/scrolling-text-with-an-arduino-and-nokia-5110-screen/

This is a real surprise. It is a couple of lines of static text and a line at the bottom that scrolls. The readability is very good, far superior to the previous sketches. It has has an initialisation section and there is an interesting line

LcdWrite(LCD_CMD, 0x14); // LCD bias mode 1:48. //0x13

Which I assumed is what you are talking about but I went back to the other two and see that the same line is there in both, so I’m not sure what is going on.

All three sketches have the same definitions except that Seidle’s is missing the configuration line

#define LCD_D HIGH

It seems that the quality of the display is entirely dependent on the software, but I can't see where this happens.

I have just now gotten the backlight to work. This was entirely by accident. The LED pin is now wired to ground, which goes goes quite some way to explain why it was utterly disinterested in being connected to 5v. This is with the Stuart Lewis and the display is excellent. I am amazed. But it doesn’t do anything to help the other two sketches.

It looks like the thing to now is to just adapt Stuart Little to say what I want..

What amazes me above though, is that, although I haven’t grasped it all, the programming of this little gem is so simple. No libraries

Look at the datasheet, page 14.

This data sheet? http://www.sparkfun.com/datasheets/LCD/Monochrome/Nokia5110.pdf

JoeO:
This data sheet? http://www.sparkfun.com/datasheets/LCD/Monochrome/Nokia5110.pdf

God I hope not. P14 is a bit daunting. The supplier of the device I got had no links to anything and the libraries, or whatever, emailed to me were unreadable, so that datasheet is the only one I have seen.

I'm curious to find why the three sketches I have tried look so much the same in the vital areas yet produce displays that are so different. Stuart Lewis's produces the best looking display and is also the one most immediately adaptable to my needs.

got it to work?
i've noticed that
LCD 7. LIGHT -> Ardu 5V
is not working, but
LCD 7. LIGHT -> Ardu GND does.

and i've got it to run on this code:

#include <PCD8544.h>


// A custom glyph (a smiley)...
static const byte glyph[] = { B00010000, B00110100, B00110000, B00110100, B00010000 };


static PCD8544 lcd;


void setup() {
  // PCD8544-compatible displays may have a different resolution...
  lcd.begin(84, 48);
  
  // Add the smiley to position "0" of the ASCII table...
  lcd.createChar(0, glyph);
}


void loop() {
  // Just to show the program is alive...
  static int counter = 0;

  // Write a piece of text on the first line...
  lcd.setCursor(0, 0);
  lcd.print("Hello, World!");

  // Write the counter on the second line...
  lcd.setCursor(0, 1);
  lcd.print(counter, DEC);
  lcd.write(' ');
  lcd.write(0);  // write the smiley

  delay(500);  
  counter++;
}


/* EOF - HelloWorld.ino */

he3r0:
got it to work?

Yes, thanks. I'm so pleased with it that I am using it as my standard display! I have bought a second one and built it onto a small shield. It has a blue backlight which is absolutely useless and it is better disconnected. The first has a white light, and I hope yours has too...

when I wrote

I cannot get the backlight to work. I did have it work momentarily, which was a real surprise. At the time, I had the wires that I thought should work it in my hands, not actually connected to anything. I have not been able to duplicate this trick.

I think the light must have been grounding through my hands.

I re-wrote the first three stand-alone sketches so that the setup was the same in each. I was able to improve the display a little but the quality seems to depend on what is being displayed.

I now use the same library as you and have been able to improve the text and spacing by breaking the words up and judiciously using the cursor.

Are you aware it runs on the SPI bus? It seems to be the best-kept secret of the 5110.

It seems to be the best-kept secret of the 5110.

Yes, consider the names for those pins: SDIN, SCLK.

The other good screen is the 7110.