1

I can't remember for the life of me how exactly I set up this screen in previous models, partially because the references I'm using in my code have different names from the pins on the Adafruit display.

My code identifies the following digital pins for the following display pins:

OLED_MOSI = 12
OLED_CLK = 11
OLED_DC = 10
OLED_CS = 8
OLED_RESET = 9

My Arduino is then attached from the following pins to those labelled on the OLED display as"

12 -> SDA
11 -> SCK
10 -> DC
8 -> CS
9 -> RES
5V -> VDD
GND -> GND

In other words, I am interpreting the following as being equivalent:

RES = RESET
SCK = SCK
MOSI = SDA

Is there anything within the information I've provided that is wrong / may cause the screen to malfunction?

Thank you very much in advance.

5
  • From what I can see, your code expects an SPI display but your display has an I2C pinout. You should either use I2C in your code or convert your OLED display to SPI (some displays allow that with relatively simple modifications). Otherwise, it's probably not going to work. – StarCat May 10 at 20:16
  • @StarCat It is common for chinese displays to use SCK and SDA for "4 wire" serial's Clock and Data (SPI SCK and MOSI). The presence of DC attests to that. – Majenko May 10 at 20:54
  • @Majenko, you’re probably right (and I might have seen these confusingly labeled displays myself) but the display in question is from Adafruit which I kind of hold to a higher standard. The documentation should make it clear. – StarCat May 10 at 20:59
  • If it's SSD1306 then that's what the documentation calls them. – Majenko May 10 at 21:05
  • @Tyler Wallentine: why don't you give us the Adafruit product number of this display? @ Majenko: the SSD1306 can be 'programmed' to any of 5 different interfaces/protocols: I2C, 6800 parallel, 8080 parallel, 3 wire serial and 4 wire serial (datasheet: cdn-shop.adafruit.com/datasheets/SSD1306.pdf). – PimV May 12 at 9:37
0
  • DC selects between Data and Commands.
  • CS is the Chip Select
  • SDA is the Serial DAta.
  • SCL is the Serial CLock.

These four together form what the documentation calls the "4-wire serial interface". It's not quite like SPI, owing to the presence of the DC pin (which is why it doesn't use SPI terminology), but close enough that SPI can be used to communicate with it.

In SPI the pin that sends data from the Arduino to the slave is known as the MOSI - Master Out Slave In. Some microcontrollers also call this SDO - Serial Data Out, where it's "out from the master's perspective".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.