datacute / Tiny4kOLED

Library for an ATTiny85 to use an SSD1306 powered, double buffered, 128x32 pixel OLED, over I2C
MIT License
264 stars 39 forks source link

Nothing Being Displayed #38

Closed Run4Evers closed 2 years ago

Run4Evers commented 3 years ago

Hoping someone here would know if this is an issue with the Tiny4KOLED library, or my setup.

Day 3 of trying to fix this -

I am using the 128x32 example for Tiny4kOLED, with the board manager https://github.com/SpenceKonde/ATTinyCore.git, originally I couldn't compile the code with the board manager http://drazzy.com/package_drazzy.com_index.json so that is why I switched to the Spences.

I have all my wiring correct, and the OLED Display was working using the TinyOzLED Library for ATTiny85 https://github.com/SensorsIot/TinyOzOled

Here is the code for that example:

`/*

include

uint8_t width = 128; uint8_t height = 32;

void setup() { oled.begin(width, height, sizeof(tiny4koled_init_128x32br), tiny4koled_init_128x32br); oled.setFont(FONT8X16); drawScreen(); oled.on(); }

void loop() { scrollScreen(); }

void drawScreen() { // Set entire memory to hatched - if you see any of this hatching, then the display is not initialised correctly. for (uint8_t y = 0; y < 8; y++) { oled.setCursor(0, y); oled.startData(); for (uint8_t x=0; x<128; x += 2) { oled.sendData(0b10101010); oled.sendData(0b01010101); } oled.endData(); }

oled.setCursor(0, 0); oled.startData(); oled.sendData(0b11111111); oled.repeatData(0b00000001, width - 2); oled.sendData(0b11111111); oled.endData();

for (uint8_t y = 1; y < (height - 8) / 8; y++) { oled.setCursor(0, y); oled.startData(); oled.sendData(0b11111111); oled.repeatData(0b00000000, width - 2); oled.sendData(0b11111111); oled.endData(); }

oled.setCursor(0, (height - 8) / 8); oled.startData(); oled.sendData(0b11111111); oled.repeatData(0b10000000, width - 2); oled.sendData(0b11111111); oled.endData();

oled.setCursor(8, 1); oled.print(width); oled.print('x'); oled.print(height); }

void scrollScreen() { uint8_t startScrollPage = 1; uint8_t endScrollPage = 2; uint8_t startScrollColumn = 8; uint8_t endScrollColumn = startScrollColumn + width - 16; for (uint8_t x = 0; x < width - 16; x++) { delay(50); oled.scrollContentRight(startScrollPage, endScrollPage, startScrollColumn, endScrollColumn); } }`

Compiles just fine, also here is my board setup image

I've redone the wiring, swapped both the ATTINY85PU unit with another, and the display (here is a link https://www.amazon.com/dp/B08TLXYKS6?psc=1&ref=ppx_yo2_dt_b_product_details)

Can anyone here tell me if this is an issue with the 4kOled library, and what you guys are using that is working ?

Run4Evers commented 3 years ago

I have pin 5 going to SDA and Pin 7 going to SCL according to this pinnout image image

datacute commented 3 years ago

Most likely the SSD1306 has remembered settings from when it was used with the TinyOzOled library which are stopping it from working, and if so, you need to get the SSD1306 back to its defaults.

You can do this by including:

oled.begin(128, 64, sizeof(tiny4koled_init_defaults), tiny4koled_init_defaults);
oled.begin();

If this works, you can take out that init defaults line again.

Run4Evers commented 3 years ago

Thank you for your response Datacute,

I tried that code, as well as changed the 64 to 32 but nothing yet. I'm going to go down the train of thought that I need to find a way to clear the SSD1306 somehow and report back.

Run4Evers commented 3 years ago

I couldn't get that to work, so what I did is try plugging the Nano 33 IoT directly into my OLED, I get successful printing of text.

This doesn't seem to be a library issue since that is working with the 128x32 sketch.. any pointers for me for the ATTiny? Is there a library for the board that you use ?

datacute commented 3 years ago

I use Spence Konde's ATTinyCore, but it it interesting that of the two options you show, one compiles and one doesn't, as they should be pretty much the same apart from in-development code not yet included in a release. See https://github.com/SpenceKonde/ATTinyCore/blob/master/Installation.md

My board setup is the same as in your image.

Did you burn bootloaded? Maybe the frequency the code thinks that it is running at is not what the ATTiny85 is actually running at. (That's a long shot as the SSD1306 seems to be extremely tolerant of i2c timing requirements not being followed.)

Run4Evers commented 3 years ago

I really appreciate your responses to me, at this point I've tried different things I'm hoping one of us can get it figured out.

Just redid all the wiring, checked everything, uninstalled and reinstalled the Arduino IDE - and reinstalled all the boards and sketch libraries. As well as tried another OLED and ATTiny85, same results. (I had used that OLED with the OzOled Libary I mentioned before so it could be keeping settings)

By Burning the bootloader (I'm very new to working with the ATTiny85 I did do this

1). Load the Blink Sketch 2). Set my board settings to this image 3). Clicked "Burn Bootloader" option 4). Uploaded Sketch and it worked

When I repeat that with the 128x32 option I get nothin..

However - I think you may be right about the code frequency. I was originally having the LED Blink at 100ms, after changing it to 1000ms and uploading nothing happened. So then I clicked burn bootloader, and uploaded - that worked.

My ignorance in ATTiny85s and OLEDs is probably showing - do you have any advice/direction I should go in knowing that ? I have a feeling that what I am doing is probably the incorrect method here

Again thank you very much for your help, and your work in making this library. Its some really impressive stuff!

Run4Evers commented 2 years ago

For those that are struggling!

Follow this link to a T. My issue was that I didn't have the OLED disconnected when I was uploading code, and then didn't disconnect from the arduino (see last picture on this link).

https://www.studiopieters.nl/attiny85-oled-i2c/