I2C OLED thread

Quad FRITZ
Posts: 44
Joined: Wed Apr 25, 2012 11:21 pm

Re: I2C OLED thread

Post by Quad FRITZ »

Awesome-
great idea- just put a mix on a unused switch and assign a stick combo- this way I will not use an extra channel!
Perhaps program it that way that the mix is disabled as soon as there is throttle input also- otherwise one also could name it the "flip switch" ;-)
Thanks!

hudibras
Posts: 1
Joined: Thu May 23, 2013 2:54 am

Re: I2C OLED thread

Post by hudibras »

ardufriki wrote:
ardufriki wrote:Checking deeply this in the datasheet, there are two wires coming from the sd1306 controller, but in this oled only the SDIN is connected. If you join SDOUT to SDIN it should send the ACK (not tested, dificult to solder...).


Hi, I´ve got the ACK from the SSD1303 chip inside our OLED(seen in logic analyzer). Just joining pins 19 and 20 with a drop of soldering (no so hard to do). Now it works fine with Adafriut libraries and other Arduino skectches.


Thanks for your help, that did the job. Had made reset circuit, but this did the trick.

llima31
Posts: 1
Joined: Wed May 29, 2013 10:47 am

Re: I2C OLED thread

Post by llima31 »

Hello, first of all great thread, there is a lot of usefull info here

I also bought one of these displays, I implemented the RC circuit modification, and the random dots issue went away, but there is another issue in my case.
Everytime I power up the quad, it enters the configuration mode (I can see it in the display), and when I exit the configuration mode, it sort of reboots, and enters again in the configuration mode, everytime I exit the cnfig mode it does it again.

Could this be solved with the ACK modification, joining pins 19 and 20, or could it be a MultiWii configuration issue?
Also regarding the ACK modification, should the pins be joined in place, or must any one of them be unsoldered from the board?

Thank you in advance

Lima

Antscran
Posts: 1
Joined: Thu Aug 29, 2013 12:51 pm

Re: I2C OLED thread

Post by Antscran »

Hi all,

Just read this post all the way through to see where I am going wrong or if the display is faulty. I am just trying to connect to an Arduino Uno to start with.

I have a no display issue, not even the random dots issue which seems to be the main cause for concern, have tried several software samples including the one posted earlier by 'dominicclifton' here https://github.com/hydra/UG2864HSWEG01

I have also tried the 100 Ohm resistor trick, and double checked the connections 5V, Gnd, SDA (Arduino A4) and SCL (Arduino A5).

I am going to try the pin 14 reset fix (posted by jgarnham47) next but out of idea's after that, any further tips anyone can offer as a potential solution?

Cheers,

Ant

keepitsimple
Posts: 3
Joined: Tue Oct 29, 2013 8:32 pm

Re: I2C OLED thread

Post by keepitsimple »

Antscran wrote:Hi all,

Just read this post all the way through to see where I am going wrong or if the display is faulty. I am just trying to connect to an Arduino Uno to start with.

I have a no display issue, not even the random dots issue which seems to be the main cause for concern, have tried several software samples including the one posted earlier by 'dominicclifton' here https://github.com/hydra/UG2864HSWEG01

I have also tried the 100 Ohm resistor trick, and double checked the connections 5V, Gnd, SDA (Arduino A4) and SCL (Arduino A5).

I am going to try the pin 14 reset fix (posted by jgarnham47) next but out of idea's after that, any further tips anyone can offer as a potential solution?

Cheers,

Ant


Hi,

try enabeling the internal pullups, seems that the crius has none. (very wise)
SCL and SDA will never go high 8-)


Code: Select all

void i2c_init(void) {
//  #if defined(INTERNAL_I2C_PULLUPS)
    I2C_PULLUPS_ENABLE
//  #else
//    I2C_PULLUPS_DISABLE
//  #endif
  TWSR = 0;                                    // no prescaler => prescaler = 1
  TWBR = ((F_CPU / I2C_SPEED) - 16) / 2;   // change the I2C clock rate
  TWCR = 1<<TWEN;                              // enable twi module, no interrupt
}


regards from hans

