Micropython driver for the 128x64 small (0.96) OLED display

Updated 16 November 2018

0.96 Inch 128*64 OLED Module 4 Pin IC I2C IIC Communication


  • Any font available using Dot Factory
  • Fonts / images stored on file so very little RAM used
  • Specifically for the ESP8266



The purpose of writing this was because the other current drivers hold the font information in RAM and on the ESP8266 this is a precious resource. The option used here is to store the font on file (in flash) and use file random access to select then display a character when needed. In this way the RAM needed is that of a single character rather then the whole character set.

I know what you are thinking, this will be very slow - NOT so. It is slower of course but perfectly usable for text information.

Quick Start

Extract the zip file onto an ESP8266. NOTE there must a fonts directory containing the fonts on the ESP just as the layout on the zip file.

On the ESP type:

import start

Create Fonts

Step 1

Dot Factory version 0.4.1 is used to create the font with the bits rotated by 90 degrees:

This is the settings used to create the font. This display is unconventional in that the bytes written are aligned side by side horizontally and hence the need to rotate 90 degrees.

The output for 'A' is sown here, when written to the display this will be 16 bits (2 bytes high) and so for this display that is 8 bytes high, 4 rows of text can be displayed. The only font I can find that is legible (just) 1 byte high is courier 7pt. If the font has 3 bytes in a row that that will be 3 bytes high etc. In this case there are 7, 2byte rows and so it will be 7 pixels wide.

Dot Factory also outputs a character map which is used to locate the character within the file and display the font.

Step 2

Save the output using save As.. This will generate a .c and a .h file, the .h file can be discarded.

Step 3

Generate a binary file. This could of course be done on the ESP8266 however, the whole point of the exercise is to save resources so it is better to do as much processing externally as possible.

There is a stand alone GUI Python3 program that will do the conversion, this is called, run as follows from a command window:


(or python but it was written for python version 3, see below is the stand alone command line program that may well run under python 2)

This pops up the dialog, just select the .c file and it will create the .fon binary font file which can be used with the driver

The has the following files: This is the GUI as in the image above
fontConverter.fbp This is the wxFormbiulder file so you can change the look easily This is the file output from wxFormBuilder which is all of the frame, GUI This does the work and can be run stand alone if required Driver files for thedevice

Step 4

Download the binary files on to the ESP8266 flash and use from there.

Create Images


Step 1

Copy the contents of this zip file that contains Dot Factory, and a sample image called 127x63.bmp into a directory.

Step 2

Double click TheDotFactory.exe , the configuration file (OutputConfigs.xml) is already in the directory and there is no need to go through the settings.

Click generate and then File>Save as files

Step 3

Two files are generated 127x63.c and 127x63.h, the .h file is not needed.

Open a command window containing and type

python3 -b 127x63.c 127.63.bin or 
python -b 127x63.c 127.63.bin

The program expects Python version 3. This will generate the 127x63.bin that can be sued with the ESP8266

Further Information

The following is for background information and is not needed to convert bmp files, simply follow the steps above.

The settings for Dot Factory are different though

Here there is no rotation and the byte layout is ColumnMajor that gives a height of 8 bytes and a width of 128 bytes, the output is very wide.

This is a partial image of a typical output just so you know you are on the right track.