Sunday, September 21, 2008

NOKIA 3310 LCD interfacing with ATmega8


Hi friends,
using graphic LCD in a project gives itreally a good look and flexibility of displaying different characters and shapes. But, the graphic LCDs are quite costly.
The NOKIA 3310 LCD provides a really low-cost solution to add a small graphic display into your project and also good for learning purpose. The LCD is SPI bus compatible, saving many pins for other uses. It operates at 3.3v.

Here is a small circuit for interfacing the 3310 LCD with AVR microcontroller ATmega8. The schematic includes LCD connection with SPI port of ATmega8 with other connections required by LCD. The 3.3v is generated using adjustable voltage regulator LM317 (I was not having any 3.3v regulator at the moment). An LED is also connected with microcontroller just for making sure that the controller is working, particularly when you don't see anything on the display!

Here is the schematic and the pin details of the LCD (click on the image to enlarge it):


The connector of LCD is 'touch' type. So, I made a small connecor PCB with tracks touching to the pins of LCD. The pcb was pasted at backside of LCD using cello tapes as shown in the back-view image
.
The program routines are written in C with ICCAVR compiler. I've created a library for this display. The low-cost, easy availability has made me relly like this display.
I'm going to use it for
doing other stuffs, too!

Check out my thermometer project with this display, where you can download the library:
Thermometer with Nokia3310

Download datasheets:
1. ATmega8
2. PCD8544 - nokia 3310 display controller

Thanks!!
--------
ccd@dharmanitech.com

55 comments:

Shri Vethathiri Maharishi said...

very nice work dharmani

CC Dharmani said...

Thanks, man!

Balaji V said...

Can you just mail me the sources of this thermometer project?
My Email ID is vbalaji.acs@gmail.com

CC Dharmani said...

Ok man,
I've sent it, check it out in your mail!

Balaji V said...

Thanks dude...
I got it.

Arvind Gupta said...

pls tell me part no of a 3.3 volt regulator. I have bought a 3310 lcd and wanna try out ur lib. Thanks!

CC Dharmani said...

A very easily available 3.3v regulator is LM1117-3.3
You can also use an LM317 adjustable voltage regulator, where using a small potentiometer, you can get 3.3v or 5v whichever you want.

Walther Grube said...

Great job! I'm impressed with all your projects andd will follow your work to learn more about MCUs.

Avinash Gupta said...

Hello Mr Dharmani,

I have made this 3310+ATmega8L interface but nothing showing up!!!

My Setup
**********
>>ATmega8L-8PU @ 1MHz internal
>>Power using 2 Pencil Batteries (1.5v each)

I have also gone through the code every thing looks ok for my Hardware setup

PLEASE HELP !!!

CC Dharmani said...

Hi Avinash,
are you getting atleast the LCD filled up with black dots? When the LCD is powered up, it shows the screen filled up with black pixels (may be of low contrast,but it'll be visible on sceen) just like the way alphnumeric LCD behaves when you power it on (there the upper line is usually filled with black matrix dots).

If you are not getting that, then there is a connection problem, check it out. If you have soldered directly on the LCD connector,chances are there that the thin transparent conductive layer (between the LCD connector & LCD screen) may have got some problem.

CC Dharmani said...

To Walther Grube:
Thanks for your comment, man! :)

Avinash Gupta said...

Thanks for reply!

My LCD is not showin any thing not even black pixel. Yes I have soldered directly on PINs and thats even two times(first time got some problem).

Also the connector has moved a bit.

Ok i will try with new one

tejas said...

Can u send a code of that interface of the 3310 LCD with ATMEGA 8 uc.
mail : tez_182@yahoo.co.in

Tejas

tejas said...

do u have full version of uVision 3(KEIL), if possible then send me the setup of that also asap

Tejas

CC Dharmani said...

Hi tejas, I've sent you the code files and I don't use that compiler.

Akshaya said...

I'm a beginner Mr.Dharmani i would like to know one thing if I use say a nokia 1110 how different will my schematic be. Does the 1110 use a different driver and what about the libraries will they be different. I m trying to get my hands on a 3310 but in case i don't. how do i go about it on a 1110? Thank you.

Jwildes said...

Hi,

Can you send to me the pcb adapter file? I would like to try using this lcd.
Good job.

Best regards from Brazil.

abhi said...

To CC Dharmani,

i have interfaced 3310 LCD with atmega16(8mhz and 3.3v).it is not showing anything on display.
fuse bits selected: bootsz1,bootsz0,clkse3,clkse1,clkse0/

