Display Your Photo on OLED Display
Introduction: Display Your Photo on OLED Display
The tiny 0.96 inches OLED display is the most popular among the Arduino fraternity for displaying data like room temperature, humidity, and text messages. Have you ever thought of displaying your own photo on the display! Yes, it's possible. In this Arduino-based project, we learn to display any photo on this small display. The above photo you are seeing is of my favorite Indian actress <PERSON>, if you have seen her in movies you would be able to recognize her. Anyway! Let us start the fun.
Step 1: Make Connections
The SSD1306 OLED Display communicates over I2C or SPI protocol. The one I have used for this project is I2C enabled so make connections with Arduino as shown in the image. Connect SCL of the display to A5 pin of the Arduino, SDA to A4 pin, GND to ground, and Vcc to +5V pin.
Step 2: Install Libraries
Now you need to install some libraries. One is adrafruit_SSD1306.h and the other is adafruit_GFX.h. Open your Arduino IDE and go to Sketch>Include Library>Manage Libraries. We install both libraries one by one in the next step.
Note: While installation process of these libraries if you come across a message prompt asking to install the "Adafruit BusIO", then press the "Install all" button to install also all the missing dependencies.
Step 3: SSD1306 Library
Type "SSD1306" in the search box and install the SSD1306 library from Adafruit. 158
This installs the library for both the I2C and SPI protocol versions of the OLED display. As you can see in the image it will show "Installed" after successful installation.
Step 4: GFX Library
Now after successfully installing the SSD1306 library type "GFX" in the search box and install this graphics library as well.
Now all the necessary libraries have been installed restart your Arduino IDE and move ahead to the next step.
Step 5: Convert to Bitmap Image
It is expected you would have decided which image you want to display on the OLED display. In my case, I have displayed my favorite actress image. You need to convert your image into monochrome bitmap format. Open your image in any image editor like "Paint" if you are a Windows user. Resize it to 128x64 or 128x32 to match your display resolution whichever you have.
Now go to File>Save as>BMP Picture, select Monochrome Bitmap from Save as type menu, and you are done with this step.
Step 6: LCD Image Converter
You have entered the game-changer step of the project. Here we convert our bitmap monochrome image to C Language Array. For this, we use lcd image converter tool. You can download from this link LCD Image Converter
Run the program press the "New Image" give it a name. Go to Image>Import and select the bitmap image you have created in the previous step.
Step 7: Convert Image to Data Array
It's time to do some settings and convert our bitmap image into a C language data array, hope you would be acquainted with Arrays.
First, go to Options>Conversion, and in the Prepare tab select the following:
Preset: Monochrome
Type: Monochrome, Threshold Diether
Main Scan Direction: Top to Bottom
Line Scan Direction: Forward
Second, go to the Image tab and select the following options:
Check: Split to rows
Block size: 8-bit
Byte-Order: Little-Endian
Click OK.
Now in the main menu, go to File>Convert, give the file a name, and a new file with .C extension will be created.
Step 8: Array in the C File
Open the .C extension file you have created in the previous step with any text editor like notepad. Here we have magic numbers of data in the form of an array.
Here is the raw code of my C file. 175