SSD1306 sometimes works, sometimes not!

Be kind - I am just starting out with Arduino and C++ (though I have a background in microelectronics, Motorola Assembler, and electronic design).

My objective is a little telemetry project from sensors on a Mini, over serial, to a Uno and display the sensor values on a SSD1306 OLED. I am familiarizing myself with things as parts come in and the Uno and the Sunfounder SSD1306 display came in Monday.

  1. After connecting the display to the I2C, I downloaded ssd1396_128x32_i2c (from and it doesn’t work as it should - it shows the ‘star field’ without movement and flashes to a white screen after a long delay - then back to the star field.

  2. I started stripping parts out of the sample program and it started displaying properly. (I SHOULD have kept a copy!!!)

  3. I started writing my own display program (in the same session) to start with the Adafruit splash screen and then go to a number display. It worked at first.

  4. When starting up again for the next work session, I am right back to Step 1 and nothing is working - I just get the stationary ‘star field’ as if it is just displaying what is stuck in the display memory and not getting new display data.

The fact that it DIDN’T work at first, started WORKING when I was playing around with the demo program, WORKED with my display program, and the DIDN’T work on the next session for either program leads me to suspect that there was some command/initialization used when I was playing around that ‘enabled’ the display that was missing before and since.

This is driving me NUTS! Something is flaky here somewhere (other than ME!) but I have no idea what! I am ready to scrap everything and start all over.


Is this the display you have?

If so, then it has no 3.3V regulator onboard and hence it should be powered from 3.3V and NOT from 5V. Try that and report back.

Go back to the original Adafruit code rather than a hacked version because that works fine on these displays.

That is the display I have and I AM running it on 3.3v. I AM running Adafruit code.

I discovered there is a problem in the Arduino/SSD1306 interface or handshaking. I posted this today on the Adafruit forum:

Okay, this is f’ing WEIRD!
When I open (in IDE), compile, and upload the ssd1306_128x32_i2c to the Arduino Uno, I get only a fixed ‘star field’, a VERY long pause, a flash to a light screen, and then back to the non-moving ‘star field’.
After troubleshooting this for THREE DAYS I have come to the conclusion that there is an initialization problem, probably related to the I2C interface or the hand-shaking between the Uno and the display.
The reason I suspect this is because if I upload the ssd1306 test program, wait for the ‘star field’, then disconnect and reconnect the 3.3v pin to the display (min about 5 Second of power off to the display) while holding the Uno’s reset button and then release the reset button, the display executes the program correctly.
After doing this ‘display reset’ once, I can upload the program again and it works correctly only IF the Uno and display have NOT been powered down. If it has been powered down, I have to go through that reset procedure I described above.

I got a response from Sunfounder customer support and apparently they had a batch of defective boards and will be replacing mine.

OK, might be a good idea to clarify the issue on the Adafruit website too and point out it was not an Adafruit product.

Unfortunately the OLED displays that do not have a dedicated reset signal are susceptible to these problems if they do not have a properly designed power-on reset circuit, don't be surprised if the replacement display behaved in exactly the same way.