OLED 128x64 SSD1306 sometimes doesn't work :-(

Post here first, or if you can't find a relevant section!
loarri
Posts: 7
Joined: Wed Aug 03, 2022 1:28 pm
Location: Italy
Contact:

OLED 128x64 SSD1306 sometimes doesn't work :-(

Post by loarri »

Hello guys,
I'm going crazy trying to make the small 128x64 oled display go with the Adafruit library.
The connection is I2C but the strange thing is that sometimes it works sometimes when I turn on the micro no.
The code works correctly but the display remains "off".
Why it??
I've read a few pages here about it but haven't found a working solution.
Even putting a delay of 1000 ms at the start of the setup does not solve the problem.
Is there any expert who has had the same problem as me and solved it please?
thank you very much and good afternoon.

P.s the board is at the F411RE and the display is the classic Chinese oled 128x64 I2C that works with the Adafruit library (I'm not yet able to use the u8g2 library).

Also the I2C scanner sometimes works and detects the display address (0x3C) and sometimes it doesn't but I don't understand why.
I also put two 10KOhm resistors on the SDA / SCL lines (pullUp) but nothing has changed.

Thanks everyone for the help.
Lorenzo
Hello I am an electronics enthusiast and I always like to experiment with new circuits :D
hobbya
Posts: 49
Joined: Thu Dec 19, 2019 3:27 pm
Answers: 1

Re: OLED 128x64 SSD1306 sometimes doesn't work :-(

Post by hobbya »

Have not encountered your issue with Adafruit library. Since I2C scanner did not always work it implied some sort of intermittent connection. You may also try reducing the values of the pull up resistors.

Regarding the problem with u8g2 library, an user had found a fix by swapping 2 lines of code:
https://github.com/olikraus/u8g2/issues/1209

Good luck.
loarri
Posts: 7
Joined: Wed Aug 03, 2022 1:28 pm
Location: Italy
Contact:

Re: OLED 128x64 SSD1306 sometimes doesn't work :-(

Post by loarri »

hello, many thanks for your suggestion!
asap I'll try it and let you know.

Thanks and regards!!!
Hello I am an electronics enthusiast and I always like to experiment with new circuits :D
loarri
Posts: 7
Joined: Wed Aug 03, 2022 1:28 pm
Location: Italy
Contact:

Re: OLED 128x64 SSD1306 sometimes doesn't work :-(

Post by loarri »

hobbya wrote: Wed Aug 03, 2022 1:56 pm Have not encountered your issue with Adafruit library. Since I2C scanner did not always work it implied some sort of intermittent connection. You may also try reducing the values of the pull up resistors.

Regarding the problem with u8g2 library, an user had found a fix by swapping 2 lines of code:
https://github.com/olikraus/u8g2/issues/1209

Good luck.


Hello hobbya
unlucky it doesn't work even if I put 4.7kOhm pull up resistors :?

At the beginning display works fine but after supply in /out again...no more....
it is as if it were a capacitor that at the beginning is empty and then the display works, then after it charges and the display stops working even if you disconnect the circuit and feed it several times ....
you have to let some time pass to see it work again :shock: :shock:

this is really frustrating :-(

Has anyone encountered a similar problem?

thank you very much for helping!!!
Bye
Hello I am an electronics enthusiast and I always like to experiment with new circuits :D
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: OLED 128x64 SSD1306 sometimes doesn't work :-(

Post by ag123 »

if you have a spare STM32F401 (say blackpill)
you could try this little logic analyzer.
viewtopic.php?f=10&t=116
I'd think a scope helps too, i2c is fairly 'slow' so it is possible to observe even with a STM32Fxxyy adc.
viewtopic.php?t=472

i think a lower pull up resistor would help better like 1k?
loarri
Posts: 7
Joined: Wed Aug 03, 2022 1:28 pm
Location: Italy
Contact:

Re: OLED 128x64 SSD1306 sometimes doesn't work :-(

Post by loarri »

hello guys no news...
I reduced the pullup resistor (now 4.7 ohm) and also I added a capacitor (1um) plus a resistor (1M) to force a reset at the beginning but nothing is changed :-(
actually the other display I have, oled 128x32, suffers less from this disturbance.
I am desperate and I don't know how to solve the problem :-( the ic2 seems to me to work well ...

any suggestion/ previous experience with it?
let me know please.

Many thanks !
bye
Hello I am an electronics enthusiast and I always like to experiment with new circuits :D
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: OLED 128x64 SSD1306 sometimes doesn't work :-(

Post by ag123 »

if you are using 'dupont' wires and pins, those contacts can come off easily, and sometimes it is wired incorrectly.
if it simply doesn't work at all, it is likely wired incorrectly. In that case check the connections.
if it is loose connections, sometimes i changed the wires and connectors and it works after.

Check also your VDD 3.3v or VCC 5v connections, verify that the "correct" voltage is going to the lcd.
I've been luckier and more often I got away even without pull up resistors.

The Adafruit library works is that the case? if that is indeed the case, then you may as well want to stick with the Adafruit library.
That works pretty well for me literally.

the i2c scanner should work, it is possibly a 'simplest' way to 'test' i2c connectivity.
hobbya
Posts: 49
Joined: Thu Dec 19, 2019 3:27 pm
Answers: 1

Re: OLED 128x64 SSD1306 sometimes doesn't work :-(

Post by hobbya »

I ran the Adafruit example on a blackpill but did not see your issues. I even did not add pull up resistors. The I2C address of my OLED is 0x3C instead of the default 0x3D in the code.
setup.jpg
setup.jpg (64.57 KiB) Viewed 2381 times
20220804_233031.jpg
20220804_233031.jpg (90.94 KiB) Viewed 2381 times
loarri
Posts: 7
Joined: Wed Aug 03, 2022 1:28 pm
Location: Italy
Contact:

Re: OLED 128x64 SSD1306 sometimes doesn't work :-(

Post by loarri »

hello hobbya,
many many thanks for your help !!
so...I don't' know why but sometime my display works fine (like *in your test) sometime not, even if connectios are fine.....
Anyway...maybe I found a "good" point.... actually it seems working fine with u8g2 library !

I hope it'll be good for next trials....

so I'll update you soon...

at the same time yes I'm using dupon cables and sometime ic2scanner rightly find my hardware sometime not.

I'm using NUCLEO F411RE board.

Many thanks again for your support and I'll let you know.
Bye bye
Hello I am an electronics enthusiast and I always like to experiment with new circuits :D
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: OLED 128x64 SSD1306 sometimes doesn't work :-(

Post by ag123 »

Broken / loose wires (some even on poor PCBs) are frustrating to deal with.
Sometimes rather than to test and figure out, if I've a spare set of 'dupont' wires, i'd use them.
I crimp my own "dupont" wires, so that I'd easily have more if I need them, and I can vary the length as needed.
e.g.
https://www.youtube.com/watch?v=woa-p-Rk4zg
Post Reply

Return to “General discussion”