plz help me..thanks

abhi said...

To CC Dharmani
Sir,
i have tried interfacing 3310 LCD with ATmega8L also.it is still not working.
connection and prog status:
1.connection as per your circuit diagram with 3.3V vtg regulator(1117).
2.i have put hex file given by u in controller.
3.fuse bits :hfuse:D9;Lfuse:E4;
8mhz frequency....

is there any way to check whether my LCD is working on not

CC Dharmani said...

Hi abhi,
How have you connected the LCD with the controller, by soldering wires directly on the display connector? IF yes, then there are chances that the connection may have problem. The connector is having a transparent conductive layer to make internal contact with the display, which is very thin. If you apply too much of heat, it may get damaged.
If you have another display, give it a try. A working display will show matrix of black dots (may be faint) on the screen, even if it is not initialized.
Check the connections again.

Nischay said...

Hello Dharma,
i have become regular visitor to your wonderful site! you have connected nokia lcd to SPI port of AVR, will the display work if i connected to i2c port, as i have some other device on spi port ( yes, you guessed it - its SD card) since SDAT and SCK are also there in i2c port. i want to know exactly which protocol is supported by Nokia 3310 display - SPI or i2c?

CC Dharmani said...

Hi Nischay,
the nokia 3310 LCd works on SPI bus only, you can't connect it on I2C bus.
Even if you have anything connected on the SPI bus, still you can use the LCD on the same bus, as each device on the SPI bus has a separate Slave Select (SS) pin. You can connect as many devices on the SPI bus as you want provided that you have a separate SS pin for each of those devices.

Ofcourse, there are other methods to connect devises in SPI bus (like Daisy Chain), but in your case, connect the 3310 LCD on the same bus, and just use another SS pin for LCD which you are not using for the SD Card

abhi said...

hello sir,

my previous LCD is not working ,so i brought a new LCD and made same PCB for connection as you made.but still its not working ..its getting 3.3v between pins 1 & 6.. but not showing any black pixel dots.

i have done connection for ATmega8 as per ur circuit diagram and .i have pburnt .hex code provided by u in thermometer project.

according to diag shown by you pin no 8 is near hole drilled for holding LCD?

for checking LCD is there any other connection than pin 1&6

Nischay said...

Hello Dharma, Thank you for clarifying my doubts. one more thing, from where did you buy 3310 display and how much it costs- i live in Hyderabad (A.P).here Electronics components shops don't sell these displays.

Balaji V said...

Dear Nishchay,
It is available in the Mobile market (Jagdeesh Market) in Hyderabad. I got that and it was working fine I got it working with ATMega32.
Regards,
Balaji.V

Nischay said...

Hello Balaji,Thank you !

before seeing your post,today morning i went to jadgish market and purchased the 3310 display, the vendor said it costs Rs.150, i bargained and got for Rs.130,i don't know if i paid more or less. i have just now finished making hand drawn pcb for connection,tommorrow i'll try to set it up with mega8

CC Dharmani said...

To Abhi:
Hi, if you are using the thermometer hex file, it may not show anything on display if the thermometer IC is not connected, as the code may hang during initialization itself. Put up your email ID here, or write to me on ccd@dharmanitech.com, I'll send you the code without the thermometer IC, just to display some text on the 3310 LCD

Nischay said...

Hello Dharma,
when i power up the bread board with atmega8 on the board,my display just shows black screen and just hangs, i directly soldered 8 thin wires to the lcd pins ( was very careful ), my mega8 is running at 8Mhz IntRC.

one more thing,i have ANDed y addr with 07h and ORed with 40h and x addr ANDed with 7Fh and ORed with 80h to set cursor, is this correct ?

abhi said...

please mail me routines and .hex file for "NOKIA 3310 LCD interfacing with ATmega8" on

abhishekpawar11@yahoo.com

smichael said...

Helo Dharmani
Can u send a code of that interface of the "NOKIA 3310 LCD interfacing with ATmega8"
mail: smichaelxx@tlen.pl
Thanks a lot

MANISH said...

@CC Dharmani
hello sir i saw your project its really fascinating.

i want to interface the same lcd with atmega 128 . what changes i should make in ur project to do so.

can you mail me the sourse code of your project.

Anonymous said...

Sir,

I have AtMega128 and I want to interface my Nokia3310 LCD to it. Please give me some direction so as to how to proceed or how different my connections would become on Atmega128, compared to your Atmega8.
and also please mail me some files so that I can check my LCD display as to is it working or not.

