Can't get SSD1306 OLED working on custom PCB - Page 1
Forum section: electronics / beginners

author: Majek Ondrovic
author_rank: Contributor
timestamp: April 06, 2019, 07:33:53 am
content: 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 Aliexpresshere(perhaps that was my mistake!). They didn't post a data sheet so I decided to copy theAdafruit OLED Schematicand 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 likethis onefrom 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 runsthese I2C pre-made OLEDswith 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 designThanks in advance for your help and guidance!!

author: bson
author_rank: Unknown
timestamp: April 06, 2019, 11:34:23 am
content: 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Ω.

author: Psi
author_rank: Super Contributor
timestamp: April 06, 2019, 11:37:53 am
content: 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.

author: bson
author_rank: Unknown
timestamp: April 06, 2019, 11:40:33 am
content: 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 VDD2. After VDD become stable, set RES# pin LOW (logic low) for at least 3us (t1) (4) and then HIGH (logichigh).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).

author: MarkF
author_rank: Super Contributor
timestamp: April 06, 2019, 02:32:30 pm
content: 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.

author: LateLesley
author_rank: Frequent Contributor
timestamp: April 06, 2019, 02:49:19 pm
content: 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.

author: dmills
author_rank: Super Contributor
timestamp: April 06, 2019, 04:54:43 pm
content: 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.

author: Majek Ondrovic
author_rank: Contributor
timestamp: April 06, 2019, 06:13:52 pm
content: Quote from: bson on April 06, 2019, 11:34:23 amMy 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.3vEach has it's own hookup, I attached screenshots of those schematicsI 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

author: Majek Ondrovic
author_rank: Contributor
timestamp: April 06, 2019, 06:18:47 pm
content: Quote from: dmills on April 06, 2019, 04:54:43 pmYeah 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!

author: MarkF
author_rank: Super Contributor
timestamp: April 06, 2019, 10:15:05 pm
content: 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.

author: Psi
author_rank: Super Contributor
timestamp: April 06, 2019, 10:34:45 pm
content: Quote from: MarkF on April 06, 2019, 10:15:05 pmThe 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.

author: MarkF
author_rank: Super Contributor
timestamp: April 07, 2019, 12:39:50 am
content: Quote from: Psi on April 06, 2019, 10:34:45 pmThanks.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.

author: Majek Ondrovic
author_rank: Contributor
timestamp: April 07, 2019, 01:36:10 am
content: 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?

author: Nusa
author_rank: Super Contributor
timestamp: April 07, 2019, 02:36:16 am
content: 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.

author: Majek Ondrovic
author_rank: Contributor
timestamp: April 07, 2019, 02:56:27 am
content: Quote from: Nusa on April 07, 2019, 02:36:16 amAha! very interesting, thank you. I'm glad I asked

author: Nusa
author_rank: Super Contributor
timestamp: April 07, 2019, 05:16:11 am
content: Quote from: Majek Ondrovic on April 07, 2019, 02:56:27 amFor extra credit, see if you can figure out what the diode is for.

author: bson
author_rank: Unknown
timestamp: April 07, 2019, 07:35:07 am
content: Quote from: Majek Ondrovic on April 06, 2019, 06:13:52 pmYeah, 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.

author: bson
author_rank: Unknown
timestamp: April 07, 2019, 07:46:06 am
content: Quote from: Majek Ondrovic on April 07, 2019, 01:36:10 amThe 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:if(_rst >= 0) {// Toggle _rst low to resetpinMode(_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.

author: Majek Ondrovic
author_rank: Contributor
timestamp: April 07, 2019, 07:14:45 pm
content: Quote from: bson on April 07, 2019, 07:46:06 amThis 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

author: Majek Ondrovic
author_rank: Contributor
timestamp: April 07, 2019, 07:24:43 pm
content: Quote from: Nusa on April 07, 2019, 05:16:11 amHmm I'm not sure.. Does it discharge the cap quickly but allow it to charge up slowly, or something like that?

author: Nusa
author_rank: Super Contributor
timestamp: April 07, 2019, 08:12:27 pm
content: Quote from: Majek Ondrovic on April 07, 2019, 07:24:43 pmYup, but only in the power-off situation. That ensures the power-on reset circuit gets reset.