Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working with Heltec Wifi Kit 32 #37

Open
ba58smith opened this issue Apr 24, 2018 · 14 comments
Open

Working with Heltec Wifi Kit 32 #37

ba58smith opened this issue Apr 24, 2018 · 14 comments

Comments

@ba58smith
Copy link

ba58smith commented Apr 24, 2018

This library is exactly what I'm looking for, but I tried your basic example (WireI2c128x64.ino) for the Heltec Wifii Kit 32 with .96" OLED display, and I can't get it to work. It compiles and downloads to the board without a problem, but never displays anything. I'm guessing it's because there's not a DevType defined for that board, and some of the initialization settings aren't correct. Ditto for the I2C pin's hex number. My problem, being pretty new to all of this, is trying to figure out how to modify an existing DevType to work with this board, and to determine its I2C pin hex number.

I tried both the AdaFruit DevType and the SH1106_128x64, with the same result: compiles and loads, doesn't display anything. I changed the reset pin to 16 (that's what it is on this board) - no help.

I ran a simple I2C scanner sketch on the board and it said "No I2C devices found" - but surely this OLED display has an I2C interface?

I've been able to get the board / display to work with the u8x8 library (part of the U8g2 library). (I would much rather user YOUR library, though!) The constructor that works from that library is U8X8_SSD1306_128X64_NONAME_SW_I2C. Here's what the constructor looks like, if that gives you any clues:
U8X8_SSD1306_128X64_NONAME_SW_I2C(uint8_t clock, uint8_t data, uint8_t reset = U8X8_PIN_NONE) : U8X8() {
u8x8_Setup(getU8x8(), u8x8_d_ssd1306_128x64_noname, u8x8_cad_ssd13xx_i2c, u8x8_byte_sw_i2c, u8x8_gpio_and_delay_arduino);
u8x8_SetPin_SW_I2C(getU8x8(), clock, data, reset);

This is the github page for the board itself. https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series

Here's the schematic of the board, showing the pins of the OLED - I'm hoping the answer is in here somewhere?
https://github.com/Heltec-Aaron-Lee/WiFi_Kit_series/blob/master/SchematicDiagram/WIFI_Kit_32_Schematic_diagram.PDF

What do I need to know to make this board work with this library? Thanks!

@Aggebitter
Copy link

// Some hints for heltec wifi lora
#include <Wire.h>
#include <U8x8lib.h>
U8X8_SSD1306_128X64_NONAME_SW_I2C u8x8(/* clock=/ 15, / data=/ 4, / reset= */ 16);

void setup{
pinMode(16, OUTPUT);
digitalWrite(16, LOW); // set GPIO16 low to reset OLED
delay(50);
digitalWrite(16, HIGH); // while OLED is running, must set GPIO16 in high

u8x8.begin();
u8x8.setPowerSave(0);
u8x8.setFont(u8x8_font_chroma48medium8_r);
u8x8.setCursor(0, 0);
u8x8.print("Hello World!");
}

void loop {

}

@ba58smith
Copy link
Author

Aggebitter,

Thanks for that, I'll try it. But to clarify, I have the Heltec Wifi Kit 32, NOT the Heltec LoRa Kit. And, more important, I have no trouble getting the board to work with the u8x8 library. It's the SSD1306Ascii library that I can't get to work.

@Aggebitter
Copy link

Have ju tryed the highlighted reset part?
If it uses the same oled noname ssd1306 as in the LoRa kit that might help.

Had strange issues before I did a manual reset

@greiman
Copy link
Owner

greiman commented Apr 25, 2018

Looks like the Heltec Wifi Kit 32 has the OLED connected to pins SDA = 4, SCL = 15, and RST = 16.

These are not the standard Wire pins. The Wire library uses SDA = 21 and SCL = 22.

The u8x8 library supports software I2C on any pair of pins. That's what SW_I2C means.

I didn't implement software I2C.

@ba58smith
Copy link
Author

greiman, that would certainly explain why it wouldn't work. Would you mind implementing the software I2C sometime today? 😀 No? OK - could I add or change a couple lines to your files somewhere to specify those different SDA and SCL pins? Or is it not that simple? Thanks so much! Your library seem so much easier to use - I'd really to be able to us it.

@greiman
Copy link
Owner

greiman commented Apr 26, 2018

No? OK - could I add or change a couple lines to your files somewhere to specify those different SDA and SCL pins? Or is it not that simple? Thanks so much! Your library seem so much easier to use - I'd really to be able to us it.

It looks like the ESP32 Wire library allows you to specify the pins for sda and scl in the Wire.begin() call.

See this link.

Try replacing the Wire.begin() line in the HelloWorldWire example with this:

Wire.begin(4, 15);

This assumes the Heltec Wifi Kit 32 uses standard ESP32 pin numbers.

If this works, it would be possible to modify SSD1306AsciiWire.h to use the second ESP32 I2C controller. This would require reading the code for the ESP32 Wire library.

@ba58smith
Copy link
Author

Thank you so very much! I'll give that a try.

@ba58smith
Copy link
Author

greiman,

That was it! Wire.begin(4, 15) made "Hello world!" show up. Thanks so much!

@SALLDHMF
Copy link

SALLDHMF commented Jul 7, 2019

Hi.
Unfortunately, I'm not as lucky as ba58smith ;-). Replacing Wire.begin () with Wire.begin (4, 15) in HelloWorldWire did not solve the problem of displaying texts (with your library) on Heltec LoRa 32. My module is very similar to Heltec Wifii Kit 32. OLED is also connected by I2C and also via pins SDA = 4, SCL = 15, and RST = 16.

Maybe I should change something else in the HelloWorldWire code?

My / Your code:

// Test for minimum program size.

#include <Wire.h>
#include "SSD1306Ascii.h"
#include "SSD1306AsciiWire.h"

// 0X3C+SA0 - 0x3C or 0x3D
#define I2C_ADDRESS 0x3C

// Define proper RST_PIN if required.
#define RST_PIN 16

SSD1306AsciiWire oled;
//------------------------------------------------------------------------------
void setup() {
Wire.begin(4, 15);
Wire.setClock(400000L);

#if RST_PIN >= 0
oled.begin(&Adafruit128x64, I2C_ADDRESS, RST_PIN);
#else // RST_PIN >= 0
oled.begin(&Adafruit128x64, I2C_ADDRESS);
#endif // RST_PIN >= 0

oled.setFont(System5x7);
oled.clear();
oled.print("Hello world!");
}
//------------------------------------------------------------------------------
void loop() {}

WIFI_LoRa_32_V2.pdf

Tomasz

@greiman
Copy link
Owner

greiman commented Jul 7, 2019

I don't see an obvious problem.

I can't find any info about the display. Since I don't have your hardware I can't do any tests.

@SALLDHMF
Copy link

SALLDHMF commented Jul 7, 2019

OK. I understand.
The layout of the pins was included in the PDF file in the first comment.

The display is 0.96-inch 128 * 64 dot matrix OLED display, with SSD1306 controller.

The module is https://heltec.org/project/wifi-lora-32/

What other information can help you diagnose the problem?

@SALLDHMF
Copy link

SALLDHMF commented Jul 7, 2019

@greiman
Copy link
Owner

greiman commented Jul 8, 2019

I looked at the schematic and other info before the last post.

I can't do more with no hardware.

This is from an example that looks for the OLED.

Add these includes:

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

replace:

  Wire.begin(4, 15);
  Wire.setClock(400000L);

With:

    Heltec.begin(true, false, true);
    Wire.begin(SDA_OLED, SCL_OLED); 

Try to run this example.

It should give the I2C address. Maybe Heltec used the alternate SSD1306 address.

@SALLDHMF
Copy link

SALLDHMF commented Jul 8, 2019

Yes. I have "Hello world!" On the display.

Thank you so much for help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants