Why does this SSD1306 circuit work? - Page 1
Forum section: electronics / beginners

author: flyincircuits
author_rank: Newbie
timestamp: August 19, 2024, 09:31:30 am
content: Hi,It took me some tinkering, but I finally got a generic display module (SSD1306 based) to work.It’s one of those display modules you would usually buy soldered to a 4-pin I2C board for convenience.Unfortunately, I don’t really understand why it works.In the first iteration, I tried the circuit shown in the manufacturer’s data sheet (01.png).The result here was a blank display with no output at all.The image 02.png shows my second try.Here, the display somewhat worked: It magically alternated between the correct output and random pixels.With the knowledge from the third try, I guess wrong resistor and capacitor values were to blame.The third image (03.png) shows the working circuit (taken from Michael Teeuw’s blog – thanks!).Here, the display does what it should without glitches and random pixels.I’m glad that it finally works, but I’d be grateful for some insight into why it works:- what does the circuit with the N- and P-channel MOSFETs in the manufacturer’s data sheet do (marked with a red rectangle in 01.png)?- why does it work with 3.3V voltage, although the data sheet expects at least 3.5V input at VBAT IN?

author: Zero999
author_rank: Super Contributor
timestamp: August 19, 2024, 09:52:20 am
content: Q2 should be a P-channel MOSFET. The symbol used is for an N-channel, which won't work. A P-channel MOSFET turns on when its gate voltage is taken below the source voltage. R1 pulls the gate voltage up to the source, so there's no potential difference between the gate and source, when Q1 is off, which means Q2 is also off. When Q1 is turned on by making GPIO high, it pulls Q2's source voltage down to 0V, whist its source remains at VBAT IN, so it turns on.The data sheet specifies a minimum voltage at which it's guaranteed to work, which is 3.5V in this case. It's very common for devices to work outside the guaranteed operating conditions on the data sheet, but reliability might be compromised. It might work at 3.3V at room temperature, but that doesn't mean it will at extreme ends of the temperature range, or after a long period of time i.e. aging.

author: ArdWar
author_rank: Frequent Contributor
timestamp: August 19, 2024, 10:01:28 am
content: Quote from: flyincircuits on August 19, 2024, 09:31:30 amI guess that's supposed to be a power switch... done horribly wrongQ1 and Q2 should be swapped (Q1 NMOS, Q2 PMOS), Q2 D-S should be flipped. As it is shown the circuit is a dumb diode, maybe dropping enough voltage to cause failure of operation.Quote from: flyincircuits on August 19, 2024, 09:31:30 amI don't know. Manufacturers usually just playing safe with their specs. Only listing values that they can be 100% sure will work with their products. The actual device may (or may not) work outside of official specification, just that the manufacturer won't support you if something goes wrong.

author: wraper
author_rank: Unknown
timestamp: August 19, 2024, 10:15:11 am
content: Quote from: ArdWar on August 19, 2024, 10:01:28 amNothing should be flipped. They screwed up with Q2 symbol and parts list. Suggested parts are FDN338P (p-channel) for Q1 and FDN335N (n-channel) for Q2 while both are shown as n-channel in schematic. It will work fine if FDN335N is used for Q1 and FDN338P for Q2. I guess that it was probably fine in their internal documentation and then someone screwed up while putting it into datasheet.

author: wraper
author_rank: Unknown
timestamp: August 19, 2024, 10:24:29 am
content: Quote from: Zero999 on August 19, 2024, 09:52:20 amI opened some random datasheet of SSD1306 based display and it says:QuoteAlso it shows VDD and VBAT connected together in one of example circuits. So it should work fine if everything is powered from 3.3V.

author: flyincircuits
author_rank: Newbie
timestamp: August 19, 2024, 04:11:53 pm
content: Thank you very much everyone. That helped a lot!I don't expect my design to work in extreme heat/cold, so going with 3.3V for VBAT and VDD should be fine.Thanks again