0

I have been on this issue for more than 3 days now after I got my SSD1306 I2C in the mail. I have a Tiny Programmer from Sparkfun, which I use with a breadboard.

This is my pin layout: pin2-->SDA, pin3-->SCL. The documentation on the SSD1306 Arduino library states that I have to use these pins even though I know the SDA is pin5 and SCL is pin7. The power and ground are being jumped to the OLED from the Tiny Programmer.

The main issue I am having is that the OLED is not coming on or displaying the text.

The code I am using for this is:

/**
*   Attiny85 PINS
*             ____
*   RESET   -|_|  |- 3V
*   SCL (3) -|    |- (2)
*   SDA (4) -|    |- (1)
*   GND     -|____|- (0)
*
*   Atmega328 PINS: connect LCD to A4/A5
*/

#include "ssd1306.h"

void setup() {
   /* Replace the line below with ssd1306_128x32_i2c_init() if you need to use 128x32 display */
  ssd1306_128x64_i2c_init();
  ssd1306_fillScreen(0x00);
  ssd1306_charF6x8(0, 0, "Line 1. text");
  ssd1306_charF6x8(0, 1, "Line 2. Bold text", STYLE_BOLD);
  ssd1306_charF6x8(0, 2, "Line 3. Italic text", STYLE_ITALIC);
  ssd1306_charF12x16(0, 3, "Line 4. Double size", STYLE_BOLD);
}

void loop() {
}

There is no error message when I compile this and I honestly have no idea what's going on.

I have tried swapping the SDA and SCL and still nothing. I have even used the actual SDA and SCL pins and still nothing. I feel that I am out of options and/or the OLED is broken. I'm just seeing if there is anything else I can do before I try to get a replacement for this? Thank you.

dda
  • 6,030
  • 2
  • 25
  • 34
  • If you have one (or access to one), a logic analyzer or oscilloscope will let you confirm what's happening electrically rather than being in the dark. Which SSD1306 library are you using exactly? The [Adafruit one on Github](https://github.com/adafruit/Adafruit_SSD1306) states it doesn't work on the ATtiny85 (though it doesn't look like you're using that). – Stecman Jan 09 '18 at 02:08

2 Answers2

1

I think you have to use pins 5 and 7 with the attiny85. You also need to use tinywirem.h for I2C communication.

Milo
  • 3,365
  • 9
  • 30
  • 44
bare foot
  • 26
  • 1
0

The ATTiny85 I2C pins are pin5(PB0) SDA and pin7(PB2) SCL, the SSD1306 library seems to think they are pin3(PB4) SDA and pin2(PB3) SCL, the demos even have an diagram of an ATTtiny within them showing the incorrect pins. I have used the official pins with no luck. Using the pins they suggest did actually run but just so slowly most would think it was not working. It took minutes to start clearing the screen, and even longer to actually clear it.

I have used the U8g2 library instead, the init entry for the Digispark ATTiny85 works OK for the u8x8 helloworld demo though I could not get many of the demos to compile for the ATTiny85. I am still looking for a better solution.

Richard
  • 1
  • 1