I have this SSD1306 OLED display, and I'm trying to figure how to connect it to my NodeMCU with SPI. It looks like this:

enter image description here

I browsed several sites, and I could see that the SCK is the clock, SDA is MOSI and CS is Chip Select, but I just couldn't figure out what is DC and RES. Everywhere I looked it just says to connect it to some pin or another (depending on the board in discussion). What is the SPI functions of those pins?

  • \$\begingroup\$ Depending on which SSD1306 library you’re using, you might get away with wiring the RES pin to the processor’s RST pin and not waste an ESP8266 GPIO. DC does definitely need to be connected to a GPIO. \$\endgroup\$
    – StarCat
    Aug 12 at 6:41

DC is for telling the display if the SPI data packet is command or data.

RES is a reset pin for initializing the display after e.g. powering it up before you send any commands or data to it.

  • \$\begingroup\$ Ususally "DC" is called RS (register select), DS (data select) or some such. I don't know what "DC" is supposed to stand for other than direct current. Not the best abbreviation to re-invent. \$\endgroup\$
    – Lundin
    Aug 12 at 6:27
  • \$\begingroup\$ It’s Data/Command, according to the SSD1306 datasheet. \$\endgroup\$
    – StarCat
    Aug 12 at 6:43
  • \$\begingroup\$ @Justme, so I understand that this is not part of the SPI protocol. If so, why it is not used when using I2C to communicate with the display? \$\endgroup\$
    – YoavKlein
    Aug 12 at 8:31
  • \$\begingroup\$ @YoavKlein On this particular module the data interface is configured for 4-wire SPI interface so DC and RES are part of the interface for this display even if MCU only provides basic SPI so other pins need to be handled in software. The driver chip can be configured for 3-wire interface, but you would have to clock in the extra D/C bit before each data byte so not all MCUs easily provide 9-bit SPI interface. I2C bus needs an extra control byte sent first which has the D/C information so separate DC wire is not needed - it is used as the I2C address selector to have multiple displays on bus. \$\endgroup\$
    – Justme
    Aug 12 at 8:59

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.