Earlier I was told by someone that since my LCD has different controller(PCD8544), I cant run it with Atmega128 that has AVR. Please help me.

Looking forward for a speedy reply.

Naveen
naveen@goyal.tk

Balaji V said...

What you were been told was false. You can talk to the controller in LCD with any microcontroller for that matter.

Anonymous said...

In the circuit, I have PIN4 of LCD connected to PB0(ICP). Please tell me is it PB0 or ICP?
Thanking You,
Naveen

CC Dharmani said...

Balaji said it correctly, you have been misinformed. Any microcontroller having SPI bus can be interfaced with this LCD easily, and mega128 is having it.
You won't have to change many things there.
No change in the DS1621 interface, as the mega128 is having the same
I2C (TWI) interface as the mega8.

For connecting the Nokia display, again there won't be ant change in
the SPI bus connection, just use the MISO, MOSI & SCK same way as
shown in my schematic. Only thing you have to ensure is that you
connect the same port pin which I used for connecting the chip-select
pin of the display, if you don't want to change the code.

That's all, you can compile the code again for the mega128, and there you go!!

CC Dharmani said...

To Naveen:
that pin is PB0, so connect it wherever PB0 comes in your new controller, don't bother about ICP

smhslh said...

may you send to me the code at my mail sameh167@hotmail.com
thanks for help

MANISH said...

@cc Dharmani..
sir can u mail me the code at
monkmanish@gmail.com

Anonymous said...

Hi Mr Dharmani, very nice work. can you send me the source code via e-mail?

My mail address is bongy@email.it thank you.

Josef said...

Thats very nice work! But my display still does not work. It even does not show black dots vhen it is not inicialized. I have display from mobile 3410 I thought that is the same as 3310 but I found that is not... So it will not work, does it? :) Could you send me source code and hex for simple LCD interfacing? I will try to get some 3310 display. By the way.... did you try to interface 3410 display? Thanks very much. pepajanda@seznam.cz

CC Dharmani said...

Hi Josef,
I haven't tried nokia 3410 display, so no idea whether it will work with this code or not.
I've sent you the code for 3310 lcd.

al said...

hello dharmani...
i already completed compile thermometer.hex from this schematic, but i not use thermometer,succes lcd is flame,but not appear character,just blank "black" lcd. i think connection schematic is true. i try just atmega8 and lcd.So,could you send me this file.hex..how to setting internal clock,i'm not understand..could you give me library .hex with use external clock just simple 4-12 mhz.

al said...

this my email (am8510@gmail.com)

ETM said...

Hi!
I'm having a problem.
I've compiled my code writing to the display works. But the display is constantly blinking. The text appears but the background contrast is pulsating. Running the program to a constant while(1) do LcdUpdate decreases the intensity slightly but not much better. I'm running it on a MEGA8 at 4 or 8 MHz. BTW, what is the lowest frequency I can use?

praveen said...

hi ,
this praveen , i have ds1621 in my weather station project i am unable to check it out man , please send me the c code and full details about it please i am really in urgent to test it ,,

m.y said...

hello
can you send me the source file of this project.

praised63@gmail.com

thanx

robotricks said...

Hello Dharmani Sir,
After seeing all posts i got interest to do the nokia lcd project. plz send me the code and hex file of he lcd interfacing with atmega8 without that temp ic.

hari_89c51@yahoo.com

Thanks

rupesh said...

sir i want information to operate nokia 3310 lcd using at89s52 plz sir
rupeshaborkar@gmail.com

praveen said...

hello cc dharamani i have got connected the circuits of 3310lcd with atmega 16 can you send me the source code and hex file to my mail id praveenat1985@gmail.com

aniket said...

aniket
Sir,i want to use nokia3310 display for my project.i have seen the lib files,would you plz send me the complete c code of interfacing 3310 with atmega8.i am also using RF comm in my project and having problems of noise being read by receiver.plz tell me the baud rate to be used.
email:patil.anikett@yahoo.in

sumit said...

gr8 work sir!!!
wil u provide a working 3310 LCD C code .....using Atmega 8?
i m waiting sir...
my email-id is
sumit3189@gmail.com

aniket said...

thank u very much!!!!

rupesh said...

Helo Dharmani
Can u send a code of that interface of the "NOKIA 3310 LCD interfacing with ATmega8"
mail:rupeshaborkar@gmail.com
Thanks a lot

aarti said...

hey can u tell me what ontent error in codevision avr

aarti said...

can u tell me what is flash error and address content error in codevision avr