OLED!!!

Hey all,

Having seen a nice-looking teensy OLED display (0.96”) somewhere, I decided to get one too, so I ordered an SPI version off of Electrodragon (no, I am not marketing for them). The instructions on their Wiki were somewhat vague, so I decided to post a short version here for whom it may concern:

1) The modules are apparently 5V-tolerant and are rated to work between 2.7V to 5.5V, so I’m figuring you can use this with a Pi/other SBC as well.

2) The line called “D0” is actually the SPI SCK line, which for hardware SPI on the Arduino Uno is Pin 13

3) The line called “D1” is actually the SPI MOSI line, which for hardware SPI on the Arduino Uno is Pin 11

4) The other lines (RES, DC and CS) can be assigned arbitrarily and specified in the sketch.

To actually drive the display, I used the Adafruit_SSD1306 library (which depends on the Adafruit_GFX library) so you’ll want to grab those using the Arduino IDE library manager (which is really nifty actually). Once that’s done, you’ll want to run one of the provided example sketches.

I followed the wiring given at the top of the ssd1306_128x64_spi example and tried to upload that, then got some error about having to fix the Adafruit_SSD1306.h file – that’s expected if you have a 128x64 OLED, so you’ll need to find the file (it should be in your “libraries” folder in your sketch directory i.e

<sketch directory>/libraries/Adafruit_SSD1306/Adafruit_SSD1306.h

And comment/uncomment the appropriate #define for your particular OLED. Once that was done, I hit the “Upload” button and it worked!

But I wasn’t satisfied. Because I wanted to get it working with hardware SPI instead.

So I followed the instructions in the example sketch once again, but simply adjusted the wiring for D0 and D1 as described above, and since the other pins were specified in the sketch nothing else was needed. Uploaded that and it worked equally as well.

Happy OLEDing!

Comments

Popular posts from this blog

Enabling SPI1 on the Raspberry Pi B+/Zero/2/3

Bitbanging SPI on the Raspberry Pi (via spi-gpio)

Getting Started with Logic Analyzers and Pulseview