SSD1322 OLED Display and Arduino Nano - Asking for help from A to Z

Hello everybody,
My name is Nicolas, I'm french and student in aeronautical engineering. That was for the presentation part!

I came here because I have a project in my mind, but arduino is a blurry world to me. I tried to learn alone with examples about OLED screens from the internet or the forum but it always gets specific very fast. I know how to code, I learnt web languages, Fortran, ADA, Python, a bit of C++, so algorithmic isn't a problem. I juste have the feeling that Arduino is really closer to hardware and I'm lost. This is why I came for your help!

First of all, my project. I built a HTPC based on a miniITX motherboard and a skylake CPU, the OS beeing W10 and the mediacenter software, KODI. Now that the hardware and software parts are fonctional, I focus on the homemade case I want around this system. This is where it leads to the OLED display: I would like a display on the case to show what is currently playing, time remaining, etc... I planned to communicate this information via serial usb to arduino with a python little program of my own.

For the display, I'd like to use a 256x64 white Oled display and I found this one: EastRising ER-OLEDM032-1W.
For the board, I found a Arduino Nano like board on Amazon:
Sodial Nano (I guessed it would be just same with the proper drivers to make it recognisable by the computer).
The first victory was to find that the u8g2 supports the SSD1322 controller of the display. But it's where my abilities stop.

As I'm a complete noobie in Arduino (and electronics in general - not to mistake with informatics), I would like to learn how to wire this display to an Arduino Nano.
I read that I had to use the 4-Wire SPI, but the display has 16 differents pins and I don't understand the meaning of the schematics available here: Interfacing.

Once it will be done, what should I write/do (or read) to display whatever I want to my display using the u8g2 library?

Please notice that everything here is for now theoretical as I'm finishing an internship in Canada, I will be home in a couple weeks. I just anticipated my need for information.

Thanks for reading me, I know it was quite long. I didn't want to come and only ask you to do all the work for me (still not far from that idea).

Have a nice day/evening,
Nicolas

Hi Nicolas

Tool Setup:

Hardware Setup:

  • OLED: SSD1322
  • Nano (BTW: link is broken in your first post)

Note that your OLED is a 3.3V device, while the Nano is a 5V device: You need a level shifter (voltage level translator from 5V to 3.3V) from Nano to OLED. Best is to use a 74HC4050 for this.

The next step is to create a connection table. You can also take some ideas from here: setup_tutorial · olikraus/u8g2 Wiki · GitHub, but it will probably look like this:

Function | Nano Pin | OLED Pin
---------+----------+----------
DC       | 3        | 14    
Reset    | 4        | 15
CS       | 5        | 16
Clock    | 13       | 4
Data     | 11       | 5

You get all this information from the OLED datasheet chapter 4 and from the SSD1322 datasheet chapter 8.1. You should verfy this table, I am not sure whether this connection table is fully correct.
Chapter 8.1 of the SSD1322 datasheet will also tell you what to do with the other pins of the OLED: Many of them have to be connected to GND.

On Nano side you can basically use any Pins, but it might be clever to choose SPI Clk (sclk) and SPI Data (MOSI) pins on the Nano.

Of course the five data lines must not be connected directly from Nano to OLED, but instead they have to be routed across the 74HC4050.

Two more thinks to consider:

  1. The OLED has to be put into 4-wire SPI mode
  2. U8g2 has to be put into 16 bit mode (see U8g2 FAQ)

Hope this helps. Let me know if you need more support.

Oliver

:o Also note these devices can be run parallel, 3 wire and 4 wire SPI.

There are 2 pads on the back that are either connected or disconnected. Off memory these are set to parallel!!!

The SSD1322 is my favourite OLED as has 16 color grayscale.

From the notes in my driver code (below)

SSD1322 EMOLED 256*64 4bpp driver

Supports SPI, SPI via DMA or SW SPI

Usually has 1 - 20 pins

The data mode I2C, SPI or 8 bit parallel is selected by 2 solder bridges on the back, need to check to see what the default is and change if
needed. In my case it was set for parallel so I had to desolder and resolder for SPI.

for SPI
1 = VSS/ground
2 = VDD/VCC +3.3v to +5.0v
3 = NC
4 = SCLK
5 = SDIN (MOSI)
6 = NC
7-13 = GND
14 = PIN_DC
15 = PIN_RESET
16 = PIN_CS

All other pins were grounded via a nice single blob of solder.

*NOTE - SPI_MODE3

Hello!
Thanks olikraus for your complete answer, and Hoek for answering to one question before I even ask :smiley: .
But because I am a pure noobie in Arduino, I still have questions.

I planned to buy the screen of the provided link, and I can choose a "Pin Header Connection-4-Wire SPI", I assume it means that the "jumper" is in the right position just as you said Hoek?

I corrected the link for the Nano board. I think it would do the job if I install the right drivers as explained here: Topic on the forum.
To understand why you chose these pins olikraus, I used this "map" of the Nano.

