lesthegrngo Posted December 14, 2022 Posted December 14, 2022 (edited) Hi all I got one of these OLED panels for the UHF radio panel, and I clearly didn't concentrate when selecting it as it has a different pinout via a 16 way FCC cable https://www.buydisplay.com/white-2-08-inch-graphic-oled-display-panel-256x64-parallel-spi-i2c The sketches that accompany it seem to be for use with ESP32 type boards, and I don't see example Arduino sketches to help me figure out. I have some LCD modules that use a similar connection, but they are wired differently (these ones) https://www.buydisplay.com/character-8x1-lcd-display-module-hd44780-controller-black-on-white So I am trying to configure them to work with the Nano's and believe that I have to use 7 of the pins, including the GND and VDD connections. The latter I was going to connect to the 3.3v Nano connection I believe the A0 connection on pin 4 is the 'load' pin, however pins 8 onwards seem to require extra hardware, yet looking at the video accompanying the site there clearly are not many connections to the dev board Other SPI devices have the following 7 pin nomenclature GND VCC D0 D1 RES DC CS Four out those are clear, however D0, D1 and DC must be the SDIN, SCLK and A0 connections, but I'm not sure which is which - any ideas? I am trying to use the sketch on the website to just try the pinout possibilities, but for some reason, despite downloading the AT98X52.H file and putting it into the libraries folder, the sketch doesn't recognise it so I can't get past the compilation stage to try it Cheers Les Edited December 14, 2022 by lesthegrngo
No1sonuk Posted December 14, 2022 Posted December 14, 2022 Which OLED library do you use? It looks like u8g2 library supports the sh1122 controller.
lesthegrngo Posted December 14, 2022 Author Posted December 14, 2022 I've used the U8G2 library so if that's compatible I'll try it Les
Vinc_Vega Posted December 14, 2022 Posted December 14, 2022 (edited) Hi Les, according to the tutorial 8051 Interfacing and Demo Code following OLED pins are mandatory: 1 VSS Ground pin 2 SDIN D1 3 SCLK D0 4 DC 5 RES 6 CS 7 VDD1 (+3V) I'm not sure, if the other pin connections are optional. Beware of, that the NANO has also 5V for logical outputs. The U8g2 library indeed seems to support the SH1122 driver chip. Regards, Vinc Edited December 14, 2022 by Vinc_Vega Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
lesthegrngo Posted December 15, 2022 Author Posted December 15, 2022 Thanks - I'll give it a try with the 3.3v VDD Les
lesthegrngo Posted December 15, 2022 Author Posted December 15, 2022 I'm running into memory issues, not for the first time, due to the u8g2 library. Even using an AT328 Nano, it exceeds the memory capacity and while it will compile, despite my test sketch being a simple one, it is not possible to load it. This is the sketch I'm using #include <Arduino.h> #include <U8g2lib.h> #include <Wire.h> #define PIN_SCLK 3 // Serial Clock Input #define PIN_SDIN 2 // Serial Data Input #define PIN_RST 13 // Reset #define PIN_CS 11 // Chip Select #define PIN_DC 10 // Data/Command Control U8G2_SH1122_256X64_F_4W_HW_SPI u8g2(U8G2_R0, PIN_SPI_SS, PIN_DC, PIN_RST); void setup(void) { u8g2.begin(); } void loop(void) { u8g2.clearBuffer(); u8g2.setFont(u8g2_font_ncenR08_tr); u8g2.drawStr(32,30,"Hello \n"); u8g2.drawStr(32,45,"World!"); u8g2.sendBuffer(); delay(1000); } As you can see there is nothing imposing about the sketch itself but it uses 121% of the dynamic memory Had this problem before and got told to use a 'bigger' Arduino, but it won't fit in the available space Any ideas?
No1sonuk Posted December 15, 2022 Posted December 15, 2022 It's likely the character bitmaps that are part of the included library. Maybe a different font would be better.
Vinc_Vega Posted December 15, 2022 Posted December 15, 2022 (edited) The u8g2 library needs a lot of memory. The total amount may depend on the used -> buffer size of the microcontroller RAM. The "F" within your U8G2_SH1122_256X64_F_4W_HW_SPI u8g2 constructor means "full framebuffer" and uses 2048 bytes for your -> display controller. You could try to reduce reserved memory when using the page buffer (1 = 256 bytes; 2 = 512 bytes). Have a look into the library's examples how page buffer has to be used / programmed. (I rarely used that) Regards, Vinc Edited December 15, 2022 by Vinc_Vega Regards, Vinc real life: Royal Bavarian Airforce online: VJS-GermanKnights.de [sIGPIC][/sIGPIC]
lesthegrngo Posted December 16, 2022 Author Posted December 16, 2022 Thanks guys - on the font thing, it seems it loads all of them whether or not they are used Changing the F to 1 reduced it to 33%, so good tip there Vinc. However I obviously need to check my setup as it isn't playing ball, whether that's a mistake in physical wiring or my logical setup I don't know. Whatever, as usual I learnt something more even if I haven't solved it yet! I'll keep trying Les
Recommended Posts