To be visible for a I2C scanner the device must sent the ACK response. However some SSD1306 based OLEDs do not sent this response. U8glib can handle this with a special option to the I2C constructor, however the OLED will be invisible for the scanner.
Oliver
Ok, I can understand that. Part of my problem is I do not know the address of the device as I was not able to get any info from the seller. I am not even sure I have it hooked up correctly as I see some others that need power to 2 different terminals to operate. I guess I chose the wrong display to purchase. I am using the Adafruit libs.
Can you suggest something that has been tried and works.?? Just looking for something simple to play with. I have some Nano's and Uno's that I bought to play with. I did buy some of the I2C backpack's to go with the 4x20 display's I already have and those I was able to get going.
Mike, I have a few of those displays from "Alice". I have only used them in SPI mode but the 1306 controller supports two possible I2C addresses, 3C or 3D. It should be easy enough to try them both.
edit: Out of curiosity, what resistor values did you use for the jumpers?
I moved one of the 4.7k jumper resistors and pulled another 4.7k resistor off a discarded board and used that (much fun, used mag headset). In my previous message I posted how I hooked it up, not sure if that is correct as I read somewhere that there are 2 lines that should have power on them. I am not sure if the 'DC' pin should be pulled up or powered. I have found limited info besides the data sheet. The data sheet shows a 31 pin ribbon and mine seems to have a 30 pin ribbon.
Still going to play a bit for now (that's what it's all about) and maybe later grab another one.
Tnx, Mike..
According to the data sheet, D/C=A0 in I2C mode. So if you wired it high (or pulled it up) the address should be 3D instead of 3C. It sounds like you have the other pins wired correctly as well. SCL = D0 and SDA = D1. It would be nice to have a schematic.
I found that I needed to give this display a reset pulse for it to work. I doubt that wiring it for I2C changes that. Maybe a simple RC circuit will function if you don't have a spare I/O pin for reset.
One of the example programs installed with the adafruit lib uses one of the digital outputs to reset the display, wonder if I need a pull up resistor on that line. Other info said to not rely on the power from the arduino (3.3v) as the display may load it down. I have an external switcher that runs off the 5v and makes more 3.3 to power the display.
I will have to check the example and see what add it is trying to talk to, may have to adj that. have another 4hrs before I am back home to try.
I just want to do this with i2c because I have some other i2c stuff and can move it to other projects to learn. I did build a port expander nad played with it on a raspberry Pi, can put it on the arduino also.
If you use an I/O pin you don't need a pullup. You write the reset line low at initialization and then you set it high. If you have a spare I/O pin that's the easiest way to do it.
I measured the current on my display at 9.7mA (Vcc=5V) with all the pixels lit. I was driving it with an I/O pin.
On another project I used an Adafruit OLED. For power savings I turned off Vcc, shutting down the OLED completely. But with this Alice OLED I found it doesn't work. When Vcc=0V the display remains on, drawing power from the other pins. The only way I could find to shut it off was to drive all of the pins low, including SCK and MOSI. So I can't use it in the same way as the Adafruit version.
Well, gave it another shot and still nothing. I tried changing the DC line, still nothing.
I did connect up my Bitscope and the signals are ok. I also loaded another sketch that uses the i2c 4x20 display (which was still connected with the oled) and all runs.
I'll have to research the Spi thing and change it back to try that way, maybe I just got a dud.
I don't know. I've stared at the traces on that display and probed with an ohmmeter (I have one that I blew up and so have access to the front of the PCB as well) and I couldn't quite figure it out. So I've been hesitant to try to jumper one for I2C. I know they're only $4 each. But it would be nice to have a schematic or at least a short set of instructions.
Have you tried emailing the Alice people and asking?
jboyton:
Mike, I have a few of those displays from "Alice". I have only used them in SPI mode but the 1306 controller supports two possible I2C addresses, 3C or 3D. It should be easy enough to try them both.
edit: Out of curiosity, what resistor values did you use for the jumpers?
Can you tell me the the SPI connections between the display and the arduino.??
I have to take the day off tomorrow and will have some time to give it another try in SPI.
I couldn't resist jumpering one of my cheap little displays to I2C mode....
It came up blank.
The Adafruit displays work in I2C. They do cost about 4X as much though. And the form factor is a little bigger. It's actually that last thing that is an issue for me. I filed down the edges of my Adafruit OLED to barely fit it into a project, but I could only go so far with the filing, or at least I thought I could. The Alice displays have a smaller footprint.
I took the time to trace everything on that board. So I have, in effect, a schematic now.
The key elements are:
R2/R4 selects BS0=1/0
R1/R3 selects BS1=1/0
R5 must be a resistor (it's a pull-down for IREF)
R6 and R7 are 4.7K pull-ups for SCL/SDA (or SCK/MOSI): needed for I2c; for SPI?
R8 connects D1 (SDA or MOSI) and D2 together: needed for I2c; must be NC for SPI
BS2 is connected to ground
For SPI you want BS0-2 = 0,0,0 so that means R4 & R3 but not R2 or R1. We know this works.
For I2C you want BS0-2 = 0,1,0 so that means R4 & R1 & R8 but not R2 or R3. We both know this doesn't work!
Just in case their cable somehow connected the BS0-2 pins a little differently (the datasheet is weird on this subject), I tried R2 & R3 for I2C. But it didn't work either. So I don't know what the problem is with their board.
I also lost a couple of those tiny surface mount resistors. In both cases I set them on the table and forgot about them for a minute. In that minute they disappeared forever. But it doesn't matter since R1, R2, R3, R4 and R8 don't need to be resistors. You can use a little piece of wire or even a solder bridge.
I put my board back into SPI mode (with solder bridges) and will probably leave it that way forever... unless I hear about some new idea from you.
jboyton:
I got the "Alice" display to work in I2C mode.
Hi jboyton
Can you advise a bit more on what constructor and/or what code you ran to get this configuration to work? Also you note a connection to D9 for the reset. What does one do with D9?! internat pullup or something else?
I've modified the board as you suggested but still nothing doing!
Joss:
Can you advise a bit more on what constructor and/or what code you ran to get this configuration to work? Also you note a connection to D9 for the reset. What does one do with D9?! internat pullup or something else?
D9 just means digital pin 9 on an Uno. But it could be any line, either controlled by a microprocessor or other hardware, that provides a reset pulse at startup.
I didn't use the u8glib library in my test and I'm not familiar enough with it to suggest a constructor. Maybe Oliver can help you with that. Or you could try the library and sketch I used. In any case, you need a reset or else the display won't work.
edit: The Adafruit library comes with an example "ssd1306_128x64_i2c". In that example reset is connected to pin 4 (instead of 9). If you use that example code and make sure RES = pin 4, CS = GND and D/C = VCC, then it should work.
olikraus:
I made a note that for you the adafruit2_init_seq works. Maybe i should change the default in U8glib to this sequence.
The ".print" in U8glib is identical. It is the same code as used for the serial interface. However, the fact that U8glib needs the draw command inside a "picture loop" usually requires some redesign.
I have been using an i2c 128z64 oled succesfully with my teensy lc with the adafruit gfx drivers. However, I would like to utilize the u8g. I have set the correct address (it's 3c) but cannot get it to fire up
I've tried the rest function that aaronpbrooks mentioned earlier, so I added this in my setup:
// Setup reset pin direction (used by both SPI and I2C)
pinMode(A4, OUTPUT);
digitalWrite(A4, HIGH);
// VDD (3.3V) goes high at start, lets just chill for a ms
delay(1);
// bring reset low
digitalWrite(A4, LOW);
// wait 10ms
delay(10);
// bring out of reset
digitalWrite(A4, HIGH);
// turn on VCC (9V?)
I have SDA on A4, and SCL on A5, perhaps I need to set that somewhere in a config? The adafruit library works fine, but I find it on the slow side. I have also tried both config 2 and 3, which is mentioned earlier in this thread as well.