I then understood why wire the Clock and Data pins of the OLED to the D13 (SCK) and D11 (MOSI) but why the DC, Reset and CS pins wired to D3, D4, D5? Any particular reason?
Then I assume I can wire the pin 2 of the OLED(VBAT) to the 3V3 pin of the nano and all the ground connections to the ground of the nano.

Now, the problematic (for me) part of your answer olikraus, the level shifter part. I perfectly understand why you can't send 5V to a 3V input :grin: , but is there any other way that this level shifter alone? What I mean is that I need something really compact as it has to be included in a PC case, so I can't use any arduino board with all the holes. Do a board with pins exist that could do the same job? I found this on Sparkfun but it has only 4 channels and I have 5 to connect.
EDIT: I found this 8-bit bidirectional level shifter that seems perfect for me. Do you agree?

Thank you both for your answer, it starts to be clear for me and I hope for anyone in my condition.
Have a nice day!
Nicolas

Lyechee:
... but why the DC, Reset and CS pins wired to D3, D4, D5? Any particular reason?

Any GPIO pin will do the job, I just selected some random pins.

Lyechee:
Then I assume I can wire the pin 2 of the OLED(VBAT) to the 3V3 pin of the nano and all the ground connections to the ground of the nano.

Lyechee:
I found this on Sparkfun but it has only 4 channels and I have 5 to connect.
EDIT: I found this 8-bit bidirectional level shifter that seems perfect for me. Do you agree?

It probably should do the job. I personally had never used such boards. Another option might be to use a 3.3V Arduino board instead of a 5V board. This will avoid the level shifter. Examples are:

Feather 32u4 Adafruit Feather 32u4 Basic Proto : ID 2771 : $19.95 : Adafruit Industries, Unique & fun DIY electronics and kits
Pro Micro 3.3V Pro Micro - 3.3V/8MHz - DEV-12587 - SparkFun Electronics
MKRZero Arduino MKR ZERO (I2S bus & SD for sound, music & digital audio data) — Arduino Official Store

Oliver

Hello olikraus!

To the part "Then I assume I can wire the pin 2 of the OLED(VBAT) to the 3V3 pin of the nano and all the ground connections to the ground of the nano.", your answer meant I was right?

I think I will stay with the level shifter, as I can put it where I want with the screw holes, and the nano seems more common.
If I understand right the functionment of the level shifter, I have to connect VA to the 5V output of the nano and the VB to the 3V3 output of the nano. Then every input on the level shifter on the A side will be converted into a 3V3 output on the B side?
I obviously have to connect the GND pin to the ground of the nano, but what about the OE pin?
EDIT: If it can help, here is a documentation about the level shifter used by this board: TXS0108E

