Displaying Images and Icons on OLED Using 8051

by ExploreEmbedded in Circuits > Microcontrollers

6368 Views, 23 Favorites, 0 Comments

Displaying Images and Icons on OLED Using 8051

OledExploreEmbedded.png

In this tutorial, we will see how to display the images/icons on 128x64 OLED. To do this we need 128x64 pixels images, if not we have to crop/resize the higher resolution images. This can be done using Photoshop or some other photo editors. We will be using the windows built in tool PAINT.

Image Resize :

IPL.png
Glcd_Logo_0.PNG
Glcd_Logo_1.PNG
Glcd_Logo_2.PNG
Glcd_Logo_3.png

Let's take a high resolution image which is shown in the above image and crop it to 128x64 and then generate the bitmap.

Download and open the above image using ms paint as shown in the above image.

Resize the image to 128x64 pixels.

Save the image in monochrome bitmap format .bmp as shown in above image.

Bitmap Using Lcd Assistant :

Glcd_Logo_4.png
Glcd_Logo_5.png
Glcd_Logo_6.png
Glcd_Logo_7.PNG

Now run the LCD Assistant software and load the monochrome image saved in the previous step.

Do the setting as shown in the second image.

Click on FILE->Save Output and save the output file as logo.txt .

The bitmap for the image will be saved in an array as shown in the 4th image.

Use this array in your code for displaying the image/logo on the graphic display.

List of Components/Module Required :

1-DSC08768.JPG
1-DSC09061.JPG
1-dsc04417.jpg
IMG_16454556.jpg

Hook Up :

OLED with 8051_bb.png
0Oled_IPLLogo.png

Make the connections as per the above fritzing diagram.

Code :

Below is the complete code with the bit map array. Check oled_i2c.c file for pin connection.

#include "oled_i2c.h"
code char IPL_Logo [] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x88, 0x84, 0xC4, 0x42, 0x43, 0x41, 0x41, 0x41, 0x80, 0x00, 0x40, 0x80, 0x00, 0x00, 0x20, 0x01, 0x01, 0x03, 0x03, 0x07, 0x1F, 0x3E, 0xFC, 0xF8, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x09, 0x01, 0x01, 0x01, 0x00, 0x00, 0x38, 0x7C, 0x7C, 0xFC, 0x7C, 0xF8, 0xF0, 0x00, 0xC0, 0xE0, 0xF8, 0xFF, 0x7F, 0x1E, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC1, 0x7F, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x07, 0x0F, 0x1F, 0x3E, 0x7C, 0xF8, 0xF0, 0xE0, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x01, 0x83, 0xFF, 0xFF, 0x7E, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0xC0, 0xF0, 0x7C, 0x47, 0x47, 0x7F, 0xFF, 0xF8, 0xE0, 0x80, 0x00, 0x00, 0xFF, 0xFF, 0x07, 0x0F, 0x1E, 0x3C, 0x78, 0xF0, 0xE0, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x1F, 0x3F, 0x3F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFC, 0xF8, 0xF0, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x80, 0x20, 0x10, 0x06, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE3, 0xE3, 0xE3, 0x20, 0x20, 0xE0, 0xE3, 0xC3, 0x80, 0x00, 0x00, 0xE0, 0xE0, 0xE1, 0x23, 0x63, 0xE0, 0xE0, 0xC0, 0x83, 0x03, 0x03, 0xE2, 0xE2, 0xE2, 0x23, 0x21, 0x21, 0x20, 0x00, 0x00, 0x00, 0xE3, 0xE3, 0xE3, 0xC0, 0x00, 0x03, 0x03, 0x00, 0x00, 0x80, 0xE0, 0xE0, 0xE0, 0x03, 0x03, 0x03, 0xE2, 0xE0, 0xE3, 0xE3, 0x00, 0x00, 0xE0, 0xE0, 0xE0, 0x20, 0x21, 0x23, 0x23, 0x00, 0x00, 0x00, 0xE0, 0xE0, 0xE0, 0x20, 0x60, 0xE0, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x0F, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xF8, 0xF0, 0xE0, 0xE0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x04, 0x07, 0x07, 0x03, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x08, 0x3C, 0x7F, 0xF7, 0xE3, 0xC1, 0x80, 0x00, 0xFF, 0xFF, 0xFF, 0xC6, 0x84, 0x84, 0xC4, 0xC0, 0x00, 0xC0, 0xFF, 0x03, 0x07, 0x1F, 0x7F, 0xFC, 0xF0, 0x78, 0x0E, 0x03, 0x03, 0xFF, 0xFF, 0xFC, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xE0, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xC4, 0x84, 0x84, 0xC4, 0xC0, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0x08, 0x3C, 0x7F, 0xF7, 0xE3, 0xC1, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xEF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0x5E, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xF8, 0xF8, 0xF8, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x70, 0x38, 0xF8, 0xF8, 0xC0, 0x00, 0x00, 0x00, 0x00, 0xE0, 0xF0, 0xF0, 0x18, 0x08, 0x08, 0x08, 0x08, 0x08, 0x18, 0x00, 0x00, 0x00, 0xF8, 0xF8, 0xF8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0xF8, 0x00, 0x00, 0x00, 0xF8, 0xF8, 0xF8, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xFC, 0xFE, 0x7F, 0x7F, 0xBF, 0xBF, 0x3F, 0x1F, 0x0F, 0x07, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x3F, 0x3F, 0x30, 0x20, 0x20, 0x30, 0x30, 0x00, 0x38, 0x3F, 0x3F, 0x3F, 0x21, 0x21, 0x31, 0x30, 0x00, 0x20, 0x38, 0x1E, 0x07, 0x06, 0x06, 0x07, 0x07, 0x1F, 0x3F, 0x3C, 0x30, 0x01, 0x0F, 0x1F, 0x1F, 0x38, 0x30, 0x20, 0x20, 0x36, 0x3E, 0x3E, 0x02, 0x00, 0x00, 0x0F, 0x1F, 0x3F, 0x30, 0x20, 0x20, 0x20, 0x30, 0x1C, 0x0F, 0x00, 0x00, 0x00, 0x3F, 0x3F, 0x3F, 0x21, 0x21, 0x31, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x05, 0x01, 0x01, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };

/* start the main program */ void main() { OLED_Init(); OLED_DisplayLogo(IPL_Logo);

while(1); }

Few Patterns on OLED :

AshokStambh.png
MakeInIndia.png
177px-TajMahal.png
PremierLeague.png
Spartans.png

Downloads :

Download the complete project folder from the below link.