128x32 OLED - Would like some info on SPI vs i2C

Hi all,

I am building a custom car instrument cluster which features 3 Teensy Arduinos, some servos and a 128x32 OLED display. Presently I have display duties running on a Teensy 3.2, and it's one of these running i2c.

The problem I'm having is that the refresh rate is very slow, and even running 400k clock speed, you can see in this video that it's slow and makes things look juddery.

Doing a little reading it seems to be an issue with i2c and this is an inherent issue. So my questions are:

  1. Would SPI give me the speed increase I need?
  2. What are the minimum number of pins I would need to use to run SPI (if it is faster)
  3. How do you run such a display? Is the same SD1306 library applicable?
  4. Can anyone recommend a display to use? I used the one shown above as it has a nice small footprint which I need in order to integrate it correctly.
  5. Anything else I should know?

Thanks in advance!

Edit: Looking for some SPI displays I note these, and they seem to use different chipsets (SSD1307 & SSD1322 - how does that affect things?)

Display 1
Display 2
Display 3

Yes, SPI is faster than 400kHz I2C. But the I2C display is faster than your eyes can manage.

Please post your sketch. You are doing something strange. That sketch would look exactly the same with SPI or I2C. The slowdown is due to something else.

You can put many Slaves on the same I2C bus. Same 2 pins for N I2C slaves.
You can put many Slaves on the same SPI bus. N + 3 pins for N SPI slaves.


Thanks David - sketch attached for the OLED board

DashNoCAN.ino (36.7 KB)

First off. I pressed . Then your sketch was indented perfectly. Easy to follow the logic.

Your individual functions look fairly normal.

Your loop() also seems normal. However:

    if (millis() - lastmillis > 500) { //Update every 1/2 second.

This is probably what makes everything look clunky. The actual screen display.display() is very fast.

I suggest that you alter the 500. Observe the result.

Yes, you only need to update things like Odometer or Temperature once a second.
But things like RPM need a faster response.
I suggest that you call the checkdisplay() more often for some modes.

As a general rule. Only re-display if the data has changed.

A Teensy3.2 has more than enough processing power. You will not notice the difference between dumb and intelligent re-display. Keep it simple.


Hi David,

You hero! I totally forgot about that line, I put it in to test something else. What a muppet! Thanks so much for spotting it!