Playing with a DigiSpark & SSD1306 0.96" OLED

Examples, screenshots, graphics, fonts...
Post Reply
User avatar
Phil_G
Posts: 302
Joined: 15 Feb 2018, 23:32
Contact:

Playing with a DigiSpark & SSD1306 0.96" OLED

Post by Phil_G » 09 Sep 2019, 23:16

I was just browsing stuff and happened across this:
https://www.instructables.com/id/ATTiny ... at-Things/
Its a simplified OLED library for the 0.96" OLEDs for the DigiSpark or any ATTiny85, minimalised to preserve memory on the ATTiny85. For text, it has only one font which is 5x7, so quite small to read but very clear, you get 20 characters by 8 lines, four lines if double spaced.



IMG_20190909_232200_619.JPG

IMG_20190909_232227_540.JPG

IMG_20190909_232258_935.JPG



Just thought it was a handy library worth saving, great for DigiSpark projects.







As with most of these libraries, theres no documentation so you have to work out how to use it. I've sussed the graphics format, basically its vertical bytes from top left, across left to right, next row, etc to bottom right, with the msb of each byte at the bottom. Taking the thermometer as an example


thermometer_graphic.jpg


(this took me ages to draw!):


thermometer.jpg

You can create a new graphic using PaintShop Pro or similar, actual size, two-colour, then import it into the excellent conversion utility that Max found the other day: http://javl.github.io/image2cpp/

Cheers
Phil

FBMinis
Posts: 46
Joined: 25 Feb 2018, 17:59

Re: Playing with a DigiSpark & SSD1306 0.96" OLED

Post by FBMinis » 30 Sep 2019, 13:10

Thank you Phil for another interesting experiment.

Mike_K
Posts: 262
Joined: 16 Feb 2018, 06:35

Re: Playing with a DigiSpark & SSD1306 0.96" OLED

Post by Mike_K » 02 Oct 2019, 15:36

If anybody wants a play with an ATtiny85 and the SSD1306 OLED library and are having problems working out how it all works there's actually plenty of documentation relevant to this library, as it's based on the Adafruit OLED/GFX graphics library, everything about the Adafruit SSD1306 applies. The original Adafruit library is here:

https://github.com/adafruit/Adafruit_SSD1306

and

https://learn.adafruit.com/monochrome-o ... d-examples

The Adafruit library comes with examples and many projects on the web are based on it, so you can see how others have used it. To see example programs in Arduino, first, ensure the Adafruit SSD1306 library is installed using the Arduino libraries manager. You should then be able to find examples under File -> Examples (Examples from customer libraries). You will obviously have to change the #includes etc to the minimal library for programs/sketch examples to work with the ATtiny85.

The advantage of the minimal library is it uses the "soft" I2C library as the ATtiny85 hasn't got a native I2C port and doesn't use a page buffer to store the image as the ATtiny85 hasn't got enough RAM to hold it. Even though the ATtiny85 hasn't got a native I2C port, it has the USI – Universal Serial Interface that can be utilised for I2C (or other serial coms), that the USI_TWI_Master and TinyWireM libraries make use of, though the underlying driver is the same as the Adafruit OLED driver.

And if you want to convert bmp images to cpp (and rotate thro' 90 deg to get it correct orientation for the Adafruit library) I use the excellent GIMP graphics tool, that is open source and a free download. I still use a years old version, I think you now have to "export" rather than "save as".

Cheers

Mike

Post Reply