Newhaven Products > OLEDs

Arduino demo code for running the NHD-0420DZW-AB5 OLED display via SPI


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


[0] Message Index

Go to full version