Search code examples
arduinoavri2cattiny

ATtiny85 I2C SSD1306 screen not working


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.


Solution

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