Canada
Asked — Edited

Setup OLED I2C Display With EZ-B V4

I need help with setting up an I2C OLED display with the EZ-B v4.  The display is connected to the EZ-B v4 based on my understanding of the pin outs on the EZ-B I2C slot as per the manual.  The display doesn't seem to light up (not sure if it should) and I have no idea which skill I use to enable sending of text and EZ-B display information to the display. The display uses an SSD1307 Driver and the only datasheet I can find online is attached but not sure if it's the correct one?   SSD1307.pdf


Related Hardware EZ-B v4

ARC Pro

Upgrade to ARC Pro

ARC Pro is more than a tool; it's a creative playground for robot enthusiasts, where you can turn your wildest ideas into reality.

PRO
Canada
#1  

Hello @gjohal,

There is no skill in ARC for that display but you should be able to write an I2C script to communicate with it. Those displays usually operate at 3.3V so you can connect directly to the EZ-Bv4 I2C ports using SDA, SCL, 3.3V and GND.

You can likely port some Arduino (wiring) code over to Python or Javascript in ARC to make it work.

Those types of OLED displays don't light up until you send them the correct commands to turn on a pixel.

The SSD1306 is the more common type of this kind of OLED display, you may find more support for it out there.

Canada
#2  

I will try doing that and may need some help depending on how it goes. I double checked the wiring and it's correct so good to know it normally doesn't show a welcome screen when power is supplied.

Canada
#4  

Thanks DJ, I will try out this week and reply here with results and questions depending on how it goes.

Canada
#5  

I finally did some more testing and I am still unable to get the display to work.  I verified the datasheet I have is correct but I get errors when trying to send and commands in the console.  Here is the recommended Software Initialization that is recommended:

void Init_IC() { Write_Command(0xAE); //Set Display Off Write_Command(0xD5); //Display divide ratio/osc. freq. mode Write_Command(0xA1); Write_Command(0xA8); Write_Command(0x1F); Write_Command(0xD3); //Set Display Offset Write_Command(0x23); Write_Command(0x40); //Set Display Start Line Write_Command(0xA1); //Segment Remap Write_Command(0xC8); //Set COM Output Scan Direction Write_Command(0xDA); //Set SEG Pins Hardware Configuration Write_Command(0x12); Write_Command(0x81); //Contrast control Write_Command(0x40); Write_Command(0xD9); //Set pre-charge period Write_Command(0x51); Write_Command(0xDB); //Set VCOMH Write_Command(0x20); Write_Command(0xA4); Write_Command(0xA6); //Set Normal Display Write_Command(0xAF); //Set Display On }

I can't get this to work as the first line doesn't define the value for init_ic() and I can't find what that value should be.  I also tried just the I2C commands in different variations but still get errors:

Attempt 1 I2C.write(0111100,00, [ezbIndex]) print(hello world)I2C.

Result Line 2: Unexpected identifier Done (00:00:00.0509233)

Attempt 2 I2C.write(0111100,00, [ezbIndex]) print("hello world")I2C.

Result Line 2: Unexpected identifier Done (00:00:00.0039224)

Attempt 3 I2C.write(0111100,00, [ezbIndex]) I2C.print("hello world")

Result Execution Error Line 1 Col 0 - ezbIndex is not defined Done (00:00:00.0084271)

Attempt 4 I2C.print("hello world")

Result Execution Error Line 1 Col 0 - Object has no method 'print' Done (00:00:00.0116615)

I am unsure of what command I should be using first so any help would be great.  I can send all the datasheet files if needed.

PRO
Canada
#6  

As your error suggests, your EZB index is not defined. Instead of writing [ezbIndex] you need to have [0]. Where 0 represents the EZB number you are connecting to in the connection skill.

Canada
#7  

Thanks for the reply Jeremie.

I am not sure which number to use as I am connecting to the 1st I2C port for the display. I tried changing [ezbindex] to [1] and [3] or even [I1] or [i2c] but I just get a different error:

I2C.write(0111100,00,[1]) print(hello world)I2C.

Result Execution Error Line 1 Col 0 - No public methods with the specified arguments were found.

I2C.write(0111100,00,[i2c]) print(hello world)I2C.

Result Execution Error Line 1 Col 0 - i2c is not defined

I know the Digital ports are D0-D23, but what do I use for the I2C ports?

PRO
Canada
#8   — Edited

It seems that you are placing a binary value for the I2C address, use hex, and using square brackets around the EZB index which aren't needed. Normally you are connecting to the EZB index 0 in the connection skill, unless you are connecting to 1 or 3 purposefully, keep that in mind.

There is no javascript print command, rather you'll want to use writeString.

Here's a javascript code sample:

I2C.write(0x3C, 54, 0);
I2C.writeString(0x3C, "hello world");