Arduino LCD playground | Philips PCF8833 LCD library

Philips PCF8833 Graphics LCD library


PhilipsLCD is an unofficial Arduino library that supports the screens commonly used in Nokia 6100 phones (and others). There are actually two types of chips for these phones, a Samsung and a Philips. This library only supports the Philips one.

The Philips PCF8833 is the interface chip in the 12-bit color 128x128 pixel screens used on the Sparkfun Color LCD Shield and the Olimex SAM7-EX256 and the Nokia 6100 phone, the Nokia 2600 phone (and others). Instructables: How to use a Nokia Color LCD

Download the library here:

The library has been created by Markos Kyritsis, it is (of course) copyleft, which means you can take it and do whatever you want with it. But please, please, if you optimise it in any way, then contribute to the community and upload a copy for everyone else =D


  • CS: Arduino Pin 9
  • SCLK: Arduino Pin 7
  • SDATA: Arduino Pin 5

Supported Features

Here is what you can do with the library:

  • Draw Lines

  • Draw Rectangles

  • Draw Filled Rectangles

  • Draw Circles

  • Draw Bitmaps (Although to draw a full screen image, or even an array of full screen images you are better off using an SD card. I talk about how to do this later on)

Using the Image.h to create a 'sprite' on screen

To draw a sprite on the screen, you need to insert 12bit hex values into the Image.h file. The default file comes with a little picture of Tux, my favorite penguin!

Example sketch

void setup() {



LCDP.LCDClear(0x00); // black

LCDP.DrawCircle(0xF00, 10, 20, 10); //Draw a red circle at (10,20) of radius 10

LCDP.DrawBitmap(50, 50); Draw Tux at (50,50)


List of instructions

  • LCDClear(int color); // Clear the whole screen with the specified colour
  • LCDInit(); // Initialise the screen
  • LCDCommand(unsigned char data); // Send a command directly to the screen
  • LCDData(unsigned char data); // Send data directly to the screen
  • DrawPixel(int color, unsigned char x, unsigned char y); //Draw a pixel of any colour ranging from 0x000 - 0xFFF to (x,y) coordinates
  • DrawCircle(int colour, uint8_t x0, uint8_t y0, uint8_t radius); // Draw a circle of any colour ranging from 0x000 - 0xFFF and a particular radius to (x,y) coordinates
  • DrawBrLine(int colour, uint8_t x0, uint8_t y0, uint8_t x1, uint8_t y1); // Draw a line of any colour ranging from 0x000 - 0xFFF starting from (x0,y0) coordinates and ending in (x1,y1)
  • FillRectangle(int colour, uint8_t x0, uint8_t y0, uint8_t width, uint8_t height); // Fill a rectangle with any colour ranging from 0x000 - 0xFFF starting from (x0,y0) coordinates and having a particular width and height
  • DrawRectangle(int colour, uint8_t x0, uint8_t y0, uint8_t width, uint8_t height); // Draw a rectangle of any colour ranging from 0x000 - 0xFFF starting from (x0,y0) coordinates and having a particular width and height
  • DrawBitmap(int xpos, int ypos); // Draw the bitmap specified in image.h at position (xpos,ypos)

Making a Photo Frame

The arduino has a very limited amount of memory -only 16kb EEPROM- and so making a photo frame is impossible. Instead, we could use the library in combination with the brilliant SDuFAT library created by: Libelium - and hosted by: BlushinBoy - I have merged the two libraries, and can now read basic 12-bit image data. However getting it to work is sadly not as simple as just uploading a .bmp file into the SD card. Instead, there is some processing which involves:

  1. Taking the data from a .PPM ASCII file which is a very simple image format. I personally use GIMP (which is open source) to convert my images to this format.
  2. Converting the data to HEX using a simple application I made in Python
  3. Putting the data in a .txt file on the SD card
  4. Sticking the SD card into the reader, and... VOILA!

Making a Photo Frame: a detailed walk-through

Before you do anything else, you need to connect an SD card to your Arduino. There is an excellent discussion on the Forums on how to do this.,8863.html

Communication with the SD card is done using the SPI protocol. This automatically means that you can't use those pins to communicate with the LCD screen (or the SPI protocol in that matter). If you are planning on using my library, then that's not a problem.

Creating a connector for the SD card can be really annoying (at least I found it to be). But, for the prototype stage, you can use a floppy IDE cable. As seen in the picture below.

I strongly recommend playing around with the SDuFat library before using my modified version. The primary reason for that, is to make sure your SD card works properly before you proceed. The SDuFAT library is located in the Arduino playground under this link:

The next step is to connect the LCD screen to the Arduino. The PIN assignment is the same as before:

  • CS: Arduino Pin 9
  • SCLK: Arduino Pin 7
  • SDATA: Arduino Pin 5

Now you can download my modified SDuFAT library from here:

Make sure you have neither the original SDuFat, nor the PhilipsLCD libraries in the hardware folder. Otherwise you won't be able to compile your programs (I tend to remove them temporarily to another directory).

Now you need to copy some images to your SD card. Begin by formatting your SD card to a fat 16 filesystem. In Linux, this can be done by typing: mkfs.vfat -F 16 -n SD /dev/sde1 (change sde1 to whatever your device is) into the terminal. You now need to follow the following steps for the Photo Frame application to work:

  • Create a directory somewhere on your harddrive, and name it whatever you like (e.g. - lcdimages).

  • Download my PPM converter, which I have written in Python. This little program will convert ASCII PPM files (a simple image format), into hex that is readable by the modified SDuFAT library. PPM converter link here:

  • Convert a 132*132 RGB image into ASCII PPM using some kind of image processing utility. I personally use GIMP which is Open Source, and also runs on Linux.

  • Edit the PPM file and remove any headers (e.g. # Created by Gimp), and also the image width and height (132 132) from the beginning of the file. Make sure you don't leave any spaces in the beginning, as they are considered to be characters.

  • Use the PPM converter and type the name of the file into the field, then click Convert. This will create an out.txt file which holds the HEX information + an EOF character at the end.

  • For the sake of the demonstration, name the file photo1.txt

  • Repeat the previous steps, and create a photo2.txt as well.

  • Upload the files onto your SD card

  • Download the photoframe sketch, and run it

I think the sketch is self explanatory, all the commands are there, apart from two, namely: dispOff() and dispOn(). You can use these to switch the screen off, and then back on again whilst drawing.

If everything went OK, you should see your first photo being drawn. Once the photo is completely drawn onto the screen, it will stay for ten seconds, and the next photo will start getting drawn.

The drawing process is incredibly slow, but it works. The demo works with only two photos, but by changing the sketch a little bit you can get it to draw a lot more.