1

Hello I have a nokia 5110 lcd display connected to my Arduino. I have looked at so many tutorials and none of them work for me. I am trying to get a bitmap displayed in the screen but only the lights light up and nothing else happens. I have the lcd connected to the following Arduino pins:

  • vcc -- 3.3v
  • gnd -- gnd
  • sce -- pin 7
  • rst -- pin 6
  • d/c -- pin 5
  • DN -- pin 4
  • sclk -- pin 8
  • led -- 100ohm resistor --pin 11

here is an image enter image description here

Nothing will display on the screen could someone please help me here is my code:

 #include "U8glib.h"
 #include "dht.h"

 #define dht_apin A1
 #define backlight_pin 11

 dht DHT;

 U8GLIB_PCD8544 u8g(8, 4, 7, 5, 6);  // CLK=8, DIN=4, CE=7, DC=5, RST=6

 const uint8_t brainy_bitmap[] PROGMEM = {
  0x00, 0x00, 0x03, 0xB0, 0x00, 0x00, 0x00, 0x00, 
  0x07, 0xFC, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x46,
  0x00, 0x00, 0x00, 0x00, 0xFC, 0x47, 0xC0, 0x00, 
  0x00, 0x01, 0xCE, 0x4C, 0x60, 0x00, 0x00, 0x03,
  0x02, 0x58, 0x30, 0x00, 0x00, 0x03, 0x02, 0x58, 
  0x10, 0x00, 0x00, 0x02, 0x02, 0x58, 0x18, 0x00,
  0x00, 0x03, 0x06, 0x4C, 0x18, 0x00, 0x00, 0x07, 
  0x04, 0x44, 0x18, 0x00, 0x00, 0x0D, 0x80, 0x40,
  0x3C, 0x00, 0x00, 0x09, 0xC0, 0x40, 0xE6, 0x00,
  0x00, 0x18, 0x78, 0x47, 0xC2, 0x00, 0x00, 0x18,
  0x0C, 0x4E, 0x02, 0x00, 0x00, 0x1F, 0x86, 0x4C, 
  0x7E, 0x00, 0x00, 0x0E, 0xC6, 0xE8, 0xEE, 0x00,
  0x00, 0x18, 0x43, 0xF8, 0x82, 0x00, 0x00, 0x10, 
  0x06, 0x4C, 0x03, 0x00, 0x00, 0x30, 0x0C, 0x46,
  0x01, 0x00, 0x00, 0x30, 0x18, 0x46, 0x01, 0x00, 
  0x00, 0x10, 0x18, 0x43, 0x03, 0x00, 0x00, 0x18,
  0x10, 0x43, 0x03, 0x00, 0x00, 0x1C, 0x70, 0x41, 
  0x86, 0x00, 0x00, 0x0F, 0xE0, 0x40, 0xFE, 0x00,
  0x00, 0x09, 0x1E, 0x4F, 0x06, 0x00, 0x00, 0x08, 
  0x30, 0x43, 0x86, 0x00, 0x00, 0x0C, 0x20, 0x41,
  0x86, 0x00, 0x00, 0x06, 0x60, 0x40, 0x8C, 0x00, 
  0x00, 0x07, 0x60, 0x40, 0xB8, 0x00, 0x00, 0x01,
  0xE0, 0x41, 0xF0, 0x00, 0x00, 0x00, 0x38, 0xE3, 
  0x00, 0x00, 0x00, 0x00, 0x0F, 0xBE, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0xCF, 
  0x82, 0x0C, 0x86, 0x46, 0x1F, 0xEF, 0xC3, 0x0C,
  0xC6, 0xEE, 0x1C, 0xEC, 0xC7, 0x0C, 0xE6, 0x7C, 
  0x1C, 0xED, 0x8D, 0x8C, 0xFE, 0x38, 0x1C, 0xED,
  0x8D, 0xCC, 0xDE, 0x38, 0x1D, 0xCD, 0xDF, 0xCC, 
  0xCE, 0x38, 0x1F, 0x8C, 0xF8, 0xEC, 0xC6, 0x38,
  0x1F, 0xEC, 0x08, 0x0C, 0xC2, 0x18, 0x1C, 0xEC, 
  0x00, 0xC0, 0x00, 0x00, 0x1C, 0xFD, 0xFB, 0xC0,
  0x00, 0x00, 0x1C, 0xFC, 0x63, 0x00, 0x00, 0x00, 
  0x1C, 0xEC, 0x63, 0xC0, 0x00, 0x00, 0x1F, 0xEC,
  0x60, 0xC0, 0x00, 0x00, 0x1F, 0xCC, 0x63, 0xC0, 
  0x00, 0x00, 0x1F, 0x0C, 0x63, 0x00, 0x00, 0x00,
  0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 
  0x00, 0x00, 0x00, 0x00, 0x28, 0x2B, 0x4F, 0x67,
  0x42, 0x38, 0x7B, 0xEA, 0x86, 0xB2, 0x28, 0xC7, 
 };

 void draw(void) {
   u8g.drawBitmapP( 0, 0, 6, 50, brainy_bitmap);  // put bitmap
   u8g.drawStr(10, 10, "% ");

 void loop(void) {

   u8g.firstPage();  
   do {
     draw();
   } while( u8g.nextPage() );

     delay(5000);  // Delay of 5sec before accessing DHT11 (min - 2sec)
   }

migrated from electronics.stackexchange.com Jan 5 '16 at 5:40

This question came from our site for electronics and electrical engineering professionals, students, and enthusiasts.

2

There are several possibilities.

Arduino GPIO pins drive outputs to ground or 5V.

The pins on the Nokia 5110 LCDs boards I have are not 5V tolerant. So you might have damaged them when the Arduino's GPIO connected to 5V.

A simple fix is to put a 10k ohm resistor in each signal path, i.e.

  • sce -- pin 7
  • rst -- pin 6
  • d/c -- pin 5
  • DN -- pin 4
  • sclk -- pin 8

You could get a level-shift chip, or build a circuit, but resistors are quick, cheap and easy.

I would strongly recommend using a very simple Arduino library to get the display working. Then, once everything is working, continue with your current approach. All you need is a simple test; something which turns pixels on and off to check that it works.

I have had good results with the Arduino Playground Philips PCD8544 (Nokia 3310) driver

I have several Nokia 5110's. A few needed the values loaded at initialisation to be tweaked, to make the display visible.

Specifically in void LcdInitialise(void):

  LcdWrite(LCD_C, 0x21 );  // LCD Extended Commands.
  LcdWrite(LCD_C, 0xB1 );  // Set LCD Vop (Contrast). 
  LcdWrite(LCD_C, 0x04 );  // Set Temp coefficent. //0x04
  LcdWrite(LCD_C, 0x14 );  // LCD bias mode 1:48. //0x13
  LcdWrite(LCD_C, 0x20 );  // LCD Basic Commands
  LcdWrite(LCD_C, 0x0C );  // LCD in normal mode.

I have had to tweak Set Temp coefficent, LCD bias mode 1:48 and Set LCD Vop (Contrast) to get make the display clear, without looking washed-out, or all-dark. Using a very simple library like the Philips PCD8544 (Nokia 3310) driver should make it easy to adjust this until things work well.

  • ok I did this and I used a multimeter to measure the voltage it was 5.01 volts. I didn't have 10k resistors so I used a 6k leading to a 4k and then to the sreen, should that work? – user2279603 Jan 5 '16 at 19:28
  • You're just trying to reduce the input current so that nothing gets damaged. So 10k made from two resistors should be fine. – gbulmer Jan 5 '16 at 23:01
0

Assuming you got your code from this site: https://brainy-bits.com/tutorials/how-to-use-the-nokia-5110/, it seems you edited the code from there to display only the bitmap, but you didn't get rid of everything. You have no DHT temperature sensors, so get rid of all DHT references in your code, including the 5 seconds delay at the bottom of loop(). If you intend to use the code from that site, then use it this way:

void draw(void) {
  u8g.drawBitmapP( 37, 0, 6, 50, brainy_bitmap);  // put bitmap
}

void setup(void) {
  analogWrite(backlight_pin, 50);  /* Set the Backlight intensity */
}

void loop(void) {
  u8g.firstPage();  
  do {
    draw();
  } while( u8g.nextPage() );

}

Make sure to get rid of the #define, #include and constructor referring to DHT.

0

Change your pinouts. HW SPI needs 13 and 11, not 8 and 4. Try this short bit of code: #

include <U8glib.h>

#define RST 6   
#define CE  7   
#define DC  5        //  D high is data, C low is command.
#define DIN 11  
#define CLK 13  
#define Backlight 9  // Don't forget the 330 ohm resistor.

//Declare the display and assign the pins.
  U8GLIB_PCD8544 u8g(13, 11, 7, 5, 6);  // CLK=13, DIN=11, CE=7, DC=5, RST=6 

void draw() {
  u8g.setFont(u8g_font_profont11);      // Select font
  u8g.drawStr(0, 15, "Nokia 5110...");  // Put string of display at position X, Y.
  u8g.drawStr(29, 35, "HELLO!!!");
}

void setup() {
    analogWrite(Backlight, 80);  // Set Backlight Intensity, 0 is fully bright, 255 is off.
}

void loop() {                    // Enter the U8Glib Picture Loop
 u8g.firstPage(); 
  do {
    draw();
  } while( u8g.nextPage() ); 
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.