Author Topic: NHD-0420CW-AB3, SPI, Arduino Mega  (Read 2269 times)


  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
NHD-0420CW-AB3, SPI, Arduino Mega
« on: September 30, 2017, 07:05:11 PM »

I just picked up a NHD-0420CW-AB3 20x4 OLED display for a project that involves using the display with an Arduino Mega 2560. However, in my initial testing I've run into some problems and thus far haven't gotten the display to function. I don't know if it's a wiring fault I'm just not seeing, or a software issue, or a bad display, or a combination thereof.

First, the wiring configuration, in "display pin > Mega pin" format:

1 > GND
2 > 5VDC
3 > 5VDC
4-6 > GND
7 > 52 (SCK)
8 > 51 (MOSI)
9 > 50 (MISO)
10-14 > GND
15 > 48 (RESET)
16 > 49 (CS)
17-20 > GND

Have I missed something somewhere that I'm just plain overlooking?

Second, I've tried the sample code Newhaven has posted to its Github repository but found it immediately clashed with other devices on the SPI bus because the sample code bit-bangs its way through SPI instead of using the Mega's actual hardware SPI interface and Arduino's built-in SPI library, so I suspect that sample code will not be helpful in my application as I have to have compatibility with the SPI library for other devices on the bus in use to function. Is there a working snippet of code that does play well with the integrated SPI (and with other devices on the bus) and Arduino library?

Third, I noticed that the corner of the display became warm to the touch under the ribbon cable on the right side. I did note that there were concerns about this form back in 2015 but I thought those were addressed by connecting pins 2 and 3 to 5VDC when using a 5VDC source.

Any insight anyone can provide would be greatly appreciated!


I removed the Arduino from the project it's being used in (which was no small feat - I'm using 46 I/O lines, I2C, and SPI on it through a custom-made shield board) and uploaded only the sample library and basic "show some text" sample code from the Github repo, and still not getting anything from the display. It doesn't appear to power up at all. Beginning to think I got a bad one.
« Last Edit: October 02, 2017, 05:39:52 PM by WebMaka »


  • Newbie
  • *
  • Posts: 4
  • Karma: 0
    • View Profile
Re: NHD-0420CW-AB3, SPI, Arduino Mega
« Reply #1 on: October 07, 2017, 03:41:18 PM »
Replying to my own to add an update for anyone else that has a similar problem...

My SPI code was faulty. I got in touch with Newhaven, and was sent some updated code that woke up the display. I'm modifying the everloving snot out of said code and will post a library/demo once I have a good set of utility functions built.


NHD‐0420CW‐AB3 I2C Interface

Started by andersonpdBoard OLEDs

Replies: 1
Views: 6269
Last post January 23, 2015, 10:00:06 AM
by Michael_L
NHD‐0420CW‐AG3 Contrast question

Started by RichardRBoard OLEDs

Replies: 2
Views: 5935
Last post January 16, 2016, 09:52:02 AM
by RichardR
NHD‐0420CW‐AG3: blinking part of text?

Started by RichardRBoard OLEDs

Replies: 2
Views: 5666
Last post February 28, 2017, 03:27:02 PM
by BobG
NHD‐0420CW‐AG3 + I2C + PIC assembly code: trouble getting started

Started by RichardRBoard OLEDs

Replies: 4
Views: 8452
Last post December 17, 2015, 03:12:49 AM
by RichardR
NHD-0420CW-Ax3 Driver (w/demo) written for Parallax P8X32A/Propeller MCU

Started by avsa242Board OLEDs

Replies: 1
Views: 2974
Last post January 09, 2018, 04:48:45 PM
by Paul_B