Hi All
I could use some help / advice on powering one of the small SSD1306 oled 0.96" displays from an Arduino pin
Im using an ATMEGA328 and powering the small display directly from the Arduino, I've checked the current draw and its in the order of 15mA-20mA - well within the output current capabilities of the chip.
It all works fine with the Adafruit libraries and the SSD1306Ascii ones and I'm setting the pin output to high in the void setup();
However when using the U8GLIB libraries it wont work, If I power the display from a static 5v feed the libraries work just fine so its a display power issue not my use of the libraries.
So I started trying various delays after setting the pin to high thinking it was an issue of the display 'starting up' before the I2C init codes were sent - but no.
If I take the line U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); and insert it in the void setup(); after the pin is turned on it still will not initialise. If however I put it within the main loop it does but reinitialises it every loop - but at least it proved I could make it startup.
So realising the code in U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK); was executed BEFORE the void setup(); I decided to look into the library code (Im a NOOB so this was brave - Don't shout or laugh at me)
If I put the following into the U8glib.cpp within the I2C init section, but before the prepare(), I can turn the port on for as long as I set the delay to, but as soon as the prepare() executes it turns it off again - I assume part of the init.
DDRB |= (1<<PB0);
PORTB ^=(1<<PB0);
_delay_ms(250);
HOWEVER, the display now works using the U8GLIB !!
Im not fully satisfied this is a valid fix as I am wondering if the display now works down to some persistence in that the power to the pin is only off for a short while after I force it on and its reset by the prepare() then it comes back on again when I set it high in the void setup();
Ive tried following the prepare() in U8glib.cpp to U8glib.h then to U8Init in u8g.h but my knowledge has expired by this stage
Can anyone offer any thoughts or suggestions as to what is happening here and where I might look next
Ric