I've been using the 128x64 oled display that uses the SSD1306 driver and I'd like to try a smaller sized 64X48 one. It looks like defining the smaller size is in the initialization. It might be the line sendcommand(0x2F); //--1/48 duty //was sendcommand(0x3F) for 128X64 sized display but I have to test.
If anyone is using a 64x48 sized display and can help then please let me know.
First, change WIDTH and HEIGHT to 64 and 48 (lines 39 and 40).
Then update the init sequence. By default this is u8g_dev_ssd1306_128x64_adafruit3_init_seq (line 112).
After this, you should be able to at least see something with the U8GLIB_SSD1306_128x64 constructor.
I have simple working test code (attached) for the 128X64 that I'm hoping to modify for the smaller display. Do you have experience with the SSD1306? It looks like the colomn, row values will have to be adjusted. Right now on the smaller display it works but the first few and last characters cut off.
The OLED has a size of 64x48. The controller has a size of 128x64 pixel. The question is, how is the OLED window mapped into the 128x64 RAM are of the controller.
Or: How is the upper left corner of the OLED display mapped onto the RAM of the controller.
This is very specific to the connection between controller and OLED and can have (almost) any mapping. For example if the OLED display is centered in the RAM of the controller, then the upper left corner of the display has the pixel coordinates (32,8).
Usually this is documented in the datasheet for the specific OLED module.
Bringing this old thread back up, since I have a similar problem.
Got a 64x48 i2c oled display from ebay, seller wide.hk. Description says it's using the SSD1306 controller, and sure enough, if I feed it with 5v on it's Vcc, the stock Adafruit library for SSD1306_128_64 works, but naturally it can't draw the full 128x64 content.
Here's the thing, according to a datasheet I found at
the oled panel is likely set up to use a portion of the usable controller RAM.
Page 4 of that PDF illustrates that the 64x48 panel is centered on the x axis of the 128 pixels, i.e. shifted 32 pixels, and snapped to the bottom of the y axis, which should mean shifted down 16 pixels.
I tried mucking about with the adafruit library to decrease the size of the internal buffer in the library, but that's not enough, since the library assumes the display has the full 128 pixel width, starting at a corner.
It's possibly easier to tweak u8glib to use that panel efficiently, but I haven't digged into it yet. Olikraus, do you have any insight to this?
The sequence in line 182 defines the x-offset, so i guess it should be modified like this:
static const uint8_t u8g_dev_ssd1306_128x64_data_start[] PROGMEM = {
U8G_ESC_ADR(0), /* instruction mode */
U8G_ESC_CS(1), /* enable chip */
0x012, /* set upper 4 bit of the col adr to 32 pixel offset */
0x000, /* set lower 4 bit of the col adr to 0 */
U8G_ESC_END /* end of sequence */
};
Modify line 230 for the y-offset:
u8g_WriteByte(u8g, dev, 0x0b0 | (pb->p.page+2)); /* select current page (SSD1306), skip first 2 pages (16 rows) */
Thanks Oliver, that helps in terms of getting the local address space right, so now pixel 0,0 seems to be where you'd expect.
It does however not make all lines of the display usable; you only get 24 lines to show up if you try to light all the pixels.
Oliver helped me decipher the previously posted datasheet, and if I'm reading it right the
0xDA init sequence should be set to 0x12, resulting in "Alternative COM pin configuration" and "Disable COM Left/Right remap". Further, the 0xC8 init sequence should be sent, resulting in "COM output Scan direction: from COM63 to COM0".
I thought doing this would help with the 24 lines problem, but I'm afraid it doesn't so I'll have to study the datasheet some more it seems. From experimenting I think the display looks best with 0xDA set to 0x02, but I don't think it's 100% right.
Good news: This display will be supported by the upcoming version of U8glib.
Please excause the delay, shipping took some time and then I got busy with the transition of the U8glib project from google code to github.