OLED SH1106_SPI Contrast

For general Flowcode discussion that does not belong in the other sections.
Abhijit
Posts: 43
http://meble-kuchenne.info.pl
Joined: Thu Dec 03, 2020 6:26 am
Has thanked: 5 times

OLED SH1106_SPI Contrast

Post by Abhijit »

Hello!

I am trying to control the brightness/contrast of the SH1106_SPI OLED display, after searching the internet found out it is possible by using below commands, can someone suggest how to implement the same in chart if it is possible.

display.SH1106_command(0x81);
display.SH1106_data(50);

Thank you.

Abhi

chipfryer27
Valued Contributor
Posts: 1684
Joined: Thu Dec 03, 2020 10:57 am
Has thanked: 374 times
Been thanked: 583 times

Re: OLED SH1106_SPI Contrast

Post by chipfryer27 »

Hi Abhi

I could be totally wrong here but it looks like you just need to send an SPI command to write to location 0x81 a value of 50.

However if you are using a FC component it might be trickier, but you could perhaps download the source code from the WiKi.

Maybe make a feature request as it seems a handy thing to be able to do?

Regards

Abhijit
Posts: 43
Joined: Thu Dec 03, 2020 6:26 am
Has thanked: 5 times

Re: OLED SH1106_SPI Contrast

Post by Abhijit »

Hi! Chipfryer

Thank you for your inputs, as said I tried to explore the source code file from WiKi, unfortunately, nothing I understood, probably not my cup of tea.

By the way there is one macro available in the component macro list "Write Command" but again clueless about how to write. I tried to write the same macro 2 times, one with 0x81 and following 50 (I tried several numbers from 1 to 250) but did not notice anything happening, or may be I am not writing it in the correct way.

I hope matrix team may point out some suggestion or correct way to control the brightness/contras.

I am using below OLED for my project.

https://www.waveshare.com/wiki/1.3inch_OLED_(B)

Thank you.

Abhi

medelec35
Matrix Staff
Posts: 2086
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 644 times
Been thanked: 701 times

Re: OLED SH1106_SPI Contrast

Post by medelec35 »

hello.
When I'm back at work tomorrow, I will see what I can sort out for you.
Martin

Abhijit
Posts: 43
Joined: Thu Dec 03, 2020 6:26 am
Has thanked: 5 times

Re: OLED SH1106_SPI Contrast

Post by Abhijit »

Hi! Martin
Good morning

Okay, I shall wait for your feedback.

Thank you.

Abhi

medelec35
Matrix Staff
Posts: 2086
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 644 times
Been thanked: 701 times

Re: OLED SH1106_SPI Contrast

Post by medelec35 »

Hello,
I have added contrast adjustment, but it's untested if you would like to test it for me?
To try the new component feature, browse to this location using file explorer , it's hidden by default so just paste the link into your address bar.

Code: Select all

%ProgramData%\MatrixTSL\FlowcodeV10\Components
Place the attached component.
If Flowcode is already open, then you will need to reload your project for the new component to work
If you run any component updates, then the component you added will be overwritten, so it will stop working again (unless the component update has been pushed).

After adding component and reloading, can you let me know if the contrast function is working OK on both simulation and hardware?
Attachments
gLCD_SH1106_SPI.fcpx
(16.76 KiB) Downloaded 29 times
Martin

medelec35
Matrix Staff
Posts: 2086
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 644 times
Been thanked: 701 times

Re: OLED SH1106_SPI Contrast

Post by medelec35 »

This is the display simulation:
Contrast testing.png
Contrast testing.png (21.24 KiB) Viewed 1798 times
Let's hope the hardware works just as well.
Martin

medelec35
Matrix Staff
Posts: 2086
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 644 times
Been thanked: 701 times

Re: OLED SH1106_SPI Contrast

Post by medelec35 »

If the attachment above does not work,
can you then try this attachment and let me know which works more as expected.
Attachments
gLCD_SH1106_SPI.fcpx
(16.8 KiB) Downloaded 27 times
Martin

medelec35
Matrix Staff
Posts: 2086
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 644 times
Been thanked: 701 times

Re: OLED SH1106_SPI Contrast

Post by medelec35 »

For anyone using the I2C version.
Attach is a component to try.
Attachments
gLCD_SH1106_I2C.fcpx
(16.09 KiB) Downloaded 29 times
Martin

Abhijit
Posts: 43
Joined: Thu Dec 03, 2020 6:26 am
Has thanked: 5 times

Re: OLED SH1106_SPI Contrast

Post by Abhijit »

Hi! Martin
good evening

First of all many thanks for taking time to solve the puzzle, following your instruction i replaced both the component files one by one and tried, for the first file nothing worked in chart as well hardware after using the second file contras worked in the simulation but not in the hardware, on contrary i noticed one change in the display which is not normal, i could see one standing line a small one in the left top corner which was not there earlier, i also noticed one change in the properties, one of the fonts "Character Spacing" and "Space Width" do not show the drop down menu, i doubt if that corner line is because of that.

I again copy paste the old component file and everything resumed as before.

Do let me know if you want me to take the trials with some special instructions, i shall follow.

Thank you again for taking time.

Abhi

Post Reply