flyman777
Posts: 55
Joined: Mon Sep 19, 2011 1:44 pm

Re: I2C OLED thread

Post by flyman777 »

Hi all Oled users,

OK that is warm beer !
I tried to make my Crius V1.0 Oled working , i had just a snow storm on the screen.
Then i tried to hack with different pins of the connector with no relevant results.
I tried with a 1OO ohm resistor with success only at 25%.
I tried with software mods, no result.
Then i remember that EdAmps (Sat Apr 06 2013) had introduced a power startup delay of 1.5 seconds for the Oled device. This feature had no reply in this threat.
So i mounted on a prototyp board this circuit with a NE55 and look that is great, it work's with 100% reliability.
I made a schema layout for those who are not confident with this chip, it uses only 5 components and is very fast to build (for me 30 minutes).
The circuit is inserted between the power supply i2c-Oled lines (+5V - GND), SDA and SCL remains continuous.
You can find the Eagle files in attaching ZIP.
Hope this can help someone and thanks again to EdAmps.

Cheers
Claude
Attachments
Power_Up_Delay_555.zip
(74.99 KiB) Downloaded 539 times

o_lampe
Posts: 117
Joined: Sat Nov 02, 2013 5:09 pm

Re: I2C OLED thread

Post by o_lampe »

I've just read the whole thread and was wondering, if it would be possible to use an unused ATMega output pin as 5V source for the OLED?
This way, a delayed powerup for the OLED would be done with a few lines of code.
How much is the current consumption of the OLED?

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: I2C OLED thread

Post by Hamburger »

Never had any such poweron ti.ing problems with any of my 0.96 i2c oleds of this type. I got mine from wide.hk is the obvious difference but do they really sell a different product?

jsystem
Posts: 3
Joined: Sat Jan 31, 2015 5:03 pm

Re: I2C OLED thread

Post by jsystem »

fyi, my Crius CO-16 version v1.2 works like charm with NAZE32/cleanflight without any modifications. Seems the issue solved from v1.2

Lecostarius
Posts: 46
Joined: Mon Oct 20, 2014 11:29 pm

Re: I2C OLED thread

Post by Lecostarius »

All,

not power-up related, but in case you want to use the OLED and control the row and column when printing characters to the screen and want to use the 8x5 font that is supplied with the MWii code, the function that sets the cursor position is not right. It looks like this (in LCD.cpp):

Code: Select all

