Author Topic: Can't get SSD1306 OLED working on custom PCB  (Read 5161 times)

0 Members and 1 Guest are viewing this topic.

Offline Majek OndrovicTopic starter

  • Contributor
  • Posts: 14
  • Country: us
Can't get SSD1306 OLED working on custom PCB
« on: April 06, 2019, 07:33:53 am »
Hi everyone,

I'm having a lot of trouble with some OLED displays on a custom PCB-- they are the SSD1306 128x64 0.96" variety and I need to use them with I2C and 3.3v. I ordered them off Aliexpress here (perhaps that was my mistake!). They didn't post a data sheet so I decided to copy the Adafruit OLED Schematic and adapt it...Unfortunately I screwed up a few things in translation.

I attached the original schematic which I had made through JLCPCB. I realized that I forgot to connect /RES and /CS, as they appear to be pulled up in the Adafruit schematic. I tried bodging them together with the DC/I2C_SAO pin next to them which had a 10k pull-up, but I don't know if I'm allowed to join these together or if they need individual pull-ups.

I also forgot pull-ups on the I2C bus so I bodged in some 4.7k resistors. Still no luck.

Then I checked some data sheets like this one from buydisplay.com and noticed different values for the capacitors, so I changed out for the new caps and still it did not work. I also attached the schematic with changes that reflect my bodges/fixes. It seems like it could be a power issue, because if I read voltage at the charge pump capacitors I get 2.5v on one side and less voltage on the other side which drains away as I meter it..

What's so frustrating is that the rest of my circuit functions as expected, and it runs these I2C pre-made OLEDs with no issue. I'm pretty lost at this point. Did I get a bad batch of OLEDs? I want to get new PCBs asap but I feel there may still be mistakes in the design  :(

Thanks in advance for your help and guidance!!
 

Offline bson

  • Supporter
  • ****
  • Posts: 2270
  • Country: us
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #1 on: April 06, 2019, 11:34:23 am »
According to the datasheet, C1P,C1N,C2P,C2N should be left unconnected.

VCC is the panel driving supply and can't be less than VDD, but yours doesn't seem to be connected to any supply at all?

Iref sources VCC-2.5V internally and the resistor should provide 12.5µA of sink current for 100µA drive current at a contrast value of 255.  Apparently this is normal?  So the value of the external resistor between GND and the Iref pin should be R=(VCC-2.5)/12.5µ.  Conversely, the 390kΩ on the schematic suggests a VCC of 7.375V... does that look right?  If VCC were 12V this should be 760kΩ.
« Last Edit: April 06, 2019, 11:37:52 am by bson »
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9954
  • Country: nz
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #2 on: April 06, 2019, 11:37:53 am »
C1P,C1N,C2P,C2N looks suspiciously like a voltage doubler to run LEDs,

I agree, no power connected to VCC looks wrong.
You need to be sure this is correct.
It's possible the chip has a mode where it internally produces a regulated VCC from another rail. But also possible it needs a VCC and this is why its not working.
« Last Edit: April 06, 2019, 11:41:13 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline bson

  • Supporter
  • ****
  • Posts: 2270
  • Country: us
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #3 on: April 06, 2019, 11:40:33 am »
Also, I'm not sure you can (or should) just tie RES# high.  The datasheet specifies a power-on sequence:

Power ON sequence:
1. Power ON VDD
2. After VDD become stable, set RES# pin LOW (logic low) for at least 3us (t1) (4) and then HIGH (logic
high).
3. After set RES# pin LOW (logic low), wait for at least 3us (t2). Then Power ON VCC.(1)
4. After VCC become stable, send command AFh for display ON. SEG/COM will be ON after 100ms
(tAF).
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2550
  • Country: us
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #4 on: April 06, 2019, 02:32:30 pm »
Well, I don't get it.  The first schematic seems to match the Adafruit product using the SSD1306.
You can compare:

Edit-  Sorry. I totally missed your comment of using the Adafruit design.

   
« Last Edit: April 06, 2019, 10:10:49 pm by MarkF »
 

Offline LateLesley

  • Frequent Contributor
  • **
  • Posts: 322
  • Country: scotland
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #5 on: April 06, 2019, 02:49:19 pm »
I just looked up the ssd1306 datasheet. https://www.crystalfontz.com/controllers/SolomonSystech/SSD1306/

If you go to page 13 of the PDF, you will see that it tells you the CS# (Which will be Chip Select) is an Active LOW pin, meaning the display will only be selected when that line is LOW.

Tie the CS# pin to Gnd instead, and see if that gets it to work.

Hope that helps.
 

