Second I2C question for ESP

I’m trying to use the onboard display with another I2C for my peripherals. But as soon as I enable the display (Heltec.begin(true, false, true);), the I2C that I started with Wire1.begin(SDA,SCL) stops working. How do I get both working at the same time?

The first thing to do is to get rid of the Heltec.h library and use a different library to drive your display. There are a couple of options presented in the following thread:


If you’re still having trouble after that, let us know what module you are using.

Thanks for the quick response. I’m using a Heltec wifi lora esp32(V2). I downloaded the library you suggested but can’t get it to work with I2C, even after declaring (#define SDA 4 and #define SCL 15). I would actually like to use SPI so I can use I2C for other peripherals. I can’t understand the nomenclatures for the function pins. The library has CLK, MOSI (DOUT), RES, DC and CS. However the pinout descriptions for V2 have CLK, MISO, MOSI and CSO.

As a side note, can I run different frequencies on the LoRa by just changing the antenna or do I need a board that matches also( 433 or 915)?

You need a matching board. The configuration/layout of the radio components is tuned to a specific frequency band.

Thanks for the quick response. I’m using a Heltec wifi lora esp32(V2). I downloaded the library you suggested but can’t get it to work with I2C, even after declaring (#define SDA 4 and #define SCL 15). I would actually like to use SPI so I can use I2C for other peripherals. I can’t understand the nomenclatures for the function pins. The library has CLK, MOSI (DOUT), RES, DC and CS. However the pinout descriptions for V2 have CLK, MISO, MOSI and CSO.

It’s a bit difficult to comment any further without knowing what it is you’re actually trying to do and seeing the code you are trying to use.

The only problems I’ve ever had using the I2C interface (for multiple peripherals, using either the same of different I2C buses) have been associated with specifying the correct pins for the wire instantiations and ensuring that the peripherals are actually being powered. The latter should not be an issue with the on-board OLED display.

I haven’t used the SPI interface for anything much more that the radio, and where I’ve had to specify pins (in [non-Heltec] cases where I’ve been using an ‘external’ radio), they are exactly as would be expected. So I’ve no idea what library you might be referring to.

Lets start with some basics, can my heltec wifi lora esp32(v2) work with the onboard display, external I2C and Lora at the same time? If so can you give me an example program. Thanks!

Let’s start with you doing the work instead of us! Yes it can work, you provide a code that does two of the three (you can definitely get there) and we point out what you may need to change for the third point. We don’t get paid to help you! :slight_smile:

I certainly didn’t want you to write code for me. I just thought that you had more availability to other programs and could send one to me(I hate to reinvent the wheel). I’ve taken another approach and just started to slowly piece together blocks of code and have a question. If I set the ESP RTC and then compile and download another program, the RTC is reset to “Thursday, January 01 1970 01:00:00”. Is it normal that the ESPRTC reset when a new program is downloaded? I’m using the esp32_time example and “rtc.setTime”, then remming that out and downloading again.

If there’s a power loss (which also happens during a reset after downloading code), the RTC also doesn’t know the time, as it has no power! So yes, that is normal. You would need an external RTC or sync time using NTP. But that’s something for at the very least another topic but actually something for the main Arduino or Espressif forum.