There are many parameters which influence the brightness. The overall contrast is only one of them and indeed sometimes it does not really change something.
You probably need to modify the init sequence to reduce the brightness. For example reduce the VCOMH value:
You probably need to read about the parameters in the SSD1327 datasheet.
Hi Oliver and thank you very much for your reply. I followed your advice and searched the SSD1327 drive datasheet, I paste the link:
Specifically, on page 33 of the datasheet you will find:
8.8 Gray Scale Decoder The gray scale effect is generated by controlling the pulse width (PW) of current drive phase, except GS0 there is no pre-charge (phase 2, 3) and current drive (phase 4). The driving period is controlled by the gray scale settings (setting 0 ~ setting 127). The larger the setting, the brighter the pixel will be. The Gray Scale Table stores the corresponding gray scale setting of the 16 gray scale levels (GS0~GS15) through the software commands B8h or B9h. As shown in Figure 8-16, GDDRAM data has 4 bits, represent the 16 gray scale levels from GS0 to GS15. Note that the frame frequency is affected by GS15 setting. Figure 8-16 : Relation between GDDRAM content and Gray Scale table entry (under command B9h Enable Linear Gray Scale Table) GDDRAM data (4 bits) Gray Scale Table Default Gamma Setting (Command B9h) 0000 GS0 Setting 0 0001 GS1 (1) Setting 0 0010 GS2 Setting 2 0011 GS3 Setting 4 : : : : : : 1101 GS13 Setting 24 1110 GS14 Setting 26 1111 GS15 Setting 28 Note: (1) Both GS0 and GS1 have no 2nd pre-charge (phase 3) and current drive (phase 4), however GS1 has 1st precharge (phase 2).
Honestly, this is out of my reach, can you help me?
The grayscale decoder is just another way of reducing the brightness. But there are more simpler options. Why don't you just play with the VCOMH value?
Oliver
Edit:
In order to use the grayscale decoder for brightness reduction you could modify this part of the code:
olikraus:
The grayscale decoder is just another way of reducing the brightness. But there are more simpler options. Why don't you just play with the VCOMH value?
Oliver
Thanks Oliver, you have convinced me and I will try to change the value of VCOMH even though to tell the truth I have already tried but with negative results.
As you indicated above here:
From the datasheet I read this. Can help:?
8.6 SEG/COM Driving Block This block is used to derive the incoming power sources into the different levels of internal use voltage and current. • VCC is the most positive voltage supply. • VCOMH is the Common deselected level. It is internally regulated. • VLSS is the ground path of the analog and panel current. • IREF is a reference current source for segment current drivers ISEG. The relationship between reference current and segment current of a color is: ISEG = Contrast / 256 * IREF * scale factor in which the contrast (0~255) is set by Set Contrast command (81h).
and
10.1.3 Set Contrast Current (81h) This double byte command is used to set Contrast Setting of the display. The chip has 256 contrast steps from 00h to FFh. The segment output current ISEG increases linearly with the contrast step, which results in brighter display.
Do I have to do this?
U8X8_CA (0x00h, 0xFFh), // modify line 372 of the library
and then use for example the u8g2.setContrast (100) command in the sketch?
U8X8_CA (0x00h, 0xFFh), // modify line 372 of the library
The display controller expects data in the format " ", see the table on page 39 of the datasheet linked by you.
For the setting of the vcomh value, you must use the command 0xbe. The seconad byte is the vcomh value itself. The vcomh value however is only a 3-bit-value (again see the datasheet on page 39). So the range is 0..7, where 0 is the lowest value and 7 is the highest value, so you can test with one of the the following lines
U8X8_CA (0x0be, 0x000), // modify line 372 of the library
U8X8_CA (0x0be, 0x001), // modify line 372 of the library
U8X8_CA (0x0be, 0x002), // modify line 372 of the library
U8X8_CA (0x0be, 0x003), // modify line 372 of the library
U8X8_CA (0x0be, 0x004), // modify line 372 of the library
U8X8_CA (0x0be, 0x005), // modify line 372 of the library
U8X8_CA (0x0be, 0x006), // modify line 372 of the library
u8x8_cad_StartTransfer(u8g2.GetU8x8());
u8x8_cad_SendCmd( u8g2.GetU8x8(), 0xbe);
u8x8_cad_SendArg( u8g2.GetU8x8(), 3); // vcomh value from 0 to 7
u8x8_cad_EndTransfer(u8g2.GetU8x8());
I tried pasting the lines in the setup (), but I get this:
Arduino:1.8.8 (Windows 10), Scheda:"LOLIN(WEMOS) D1 mini Lite, 160 MHz, Flash, 1M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 921600"
C:\Users\Nic\Documents\Arduino\oled\oled.ino: In function 'void setup()':
oled:404:31: error: 'class U8G2_SSD1327_EA_W128128_F_HW_I2C' has no member named 'GetU8x8'
u8x8_cad_StartTransfer(u8g2.GetU8x8());
^
oled:405:26: error: 'class U8G2_SSD1327_EA_W128128_F_HW_I2C' has no member named 'GetU8x8'
u8x8_cad_SendCmd( u8g2.GetU8x8(), 0xbe);
^
oled:406:26: error: 'class U8G2_SSD1327_EA_W128128_F_HW_I2C' has no member named 'GetU8x8'
u8x8_cad_SendArg( u8g2.GetU8x8(), 3); // vcomh value from 0 to 7
^
oled:407:29: error: 'class U8G2_SSD1327_EA_W128128_F_HW_I2C' has no member named 'GetU8x8'
u8x8_cad_EndTransfer(u8g2.GetU8x8());
^
Più di una libreria trovata per "U8g2lib.h"
Usata: C:\Users\Nic\Documents\Arduino\libraries\enlinea777-u8g2_suport_ESP8266-master
Non usata: C:\Users\Nic\Documents\Arduino\libraries\U8g2
Non usata: C:\Users\Nic\Documents\Arduino\libraries\U8g2
Non usata: C:\Users\Nic\Documents\Arduino\libraries\U8g2
Non usata: C:\Users\Nic\Documents\Arduino\libraries\U8g2
exit status 1
'class U8G2_SSD1327_EA_W128128_F_HW_I2C' has no member named 'GetU8x8'
Questo report potrebbe essere più ricco di informazioni abilitando l'opzione
"Mostra un output dettagliato durante la compilazione"
in "File -> Impostazioni"
u8x8_cad_StartTransfer(u8g2.getU8x8());
u8x8_cad_SendCmd( u8g2.getU8x8(), 0xbe);
u8x8_cad_SendArg( u8g2.getU8x8(), 3); // vcomh value from 0 to 7
u8x8_cad_EndTransfer(u8g2.getU8x8());
Needs to be fixed in the FAQ also. Thanks for this feedback.
I did some tests today.
Both options, setContrast(0) and VCOMH=0 work as expected on my own display. If both is applied, the brightness is greatly reduced.
I have attached a test .ino file which switches between VCOMH=0 and VCOMH=7 with contrast=0 to show the effect.
Ok thanks a lot, I see that you are using a 96x96 oled so your hardware is different from mine. However I can't wait to test your code in the evening and I'll try it immediately on my Wemos D1 lite (which is the hardware I'm using in my project) and then also on an Arduino Uno so as not to exclude anything. In a few hours I will be able to report the outcome.
Hi Oliver, I have another question, I have to set the oled speed, that's fine if in the setup I insert the generic command for the I2C bus: Wire.setClock (400000L);
or you have to act on the library for example with the commands:
I have just received a SSD1327 128x128 display. It seems to have unusual behaviour on the first 4 rows.
So I tried it with U8g2
#include <U8g2lib.h>
//U8G2_SSD1306_128X64_NONAME_F_4W_HW_SPI u8g2(U8G2_R0, 10, 9, 8); //
//U8G2_SSD1327_EA_W128128_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
U8G2_SSD1327_MIDAS_128X128_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
void setup()
{
u8g2.begin();
}
void loop()
{
static uint8_t n = 0;
uint8_t w = u8g2.getWidth(), h = u8g2.getHeight();
n = !n; //alternate 0, 1 on each pass
u8g2.firstPage();
do {
for (int i = n; i < h / 2; i += 3) {
u8g2.drawFrame(i, i, w - i * 2, h - i * 2);
}
} while ( u8g2.nextPage() );
delay(2000);
}
My display misbehaves with U8g2 too. The MIDAS constructor gives 128x128 but row #0, #1, #2, #3 do not display all the pixels.
The EA constructor is 128x128 but it only displays in a 128x96 window.
The SSD1306 constructor works fine.
Is it my display? Or is it a feature of the SSD1327.
I can display grayscale bitmaps but the grades are terrible. A 16-shade photo on a TFT (or color OLED) looks quite respectable. Not good on this SSD1327.
Of course there may be a very good reason why this Ebay display is cheap.