Displaying Images and Icons on OLED Using 8051

Published

Introduction: Displaying Images and Icons on OLED Using 8051

About: We make Embedded Design tools, boards, sensors, peripherals, DIY kits and awesome tutorials. We also help companies and individuals prototype embedded electronics.

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.

Step 1: Image Resize :

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.

Step 2: Bitmap Using Lcd Assistant :

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.

Step 3: List of Components/Module Required :

Step 4: Hook Up :

Make the connections as per the above fritzing diagram.

Step 5: 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); }

Step 6: Few Patterns on OLED :

Step 7: Downloads :

Download the complete project folder from the below link.

Share

    Recommendations

    • Clocks Contest

      Clocks Contest
    • Planter Challenge

      Planter Challenge
    • Make it Move Contest

      Make it Move Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    Comments