void i2c_OLED_set_XY(byte col, byte row) {        //  Not used in MW V2.0 but its here anyway!
  i2c_OLED_send_cmd(0xb0+row);                //set page address
  i2c_OLED_send_cmd(0x00+(8*col&0x0f));       //set low col address
  i2c_OLED_send_cmd(0x10+((8*col>>4)&0x0f)); 


This is fine for a 8x8 font, but not for the 8x5 font that MultiWii uses. If you change the two constants '8' in the last two lines to '6', all is fine.

Cheers, Leco

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: I2C OLED thread

Post by Hamburger »

ok, noted for later repairs.
Thank you.

Maine_Guy
Posts: 27
Joined: Fri Mar 06, 2015 7:07 pm

Re: I2C OLED thread

Post by Maine_Guy »

OK, if anyone else is tinkering around with a OLED board - I found the init function in LCD.cpp needed to be changed. I borrowed this from another program (GOFi2cOLED) - but it makes my screen work.

In lcd.cpp find this function and replace it with the code below - not sure how this initializes differently, too lazy to figure out. It works.

Code: Select all

void  i2c_OLED_init(void){
  delay(5);                    //wait for OLED hardware init

  //////////////////////////////////////////////////////////////////////////////////////////////////added
   delay(5);  //wait for OLED hardware init
// constructor(128, 64);

 i2c_OLED_send_cmd(0xAE);    /*display off*/
 i2c_OLED_send_cmd(0xA8);    /*multiplex ratio*/
 i2c_OLED_send_cmd(0x3F);    /*duty = 1/64*/

 i2c_OLED_send_cmd(0xD3);    /*set display offset*/
 i2c_OLED_send_cmd(0x00);


 i2c_OLED_send_cmd(0xB0);   //set page address
 i2c_OLED_send_cmd(0x00);   //set column lower address
 i2c_OLED_send_cmd(0x10);   //set column higher address

// setHorizontalMode();        /*set Page Addressing Mode*/
     i2c_OLED_send_cmd(0x20);   //set addressing mode
     i2c_OLED_send_cmd(0x00);       //set horizontal addressing mode

 i2c_OLED_send_cmd(0x40);    /*set display starconstructort line*/

 i2c_OLED_send_cmd(0x81);    /*contract control*/
 i2c_OLED_send_cmd(0xcf);    /*128*/

 i2c_OLED_send_cmd(0xA1);    /*set segment remap*/

 i2c_OLED_send_cmd(0xC8);    /*Com scan direction*/

 i2c_OLED_send_cmd(0xA6);    /*normal / reverse*/

 i2c_OLED_send_cmd(0xD5);    /*set osc division*/
 i2c_OLED_send_cmd(0x80);

 i2c_OLED_send_cmd(0xD9);    /*set pre-charge period*/
 i2c_OLED_send_cmd(0xf1);

 i2c_OLED_send_cmd(0xDA);    /*set COM pins*/
 i2c_OLED_send_cmd(0x12);

 i2c_OLED_send_cmd(0xDB);    /*set vcomh*/
 i2c_OLED_send_cmd(0x30);

 i2c_OLED_send_cmd(0x2E);

 i2c_OLED_send_cmd(0x8D);    /*set charge pump enable*/
 i2c_OLED_send_cmd(0x14);

 i2c_OLED_send_cmd(0xAF);    /*display ON*/

  delay(20);


 
/*old iit removed for now
 *
 *
  i2c_OLED_send_cmd(0xae);    //display off
  i2c_OLED_send_cmd(0xa4);          //SET All pixels OFF
//  i2c_OLED_send_cmd(0xa5);            //SET ALL pixels ON
  delay(50);
  i2c_OLED_send_cmd(0x20);            //Set Memory Addressing Mode
  i2c_OLED_send_cmd(0x02);            //Set Memory Addressing Mode to Page addressing mode(RESET)
//  i2c_OLED_send_cmd(0xa0);      //colum address 0 mapped to SEG0 (POR)*** wires at bottom
  i2c_OLED_send_cmd(0xa1);    //colum address 127 mapped to SEG0 (POR) ** wires at top of board
//  i2c_OLED_send_cmd(0xC0);            // Scan from Right to Left (POR)         *** wires at bottom
  i2c_OLED_send_cmd(0xC8);          // Scan from Left to Right               ** wires at top
  i2c_OLED_send_cmd(0xa6);            // Set WHITE chars on BLACK backround
//  i2c_OLED_send_cmd(0xa7);            // Set BLACK chars on WHITE backround
  i2c_OLED_send_cmd(0x81);            // Setup CONTRAST CONTROL, following byte is the contrast Value
  i2c_OLED_send_cmd(0xaf);            // contrast value between 1 ( == dull) to 256 ( == bright)
//  i2c_OLED_send_cmd(0xd3);            // Display Offset :
//  i2c_OLED_send_cmd(0x0);            // 0
//  delay(20);
//  i2c_OLED_send_cmd(0x40);            // Display start line [0;63] -> [0x40;0x7f]
//  delay(20);
  #ifdef DISPLAY_FONT_DSIZE
    i2c_OLED_send_cmd(0xd6);            // zoom
    i2c_OLED_send_cmd(0x01);            // on
  #else
//    i2c_OLED_send_cmd(0xd6);            // zoom
//    i2c_OLED_send_cmd(0x00);            // off
  #endif
  delay(20);
  i2c_OLED_send_cmd(0xaf);          //display on
  delay(20);

 */
}

User avatar
Hamburger
Posts: 2578
Joined: Tue Mar 01, 2011 2:14 pm
Location: air
Contact:

Re: I2C OLED thread

Post by Hamburger »

The original code does work for the displays mentioned in the config and wiki. You should at least mention which OLED board you have that requires that change.
I am currently too lazy to search for the changes you made.

Post Reply