Offline dmills

  • Super Contributor
  • ***
  • Posts: 2093
  • Country: gb
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #6 on: April 06, 2019, 04:54:43 pm »
Actually, you will find that the CS line is needed from the micro if you are doing SPI, in the Adafruit circuit, CS is pulled up to 3.3V by R4 and pulled down by the control processor thru D1, in much the same way the D/C and reset control lines are handled.

This is a hack to make their module work with old school 5V logic levels as well as modern 3.3V ones, but you will need those signals in any event.

Regards, Dan.
 
The following users thanked this post: Majek Ondrovic

Offline Majek OndrovicTopic starter

  • Contributor
  • Posts: 14
  • Country: us
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #7 on: April 06, 2019, 06:13:52 pm »
According to the datasheet, C1P,C1N,C2P,C2N should be left unconnected.

VCC is the panel driving supply and can't be less than VDD, but yours doesn't seem to be connected to any supply at all?

Iref sources VCC-2.5V internally and the resistor should provide 12.5µA of sink current for 100µA drive current at a contrast value of 255.  Apparently this is normal?  So the value of the external resistor between GND and the Iref pin should be R=(VCC-2.5)/12.5µ.  Conversely, the 390kΩ on the schematic suggests a VCC of 7.375V... does that look right?  If VCC were 12V this should be 760kΩ.

My limited understanding was that there are two modes of power, one where Vcc is supplied externally which is 9v for driving the OLEDs and VDD is supplied separately as the logic voltage level (3.3v?).
and the other is where Vcc is generated by an internal DC/DC voltage converter so the whole system can be supplied by 3.3v

Each has it's own hookup, I attached screenshots of those schematics

I wish I could find the schematic for these pre made OLED pcbs that I have working. They work with only ground, 3.3v, SCK and SDA

« Last Edit: April 06, 2019, 06:20:12 pm by Majek Ondrovic »
 

Offline Majek OndrovicTopic starter

  • Contributor
  • Posts: 14
  • Country: us
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #8 on: April 06, 2019, 06:18:47 pm »
Actually, you will find that the CS line is needed from the micro if you are doing SPI, in the Adafruit circuit, CS is pulled up to 3.3V by R4 and pulled down by the control processor thru D1, in much the same way the D/C and reset control lines are handled.

This is a hack to make their module work with old school 5V logic levels as well as modern 3.3V ones, but you will need those signals in any event.

Regards, Dan.

Yeah I think you're totally right- I was confused because I'm only implementing the I2C and not SPI, but it probably won't work in either case unless CS is low.

I will try that!
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2550
  • Country: us
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #9 on: April 06, 2019, 10:15:05 pm »
May I ask an unrelated question?

Are the raw display flex contacts something that can be soldered by hand?
I was actually thinking of laying out my own PCB before I ran across this thread.
 

Offline Psi

  • Super Contributor
  • ***
  • Posts: 9954
  • Country: nz
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #10 on: April 06, 2019, 10:34:45 pm »
May I ask an unrelated question?

Are the raw display flex contacts something that can be soldered by hand?
I was actually thinking of laying out my own PCB before I ran across this thread.

The metal ends on the flex LED display above can be soldered/unsoldered by hand yes.
It's a little more difficult than normal soldering and you have to be careful since it's flex and easier to damage.
But yes, if a flex cable has those solder covered pads on the end then they're solderable using an iron.

However you cannot cut a flex and then solder it to something. It must have an end that was prepared for soldering with exposed metal on both sides.
« Last Edit: April 06, 2019, 10:41:01 pm by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2550
  • Country: us
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #11 on: April 07, 2019, 12:39:50 am »
May I ask an unrelated question?

Are the raw display flex contacts something that can be soldered by hand?
I was actually thinking of laying out my own PCB before I ran across this thread.

The metal ends on the flex LED display above can be soldered/unsoldered by hand yes.
It's a little more difficult than normal soldering and you have to be careful since it's flex and easier to damage.
But yes, if a flex cable has those solder covered pads on the end then they're solderable using an iron.

However you cannot cut a flex and then solder it to something. It must have an end that was prepared for soldering with exposed metal on both sides.
Thanks.
Just concerned because some of the photos look like the flex comes out to the edge of the pad (i.e. siimilar to a PCB edge connector) and would require wave soldering.
 

Offline Majek OndrovicTopic starter

  • Contributor
  • Posts: 14
  • Country: us
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #12 on: April 07, 2019, 01:36:10 am »
So I stumbled onto a schematic (see attached) for the pre-made OLEDs with PCB like you find on Amazon or AliExpress. I'm going to change my design to better match this one.

I also found another I2C hook-up guide for MCUs that seems to concur with most of the other schematic.

What I don't get is this reset circuit-- It has a 10k pull-up but also a diode and a filter cap? If RST/RESET is an input, and not interfacing to the MCU, what's the point of this?
 

