Using an I2c 128x64 LCD

I’m new to Arduino (worked with BASIC Stamp and Pic microcontrollers in the past). I’m wondering just how much work is required to set up a 128x64 single color OLED display. If I’m understanding correctly all I have to do is download a library with my display’s info on it and that handles setting up the display in a couple simple lines of code so all I really have to do is code which pixels are on and when. Is this correct? The basic stamp and pic’s don’t have anything that resembles a library and I have to code it all out manually. I’ve seen commands like “DefineScreen” used a lot that I wouldn’t have had access to. These are provided by the library, correct? The display I’m looking at: HiLetgo 1.3" IIC I2C Serial 128x64 SSH1106 SSD1306 OLED LCD Display LCD Module for Arduino AVR PIC STM32: Industrial & Scientific

The microcontroller I plan to use: FTCBlock Pro Micro ATmega32U4 5V/16MHz Module Board with 2 Row pin Header for arduino Leonardo Replace ATmega328 Pro Mini (1pcs): Industrial & Scientific

Is this correct?

More or less. The first thing you need to do is run a couple demo programmes that are surely included in the library. That way you will get a better understanding of what happens next.

Note that several libraries can probably work with that display. The Nano, and practically any other Arduino, will be fine with it.

Awesome. I’ll jump on the parts in a few days and give it a shot. I just remember it being a nightmare getting one of these going on the basic stamp. Took up over half the memory to initialize the display and display one image.

. I just remember it being a nightmare getting one of these going on the basic stamp.

No surprise to hear that. I found Arduino so much easier.

My end goal with this project is to display live voltage and current info for my off grid power system (battery voltage, solar charge current, generator current and load current), and eventually have the ability to shut my generator off automatically when the batteries are full.

That sounds like just the sort of thing Arduino is really useful for. Your display is similar to SSD1306 and may use the Ada text libraries. If so, you might find the following useful - particularly in view of the limited memory of a Uno.

Any recommendations on a similar black and white name brand OLED i2c or SPI and around 1 to 2 inches for under $20? I’m living on a limited budget but if I can afford it I’d get something well documented and known to be good.

The SSD1306 that I use has no brand that I am aware of, and no need to either. It is 0.96" single colour (white on black) 128x64 and costs about $3. These things are popular on this forum. Other noteworthy ones are on
ebay 392473497544
but I don't know anything about them.

Here is one of these guys, in my case a 12864 OLED, SSD1306 based. It was sold to me as a color TFT but it appears to consist of two strips: a 12816 yellow OLED upper strip and a blue OLED lower 12848 strip. That does not matter at all since the device handles like a 12864. This one has 7 pins: GND, VDD, SCK, SDA, RES, DC and CS. Note that most OLED displays are 3.3V devices.
I am using Olikraut’s u8glib to run my sketches. Here is a sample, named ‘bouncer’:

// OLED_128x64_bouncer.ino
// for use with SSD1308 Monochrome OLEDs
// this sketch by Floris Wouterlood
// august 20, 2019
// public domain

// libraries
    #include “U8glib.h”

// pins on the Arduino OLED_128x64_bouncer.ino
    #define OLED_SCK 13
    #define OLED_MOSI 11
    #define OLED_CS 10
    #define OLED_DC 9
    #define OLED_RES 8

// U8GLIB constructor OLED display

    int x=10;
    int y=10;
    int updown=3;
    int leftright=2;
    int multiplier=1;
    int setdelay=11;
    int c_radius=2;

void draw(void) {

    multiplier = random (1, 3);


// bouncing on one of four the walls
    if ((x>128) && (leftright=1)){

     if ((x<0) && (leftright=-1)){

    if ((y>64) && (updown=1)){

    if ((y<0) && (updown=-1)){



void setup(void) {
    pinMode (3, OUTPUT);
    u8g.setColorIndex(1); // Instructs the display to draw with a pixel on. 0 = OFF, 1 = ON

void loop(void) {
    u8g.firstPage ();
    do {
          draw ();
          } while( u8g.nextPage() );

     delay (10);

morfe about these remarkable displays on my website: Connecting a 128×64 OLED display with SSD1306 driver to an Arduino with a SPI interface – thesolaruniverse

Looks like the SPI version of the exact display I had picked. Thanks!

Unless you know exactly what you intend to do, the two colour displays are likely to be more of a liability than an asset. There are several versions around and I believe all are available in I2C and SPI.

Ive done a little more research. The libraries will make it super easy to set up and send text to the screen. Also I switched to a SSD1308 based display so I can refer back to the good info provided on this thread. I’d also like to be able to turn every pixel on or off at the same time, to flash the whole screen as a single light in sync with a buzzer to alert me of any errors. I’m guessing I’m going to have to code that part from scratch? Or I’ve heard I could modify a special character I don’t use in the font to be every pixel on and display that character repeatedly across the whole screen for a similar effect?

flash the whole screen as a single light in sync with a buzzer

I'm sure that, or something like it, is possible with a graphics display. I only use text. The only problems is that writing to every pixel takes time, and something a bit more sophisticated might be in order.

If I could trick it into displaying a solid box as a character that’d be close enough for me. Even if they’re separated by black lines it’ll still draw my attention.

For coding every pixel, I’m sure a loop could be programmed that’d send the same value to every one relatively easily, but I’d prefer to work with text if possible.

Maybe fill the screen with bold font capital Xs.

You just need to be careful, particularly when using text in a graphics library. In the picture below, the large 7-segment font slowed the display dramatically.
Two Speed graph sm.jpg

Two Speed graph sm.jpg

A solid box would be in Olikraus' U8glib functionality a drawBox ( x,y, width, height) call

see userreference · olikraus/u8glib Wiki · GitHub


This just keeps getting easier! Thanks. Glad I decided to look into Arduino again. I see now why people don’t like the basic stamp. Personally I’d still prefer the basic stamp (purchased cheap and used or acquired free of course) for super simple stuff like a flashing bicycle tail light but I’ll never drive an LCD or any other display or serial interfaced device with one again.

For the font and speed issue, would using only one font across the whole screen fix it or do some fonts just take longer to display than others? Also what screen is that? I like it and might want one later on. Can’t quote for some reason.