The hardware I2C for second display with WiFi LoRa 32 (V2)

I know. I know. Dev-board with OLED display is made to use this display, instead of disconnecting it :-).
You wrote about OLED in WiFi LoRa 32 (V2): “can be used to display debugging information, battery power, and other information”. But I need to connect to this Dev-board a much larger display. The original, 0, 96" can work but does not have to. Now I have both displays connected and working, but the larger display is connected via software I2C. So it is very slow.

I do not know if I read the Dev-board pinout diagram well, I do not see the possibility of connecting a second display through the hardware I2C port. But I can be wrong.

Can I “turn off” this 0.96 ‘’ OLED display and use the SPI pins that are now used by it?

Tomasz

Refer to this example code to use another hardware I2C bus.

The Onboard OLED uses I2C0 (Wire), for another I2C display, you can use I2C1 (Wirel1).

:frowning: . There is nothing connected to the Dev-board.

But, if the attached code would show me the correct address, which Dev-board pins are marked SDA and SCL? I know that SDA_OLED is GPIO4 and SCL_OLED is GPIO15.

Tomasz

To be sure, here is the code with the changes, that gives the above record from the Serial.

Because you didn’t connect any device on the I2C bus, so can’t get any address feedback. The attached code just show you how to config use another I2C bus.

ESP32 have IO_MUX function, any GPIO can be config to I2C bus.

Before running this code, the second display was attached.

I even tried on a few free ports. each time in Wire1.begin enter the GPIO to which the second display was connected. When I connect this display to the same GPIO with software I2C , it works.

You mean the system can detect another display, but can’t make it running?

Thanks for the answer. Exactly. I guess it’s a matter of using the olikraus u8g2 library, not the problems with the Heltec Dev-Board.

As Olikraus writes, his u8g2 library is based on the Arduino Wire library. If I understand correctly when using Wire1, there is no simple way to specify the port numbers to which the display is connected. Unfortunately, my knowledge is too small to change something in .h or .cpp files. I asked olikraus for help, I hope that thanks to his help I will be able to use the second display connected through the hardware I2C.

Tomasz

I have a question about your I2C scanner. Both for Wire and for Wire1, your scanner shows exactly the same address - 0x3C. (I enclose the pictures, so as not to confuse the entries, I added “on Wire” and “on Wire1” to the information displayed by the scanner.)

On the display, I have the option to change the address, but they are completely different - 0x7A or 0x78.

Maybe this is normal, but none of this is clear to me :-(.

Because OLED’s I2C register is 7 bits, ESP32 have a 8 bit I2C register. So:
0x3C == 0x78 >> 1

1 Like

It seems that connecting two displays to this Dev-board is not easy at all. Here is what olikraus wrote to me:

One precondition for the second I2C interface is a proper definition of WIRE_INTERFACES_COUNT by the ESP32. The value for WIRE_INTERFACES_COUNT must be 2 or higher, denoting, that there is an additional Wire object called “wire1”.

If this interface count is only 1, then the 2nd wire interface callback evaluates to the empty function (and obviously will not do anyting): https://github.com/olikraus/u8g2/blob/master/cppsrc/U8x8lib.cpp#L1182

EPS32 defines a Wire1 object: https://github.com/espressif/arduino-esp32/blob/master/libraries/Wire/src/Wire.h#L137
However, it does not tell, that such an object exists.

Compare, for example STM32 Arduino software: https://github.com/rogerclarkmelbourne/Arduino_STM32/blob/master/STM32F1/libraries/WireSlave/src/Wire_slave.h#L37

As a workaround we could check for ESP32 environment (question: How to do this?) and enable the 2nd I2C interface.

Maybe this works. After this line


add the following code:

#if defined(ARDUINO_ARCH_ESP32)
#define U8X8_HAVE_2ND_HW_SPI
#endif     

Maybe if I used a different library to operate the second display, connecting it to WiFi LoRa 32 would be easier. However, the u8g2 library has many advantages. I can not find any similar.

I am thinking of changing the LoRa module to one without a display. In order not to change an almost ready, large program, I would need dev-board with ESP32, the option of connecting and charging the battery and - of course - without a display.
In your offer according to the table:


meets these conditions only “Wireless Stick Lite”, but… in its technical specification is information that it has a display:

Which Wireless Stick Lite description is true?

I wrote a simple code to drive two display, just connect the second display with the main display in the same I2C bus (SDA – GPIO4, SCL – GPIO15):

#include "Arduino.h"
#include "heltec.h"

void setup()
{
	Heltec.begin(true, false, true);
}

void loop()
{
	Heltec.display->init();
	Heltec.display->flipScreenVertically();
	Heltec.display->setFont(ArialMT_Plain_10);
	Heltec.display->drawString(20, 20, "Hello display 0");
	Heltec.display->display();

	delay(2000);

	Heltec.display1->init();
	Heltec.display1->flipScreenVertically();
	Heltec.display1->setFont(ArialMT_Plain_10);
	Heltec.display1->drawString(20, 20, "Hello display 1");
	Heltec.display1->display();
	delay(2000);
}

You need also fix the library source code:

And you need to fix the second display’s I2C address:

I am truly grateful for your time.
But … my display is 128 x 128, not 128 x 64, and it has a different display controller - SSD1327, not SSD 1306.

Now, both displays are visible:

Serial initial done
you can see OLED printed OLED initial done!
Scanning…
I2C device found at address 0x3C !
I2C device found at address 0x3D !
done

What I provide is a solution to the problem, you can solve your own problems according to the ideas.:grinning:

OK Thanks. :wink: And wat with display in Wireless Stick Lite? Which site of your website is telling the truth? Is there a display or not?

Oh, I had fixed that mistake, sorry for forgot to tell you.

There is no display on the Wireless Stick Lite

so how can we use OLED 0.96’ with wireless stick lite?Does it support OLED display?