Finally, I have questions about the connection of the nano:
-is the serial protocol different with a USB3 than with a USB2 port?
-can the nano be alimented only with the USB port (remember that I plan to aliment the OLED with the nano 3V3 output

Thanks again!
Nicolas

Lyechee:
Hello olikraus!

To the part "Then I assume I can wire the pin 2 of the OLED(VBAT) to the 3V3 pin of the nano and all the ground connections to the ground of the nano.", your answer meant I was right?

Yes (I guess the word "yes" got lost in my previous answer)

Lyechee:
I think I will stay with the level shifter, as I can put it where I want with the screw holes, and the nano seems more common.
If I understand right the functionment of the level shifter, I have to connect VA to the 5V output of the nano and the VB to the 3V3 output of the nano. Then every input on the level shifter on the A side will be converted into a 3V3 output on the B side?
I obviously have to connect the GND pin to the ground of the nano, but what about the OE pin?
EDIT: If it can help, here is a documentation about the level shifter used by this board: TXS0108E

I am not a specialist on this, but I guess regarding VA/VB you are right. OE probably means "output enable", but better lookup the datasheet.

Lyechee:
-is the serial protocol different with a USB3 than with a USB2 port?

no

Lyechee:
-can the nano be alimented only with the USB port (remember that I plan to aliment the OLED with the nano 3V3 output

hmm i am not sure, what you mean.

Oliver

olikraus:
I am not a specialist on this, but I guess regarding VA/VB you are right. OE probably means "output enable", but better lookup the datasheet.

In fact I wasn't, the datasheet mentions for VA : "A-port supply voltage. 1.2 V ≤ VCCA ≤ 3.6 V, VCCA ≤ VCCB.", so I would have burned that thing if I had followed my plan!

For OE, that is the description by the datasheet : "3-state output-mode enable. Pull OE low to place all outputs in 3-state mode". But I don't understand what it means..

olikraus:
hmm i am not sure, what you mean.

I mean, is the USB port connected to the arduino enough to power the nano, the level shifter and the OLED?

Thanks,
Nicolas

In three state mode, usually there is a high-impedance state. In your case this is not required, so OE should be high.

And yes, USB can power all three parts.

Oliver

What do you me an by "OE should be high"?
Do I have to connect it to some pin of the arduino?

Thanks,
Nicolas

Lyechee:
What do you me an by "OE should be high"?
Do I have to connect it to some pin of the arduino?

No, i mean it should be connected to 3.3V or 5V directly (of course it could be the Arduino 3.3V or 5V Output). But you probably need to check the datasheet of that level shifter about what voltage is required for that pin, so that the logic detects "high".

Oliver

Hello!
Thanks again for your kind help, and sorry for the absence, I came back to France this week!
On the datasheet is written "Referenced to VCCA" so I assume it must be connected to the same powersource as VCCA.

This brings a question: how can I connect one pin of the arduino to multiple objects without a breadboard?

I have another question: I would like to add some RGB leds piloted by the arduino (~40).

It requires 5V input and 50mA per led so 2A in common. Does the micro usb give enough power for the arduino, the level shifter, the OLED AND the RGB strip? I can connect a 5V output from a molex cable from the computer power unit if needed.

Everything has been purchased and I'm looking forward to build everything and code the arduino!

Nicolas

This brings a question: how can I connect one pin of the arduino to multiple objects without a breadboard?

Why not using a solder iron?

It requires 5V input and 50mA per led so 2A in common.

This requires a good power source. The Arduino can only provide 100mA, but of course you can control other powersources with your arduino (MOSFETs are the usually used for this). But I guess you get better answers in the LED board of this forum.

Oliver

Hello!
Thanks for taking the time to answer and guide me!
I was very busy these last months but I'd like to go on with my project now.

I designed a scheme of the wiring I should do. I used fritzing and modified it on photoshop because I couldn't find a OLED (here a LCD) screen and a 20 pin level shifter (I used a 20pin chip and modified the image on photoshop).

The spec of the level shifter are these:
VA must be lower than VB
1.2<VA<3.6
1.65<VB<5.5
OE is referenced to VA (that's why I connected it to VA=3.3V)
The specs: http://www.ti.com/lit/ds/symlink/txs0108e.pdf

Can you guys tell me if I did something wrong?

Thanks,
Nicolas

If your not sure about the power capability of the NANO's 3.3v supply, there is a TX0108 module available that has built-in adjustable LDO regulator which can supply more current at 3.3v. The module is made by BLKBOXme, part number BB-0108B. I sourced one from eBay.

The module's regulator IC is adjustable by a small pot, but also pin compatible (SOT23-5) with fixed 3.3v LDO regulator. I used this module but substituted a Texas Instruments TLV70033DDCR regulator for fixed 3.3v to supply a 2.42" OLED. Small form factor of SOT23-5 makes the substitution more difficult.

Per the product page, Uno's 3.3v is only good for 50mA. Nano's product page doesn't specify.

I use exactly the same level shifter but on mine, one ground is noted OE. Olikraus told me to put it "high" and as it is referenced to VccA, I wanted to connect to 3.3V.

So now, OE must be connected to ground or 3.3V?

You mean the chip, not the module. There are other modules on eBay, but the one from BLKBOXme module has a built-in LDO adjustable regulator and also takes care of pulling the TX0108B's OE pin high with Vout (e.g., 3.3V if adjusted to that value).

The all bi-directional output are enabled by pulling OE pin high. You can pull the OE pin high with 3.3v, as the Texas Instruments datasheet says OE internal circuit is referenced to Vcca.

http://www.ti.com/lit/ds/symlink/txb0108.pdf

I already bought my level shifter so I don't want to buy another one if mine can do the same :slight_smile:
I will solder pins together to be able to connect all these pins to the ground pin of the arduino this evening and I will finally know if it works!

Aaaaaaand it doesn't..
I wired everything exactly like the picture I showed before.
This is the code I uploaded:

#include <Arduino.h>
#include <U8g2lib.h>
#include <SPI.h>
#include <Wire.h>

U8G2_SSD1322_NHD_256X64_1_4W_HW_SPI u8g2(U8G2_R0, 13, 11, 5, 3, 4);

void setup(void) {
  u8g2.begin();
}

void loop(void) {
  u8g2.firstPage();
  do {
    u8g2.setFont(u8g2_font_ncenB14_tr);
    u8g2.drawStr(0,24,"Hello World!");
  } while ( u8g2.nextPage() );
}

The upload is done without error but nothing shows on the screen.

(Before anyone asks, I did put u8g2 in 16 bit mode)

Any idea?

EDIT: I took a look at the interfacing datasheet of the screen and what I understood is that I should have resistors soldered on the R19 and R21 places.
Or on mine they are soldered on the R18 and R20 places, what corresponds to the 6800 parallel mode.
Here is a picture:

Can anyone confirm?
I asked them a 4-wire SPI mode when I bought it, I will ask them a refund.

Lyechee:
Or on mine they are soldered on the R18 and R20 places, what corresponds to the 6800 parallel mode.
Can anyone confirm?

Confirmed, looks like 6800 mode.

Oliver