Offline Nusa

  • Super Contributor
  • ***
  • Posts: 2416
  • Country: us
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #13 on: April 07, 2019, 02:36:16 am »
RST needs to be held low long enough to be recognized when power is first applied, and then allowed to go high. The capacitor is more than just a filter in this case.
 
The following users thanked this post: Majek Ondrovic

Offline Majek OndrovicTopic starter

  • Contributor
  • Posts: 14
  • Country: us
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #14 on: April 07, 2019, 02:56:27 am »
RST needs to be held low long enough to be recognized when power is first applied, and then allowed to go high. The capacitor is more than just a filter in this case.
Aha! very interesting, thank you. I'm glad I asked
 

Offline Nusa

  • Super Contributor
  • ***
  • Posts: 2416
  • Country: us
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #15 on: April 07, 2019, 05:16:11 am »
RST needs to be held low long enough to be recognized when power is first applied, and then allowed to go high. The capacitor is more than just a filter in this case.
Aha! very interesting, thank you. I'm glad I asked
For extra credit, see if you can figure out what the diode is for.
 

Offline bson

  • Supporter
  • ****
  • Posts: 2270
  • Country: us
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #16 on: April 07, 2019, 07:35:07 am »
My limited understanding was that there are two modes of power, one where Vcc is supplied externally which is 9v for driving the OLEDs and VDD is supplied separately as the logic voltage level (3.3v?).
and the other is where Vcc is generated by an internal DC/DC voltage converter so the whole system can be supplied by 3.3v
Yeah, it apparently has a charge pump.  When this is used C1+/C1- and C2+/C2- are used for the capacitors for it.  It's powered by Vbat and needs to be enabled with command 8Dh.

It produces 7.5V, which means Iref is 5V, and to produce 12.5µA the external resistor needs to be 400k.  I supposed 390k is close enough.

 
The following users thanked this post: Majek Ondrovic

Offline bson

  • Supporter
  • ****
  • Posts: 2270
  • Country: us
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #17 on: April 07, 2019, 07:46:06 am »
So I stumbled onto a schematic (see attached) for the pre-made OLEDs with PCB like you find on Amazon or AliExpress. I'm going to change my design to better match this one.

I also found another I2C hook-up guide for MCUs that seems to concur with most of the other schematic.

What I don't get is this reset circuit-- It has a 10k pull-up but also a diode and a filter cap? If RST/RESET is an input, and not interfacing to the MCU, what's the point of this?


The Adafruit schematic contains a similar arrangement so a 5V Arduino can issue a reset:



Also, their library twiddles the reset pin (if specified, if not it's assumed to be tied to the MCU reset pin) during init:

Code: [Select]
    if(_rst >= 0) {
        // Toggle _rst low to reset
        pinMode(_rst, OUTPUT);
        digitalWrite(_rst, HIGH);
        delay(100);
        digitalWrite(_rst, LOW);
        delay(100);
        digitalWrite(_rst, HIGH);
        delay(200);
    }

So make sure to do this, and issue the command to enable the charge pump.
 

Offline Majek OndrovicTopic starter

  • Contributor
  • Posts: 14
  • Country: us
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #18 on: April 07, 2019, 07:14:45 pm »

Also, their library twiddles the reset pin (if specified, if not it's assumed to be tied to the MCU reset pin) during init:


This is good to know. I'm using the u8g2 library, set up with no reset pin, so it must also assume it's tied to the MCU reset
 

Offline Majek OndrovicTopic starter

  • Contributor
  • Posts: 14
  • Country: us
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #19 on: April 07, 2019, 07:24:43 pm »
RST needs to be held low long enough to be recognized when power is first applied, and then allowed to go high. The capacitor is more than just a filter in this case.
Aha! very interesting, thank you. I'm glad I asked
For extra credit, see if you can figure out what the diode is for.

Hmm I'm not sure.. Does it discharge the cap quickly but allow it to charge up slowly, or something like that?  :-//
 

Offline Nusa

  • Super Contributor
  • ***
  • Posts: 2416
  • Country: us
Re: Can't get SSD1306 OLED working on custom PCB
« Reply #20 on: April 07, 2019, 08:12:27 pm »
RST needs to be held low long enough to be recognized when power is first applied, and then allowed to go high. The capacitor is more than just a filter in this case.
Aha! very interesting, thank you. I'm glad I asked
For extra credit, see if you can figure out what the diode is for.

Hmm I'm not sure.. Does it discharge the cap quickly but allow it to charge up slowly, or something like that?  :-//
Yup, but only in the power-off situation. That ensures the power-on reset circuit gets reset.
 
The following users thanked this post: Majek Ondrovic


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf