Connect RES to a GPIO pin. Declare this in the constructor as the oled_reset pin.
Connect DC to 0V for the regular Slave address.
SDA, SCL to SDA, SCL on your Arduino.
I am always wary of 3.3V modules and 5V logic on a Uno. Most need level shifters.
Please post a link to your actual display with a truthful photo of the pcb.
I was searching that but only oleds I found 7pin or 4 pin I didnt found anyone using oled like mine
This might be also a SPI OLED with a missing CS input.
Wire in this way:
-scl --> pin 13
-sda --> pin 11
-res --> pin 8
-dc --> pin 9
Then try the following constructor (U8g2 Library) in one of the U8g2 examples:
U8G2_SSD1306_128X64_NONAME_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=/ 13, / data=/ 11, / cs=/ U8X8_PIN_NONE, / dc=/ 9, / reset=*/ 8 );
If this does not work, then connect dc with GND (instead of pin 9) and try this constructor:
U8G2_SSD1306_128X64_NONAME_1_SW_I2C u8g2(U8G2_R0, /* clock=/ 13, / data=/ 11, / reset=*/ 8 );
...
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
...
display.begin(SSD1306_SWITCHCAPVCC, 0x3D); // initialize with the I2C addr 0x3D (for the 128x64)
...
This is using Digital#4 pin for RES
And Slave address 0x3D for the display (i.e. DC pin = high)
If you wire DC pin to 0V, you would use:
...
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
...
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C
...
I am not familiar with Oliver's U8g2 constructors, but I guess there will be one for the hardware I2C pins.
My 6-pin OLED works correctly on the I2C bus. A lot of early Ebay modules did not ACK the I2C.
Hence the importance of showing a link that has an accurate photo of your actual display.
david_prentice:
My 6-pin OLED works correctly on the I2C bus. A lot of early Ebay modules did not ACK the I2C.
Hence the importance of showing a link that has an accurate photo of your actual display.
Yes, this is another difficulty. However u8g2 software emulated I2C will work with these OLEDs.
Hardware I2C is also supported by u8g2 but has a different constructor name (see examples or documentation for this)
david_prentice:
Looking at the Adafruit_SSD1306 examples:
...
#define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
...
display.begin(SSD1306_SWITCHCAPVCC, 0x3D); // initialize with the I2C addr 0x3D (for the 128x64)
...
This is using Digital#4 pin for RES
And Slave address 0x3D for the display (i.e. DC pin = high)
If you wire DC pin to 0V, you would use:
... #define OLED_RESET 4
Adafruit_SSD1306 display(OLED_RESET);
...
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // initialize with the I2C addr 0x3C
...
I am not familiar with Oliver's U8g2 constructors, but I guess there will be one for the hardware I2C pins.
My 6-pin OLED works correctly on the I2C bus. A lot of early Ebay modules did not ACK the I2C.
Hence the importance of showing a link that has an accurate photo of your actual display.
David.
while trying to upload ssd1306 128*64_i2c its giving
#define SSD1306_I2C_ADDRESS 0x3C // 011110+SA0+RW - 0x3C or 0x3D
// Address for 128x32 is 0x3C
// Address for 128x64 is 0x3D (default) or 0x3C (if SA0 is grounded)
/*=========================================================================
SSD1306 Displays
-----------------------------------------------------------------------
The driver is used in multiple displays (128x64, 128x32, etc.).
Select the appropriate display below to create an appropriately
sized framebuffer, etc.
SSD1306_128_64 128x64 pixel display
SSD1306_128_32 128x32 pixel display
SSD1306_96_16
-----------------------------------------------------------------------*/
#define SSD1306_128_64
// #define SSD1306_128_32
// #define SSD1306_96_16
/*=========================================================================*/
It looks as if Adafruit expect their 128x32 display to use 0x3C and their 128x64 display to use 0x3D.
Personally, I would configure my 128x64 to be 0x3C (as you can see above)
You might find it easier to wire DC high, and use 0x3D as Adafruit 128x64 examples expect 0x3D.
olikraus:
This might be also a SPI OLED with a missing CS input.
Wire in this way:
-scl --> pin 13
-sda --> pin 11
-res --> pin 8
-dc --> pin 9
Then try the following constructor (U8g2 Library) in one of the U8g2 examples:
U8G2_SSD1306_128X64_NONAME_1_4W_SW_SPI u8g2(U8G2_R0, /* clock=/ 13, / data=/ 11, / cs=/ U8X8_PIN_NONE, / dc=/ 9, / reset=*/ 8 );
If this does not work, then connect dc with GND (instead of pin 9) and try this constructor:
U8G2_SSD1306_128X64_NONAME_1_SW_I2C u8g2(U8G2_R0, /* clock=/ 13, / data=/ 11, / reset=*/ 8 );
That was it . it solve it thanks alot for help.
display was spi. thank you
Ah-ha. I am fairly certain that my 6-pin OLED came as I2C.
Hence the importance of showing an accurate photo of the pcb.
I really do not understand how a 6-pin can work on the SPI bus without a /CS pin.
If you have an I2C 6-pin (which is ACK-able), you can have multiple I2C devices as Nature intended.
You can even have multiple OLED displays. Use each DC pin to "select" the appropriate OLED. (i.e. match the Slave Address)