Author Topic: Arduino demo code for running the NHD-0420DZW-AB5 OLED display via SPI  (Read 2303 times)


  • Newbie
  • *
  • Posts: 1
  • Karma: 1
    • View Profile
I worked out a few functions that allow the NHD-0420DZW-AB5 OLED display to be controlled via SPI on an Arduino.  The catch is that the 2-bit RsRW header means that communication requires bitbanging rather than using the SPI library, since the SPI library can only send 8-bit blocks.

The demo code will initialize the display, load up a splash screen, and then show animated arrows.  The CS pin is pin 9, and all the other pins are the standard SPI pins.  One note, bitbanging is much slower than the built in SPI bus (2MHz vs 20MHz), so you can use SPI.end() and SPI.begin() to toggle the SPI bus off and on (the SPI bus has to be off to allow the bitbanging function to work, and on to allow the SPI library to work).

The code can be found at:

If anyone has improvements, please feel free to create a fork.

  Ben Smith
« Last Edit: February 14, 2018, 07:11:46 PM by llamero »


  • Administrator
  • Jr. Member
  • *****
  • Posts: 58
  • Karma: 3
    • View Profile
Thanks for submitting your example code!  This is very helpful.


Blank Display on NHD‐C0220BiZ‐FS(RGB)‐FBW‐3VM

Started by SteveCBoard Character LCDs

Replies: 3
Views: 8565
Last post May 13, 2014, 12:04:36 AM
by SteveC
NHD‐C12864A1Z‐FSW‐FBW‐HTT display clears after draw

Started by EdAverillBoard Graphic LCDs

Replies: 6
Views: 10334
Last post November 07, 2014, 08:25:20 AM
by Michael_L
NHD‐4.3‐480272EF‐ATXL#‐CTP | FAN5333 | BBB | Nothing on the Display

Started by Alias_AliasBoard TFTs

Replies: 1
Views: 7293
Last post September 25, 2015, 03:09:24 PM
by Paul_B
NHD-C0220BiZ Sometimes Ignoring "Clear Display" Command

Started by dstoverBoard Character LCDs

Replies: 2
Views: 6285
Last post March 27, 2014, 05:41:27 PM
by Michael_L
Optical bonding Display to cover glass (dry film bonding)

Started by fourtraxBoard TFTs

Replies: 1
Views: 3470
Last post September 29, 2016, 08:35:00 AM
by Saurabh_B