[solved] Grove 1.12" OLED Display not working with Arduino Uno WiFi Rev2

Hi!

I'm pretty new to Arduino building and I'm facing some trouble getting an OLED display working with my Arduino Uno WiFi Rev2.

Display specs: Grove OLED Display 1.12", 128x128, SH1107G driver IC, Interface I2C, Supply voltage 3.3/5V

I have tried both Grove's own driver and U8g2 drivers and their "Hello World" examples but neither of them work. The code compiles, but they both give the same error message:

avrdude: Short read, read only 0 out of 64 bytes
avrdude: jtag3_edbg_recv(): Unexpected response 0x12
avrdude: retrying with external reset applied
avrdude: jtag3_edbg_send(): Unexpected response 0x81, 0x11
avrdude: jtag3_edbg_recv(): Unexpected response 0x80
avrdude: retrying with external reset applied
avrdude: JTAGEN fuse disabled?
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.

avrdude: jtag3_edbg_send(): Unexpected response 0x81, 0x11
avrdude: jtag3_edbg_recv(): Unexpected response 0x80
avrdude: jtag3_edbg_send(): Unexpected response 0x81, 0x11
avrdude: jtag3_edbg_recv(): Unexpected response 0x80
avrdude: jtag3_edbg_signoff(): unexpected response 0x81, 0x11
avrdude: jtag3_edbg_signoff(): unexpected response 0x01, 0x00
An error occurred while uploading the sketch

For the U8g2 example I have used the controller line:
U8X8_SH1107_SEEED_128X128_SW_I2C u8x8(/* clock=/ SCL, / data=/ SDA, / reset=*/ U8X8_PIN_NONE);

The display has a Grove wire attachment and it has 4 pins:

BLACK: GDN
RED: VCC
WHITE: SDA
YELLOW: SCL

The connections to my Arduino are as follows:

black to GND, red to 5V (have tried 3.3V also), white to SDA and yellow to SCL. For the SDA and SCL I have also tried using A4 and A5.

The display starts heating up as soon as i plug the power to my Arduino via USB, which makes me think is the display shorted or something?

The Arduino works fine on other projects and sensors so atleast it is not broken.

Here Are the example codes that I used:

Grove's own example:

#include <Wire.h>
#include <SeeedGrayOLED.h>
#include <avr/pgmspace.h>


void setup()
{
  Wire.begin();
  SeeedGrayOled.init(SH1107G);             //initialize SEEED OLED display
  SeeedGrayOled.clearDisplay();     //Clear Display.
  SeeedGrayOled.setNormalDisplay(); //Set Normal Display Mode
  SeeedGrayOled.setVerticalMode();  // Set to vertical mode for displaying text
  
  for(char i=0; i < 16 ; i++)
  {
  SeeedGrayOled.setTextXY(i,0);  //set Cursor to ith line, 0th column
  SeeedGrayOled.setGrayLevel(i); //Set Grayscale level. Any number between 0 - 15.
  SeeedGrayOled.putString("Hello World OLED"); //Print Hello World
  }
}

void loop()
{
  
}

U8g2 example:

#include <Arduino.h>
#include <U8x8lib.h>

#ifdef U8X8_HAVE_HW_SPI
#include <SPI.h>
#endif
//U8X8_SH1107_SEEED_128X128_SW_I2C u8x8(/* clock=*/ SCL, /* data=*/ SDA, /* reset=*/ U8X8_PIN_NONE);
//U8X8_SH1107_SEEED_128X128_HW_I2C u8x8(/* reset=*/ U8X8_PIN_NONE);



void setup(void)
{
  /* U8g2 Project: SSD1306 Test Board */
  //pinMode(10, OUTPUT);
  //pinMode(9, OUTPUT);
  //digitalWrite(10, 0);
  //digitalWrite(9, 0); 
  
  /* U8g2 Project: KS0108 Test Board */
  //pinMode(16, OUTPUT);
  //digitalWrite(16, 0); 
  
  u8x8.begin();
  u8x8.setPowerSave(0);
  
  
}

void loop(void)
{
  u8x8.setFont(u8x8_font_chroma48medium8_r);
  u8x8.drawString(0,0,"Hello World!");
  u8x8.refreshDisplay(); // only required for SSD1606/7  
  delay(2000);
}

Thanks in advance for any help You can provide!

Which board do you use?
I have successfully tested the Grove OLED with the SH1107 controller and the Arduino UNO board (Seeed Grove Version).

Oliver

This is the board:

Although it uses the Arduino Uno form factor, it's based on the ATmega4809 and uses a different hardware core than the Uno:

The ATmega4809 is also used in the new Arduino Nano Every. It would be great to see more 3rd party library authors provide support for the ATmega4809. I think with the release of the low cost Nano Every, we're going to see more widespread adoption of the ATmega4809 in the Arduino community. There is also a nice 3rd party core in the works that will add support for the entire megaAVR-0 series:

Ok, I have not tested U8g2 with this kind of controller, but U8g2 is just based on the Arduino HAL, so I expect that this new controller works as expected. Can someone confirm, that U8g2 works with the ATmega4809?

Oliver

Your U8g2 library examples work fine on a Nano Every. (ATmega4809)

I don't have SH1107G display.

I would expect any hardware SPI or I2C to work on any target (if U8g2 uses SPI.h or Wire.h)
I would expect any bit-banged SPI or I2C to work on any target (if U8g2 uses pinMode(), digitalWrite(), digitalRead() )

All Arduino targets should have SPI.h and Wire.h also pinMode(), digitalWrite(), digitalRead()

David.

Thanks David.
I also would expect, that U8g2 works with any board as long as Wire.h and SPI.h are compatible.

Oliver

Hi, thanks for the answers. I still haven't figured out the cause of the problem, but I managed to get the display working. I noticed that I can upload the code to the board if the display is not connected. Then after uploading the code, the display can be connected and it runs the code normally. For some reason the code won't upload if the display is connected.

Follow up question: I could not find any method of increasing the font size of text/numbers on the display in neither example library. Do you have any advice on that matter? Example code perhaps?

Jsmiter:
Follow up question: I could not find any method of increasing the font size of text/numbers on the display in neither example library. Do you have any advice on that matter? Example code perhaps?

I think none of the existing embedded libs allow scalable fonts (as you known them from Windows). There are two reasons for this: Automatic scaling looks bad on pure monochrome displays (you need at least a grayscale display) and second, flash memory and uC performance is limited: A lib like freetype (for font scaling) will not fit at into 32KB of an embedded uC. Instead u8g2 includes precalulated fonts for different sizes and also many hand crafted fonts for different sizes.

For example, have a look here: fntgrplogisoso · olikraus/u8g2 Wiki · GitHub. Logisoso is a scaleable TTF font, but instead of a on-the-fly scaling, u8g2 includes multiple fonts of different sizes.

The X11 fonts here are manually tuned for a monochrome display. Again they are available in different sizes, but the number of sizes is limited. However, they may look better than logisoso font (which was scaled automatically).

In general I suggest to look at the overall font list of u8g2, which includes all fonts, sorted according to the height of capital "A": fntlistall · olikraus/u8g2 Wiki · GitHub

Oliver

Thank you, I will look into those. I will mark the post solved as I got the display working, eventhough the cause of the error is still unknown.