Interfacing Nokia 3510i and 5110 LCD with PIC Microcontroller

0.00 avg. rating (0% score) - 0 votes

Recently I started to regain some interest in embedded systems, and start to experiment with PIC micro-controllers. After some successful attempts with standard character LCDs using using the HD44780 controllers, I decided to get some Nokia LCD modules from eBay to explore.

The 2 LCD modules I purchased are for the 3510i and 5110 models. Both have built-in controllers which use Serial Peripheral Interface (SPI). The following are the pinout for my modules, notice that pin assignments may vary slightly.

LCD pinout

Nokia 5110:

Nokia 3510i:

The only different here is pin #5 which is used as data/command selection for the 5110, and unused for the 3510i.

Voltage difference: 5.5v vs 3V

Both LCDs are designed to work with 3.3V, but due to an internal voltage clamp 5V can be used for SCLK, SDATA, REST, D/C and CS as long as a current limiting resistor (around 10k) is connected in series for each line. 3.3V should still be applied to VCC and the LED supply. I have tried using voltage dividers, which did not work, perhaps due to the LCD varying internal resistance and current consumption.

With the above connections we can only write to the LCD but can’t read back the LCD response because 3.3v is not high enough to register as logic ‘1’ in the PIC. Luckily reading from the LCD is not required for basic operations; all that is needed is sufficient delay after each operation to make sure the LCD is ready for next command.

I have chosen the PIC16f88 simply because it’s available in my junk box. For simplicity, I have decided to use bit-banging to send data, and not the PIC built-in SPI module. Although this usually means complicated code and lower throughput, it does not matter as all I wanted is to get the LCD to display something useful ;)

LCD Memory Map

The 5110 LCD is monochrome, uses the PCD8544 controller and has a resolution of 48 rows × 84 columns. Each 8 pixels on a single column consumes a single byte on the LCD memory map. It takes 504 bytes to fill the entire LCD.

The 3510i LCD has 97×66 resolution and can operate in either 256 or 4096 colors. Since there seems to be little difference between 256 and 4096 colors due to the small resolution, I have chosen 256 colors for simplicity. Each pixel on the LCD is represented by a single byte and filling the entire LCD takes 6402 bytes in 256-color (8-bit) mode.

Sample code: displaying test patterns

The following code shows how to display all black pixels on the Nokia 5110 LCD. Notice that LCD initialization code is not shown.

void lcd_5110_clear()
{
for (int i=0; i<84;i++)
{
unsigned char row;
for (row=0;row<6;row++)
{
//all black pixels
char data = 0xFF;

lcd_5110_send(0x40 + row,0); //Y address
lcd_5110_send(0x80 + i,0); //X address

//write to display memory
lcd_5110_send(data,1);
}
}
} 

The following code shows how to display a selected color on the 3510i LCD:

void addset(unsigned char x1,unsigned char y1,unsigned char x2,unsigned char y2)
{
send(0x2a,0);//column address set
send(x1, 1);
send(x2, 1);
send(0x2B, 0);//page address set
send(y1, 1);
send(y2, 1);
send(0x2C,0 );//memory write
}
void LCD_Clear(unsigned int value,unsigned char Color)
{
unsigned char x, y;
addset(0,0,97,66);
for(y = 0; y < 67; y ++)
{
for(x = 0; x < 98; x ++)
{
send(Color, 1);
}
}
} 

Displaying text and graphics

Up until now you can only display test patterns on the LCDs. The use of a bitmap font (and extra code) is required if you want to display any useful text. I have chosen a 8×12 font for the 3510i LCD, and a 5×8 font for the 5110 LCD. The font, together with any graphics to be displayed, will be stored in a 24C64 (8Kbytes) I2C EEPROM. To program the EEPROM, I use the I2C version of the PonnyProg programmer. Notice that this may not work on newer PCs where the available current from the serial port is limited and will never work with a USB-to-serial converter. In my experiment, I made a stupid mistake of adding a LED via a 470 ohm resistor to show activity during programming. This result in data corruption and verification errors after programming due to excessive current consumption. Changing the resistor to 2k worked fine, although the LED is much dimmer.

With the EEPROM to store font and graphics, the 5110 LCD could now display text and some monochrome bitmap:

The 3510i LCD could do a much better job ;)

Notice that the serial port connector is for debugging purposes only.

The entire source code is attached here. The contents of the EEPROM is included with the source code and named eeprom.bin.

See also:

ST7735 1.8″ 128×160 color LCD
ST7920 128×64 graphical LCD
Other LCD modules that I have interfaced

0.00 avg. rating (0% score) - 0 votes
ToughDev

ToughDev

A tough developer who likes to work on just about anything, from software development to electronics, and share his knowledge with the rest of the world.

12 thoughts on “Interfacing Nokia 3510i and 5110 LCD with PIC Microcontroller

  • November 6, 2011 at 6:33 pm
    Permalink

    ask:
    if i want to use this 3510i LCD using AVR ATMega, May I have this LCD library in C language?
    send to my email tyo_sangar@yahoo.co.id

    Reply
  • November 6, 2011 at 9:18 pm
    Permalink

    The source code is available for download at the end of the article. It should be straight forward to port it to the AVR with very minor modifications to fit the AVR pin configuration.

    Reply
  • February 22, 2012 at 12:56 am
    Permalink

    Hello,

    I have a nokia lcd (probably 3310, don't know exactly). I am using an avr to interface with the lcd. My problem is that it does not work with 3.3V supply. If I wont to see the image clearly I have to connect it to 4V. My question would be is it possible that I have a nokia lcd that works on higher voltages? Have you heard of someone that had the same problem?

    Reply
  • February 22, 2012 at 11:02 am
    Permalink

    Hi, please refer to this http://www.paramaggarwal.com/post/583987692/nokia-3310-display and check the pinout of the 3310 LCD at the end of the web page. It requires an input power of 5V (not 3.3V). 4V is the minimum tolerance, which explains why it doesn't work below that. The 2 LCDs I am using (3510i and 5510) work on 3.3V. :)

    You can either try to see if you can power your AVR from 5V (I know some can), or try to use a level shifter to convert 3.3V to 5V. Try this http://www.rocketnumbernine.com/2009/04/10/5v-33v-bidirectional-level-converter

    I hope this helps :)

    Reply
  • August 15, 2012 at 11:36 am
    Permalink

    Excellent article! very low end pixel by pixel programming. can you provide the schematics for this.

    Reply
  • July 19, 2013 at 3:53 pm
    Permalink

    Please make the needed correction where you wrote 3.3v is not high enough to register a 1 on PIC. That is not correct. PIC WILL register a 1 on a port pin above 0.7v

    Reply
  • September 27, 2013 at 4:32 pm
    Permalink

    AGC: You are wrong. Please look up the parameter Vih in the datasheet. Depending of which particular pin it is the voltage is 0.7 Vdd or 0.8 Vdd or in the case of TTL ports 2.0 volts. (Vdd is the voltage the PIC is powered with)

    0.7 Vdd means 0.7 times Vdd – so if the PIC is running on 5.0 volts then the voltage needed to guarantee detection of a high level is 0.7 * 5.0 = 3.5 volts.

    Reply
  • September 28, 2013 at 11:22 pm
    Permalink

    @Matts, thanks for the info on the minimum voltage to register as '1' :)

    Reply
  • April 12, 2014 at 9:44 am
    Permalink

    Can somebody please show us ; How Should we initialize such LCD display? thanks.

    Reply
  • April 12, 2014 at 12:40 pm
    Permalink

    You can find the full source code (with initialization routines) inside the download link at the end of the articles.

    Reply
  • January 9, 2015 at 5:07 pm
    Permalink

    Hi, does anyone know if this LCD code will work with the Raspberry PI?

    Reply
  • July 5, 2015 at 7:16 am
    Permalink

    hola. muy bueno funciona tambien con el arduino…. si es asi me ayudarias muchisimo si me enseñaras como conecto el display 3510 a mi arduino y le monto una imagen bitmap

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>