Skip to content

SSD1306,SSD1331,SSD1351,IL9163,ST7735,PCD8544/Nokia 5110 LCD display driver library for Arduino

License

Notifications You must be signed in to change notification settings

nRFMesh/ssd1306-nRF5

 
 

Repository files navigation

SSD1306/SSD1331/SSD1351/IL9163/ST7735 OLED display driver, PCD8544 LED display driver

Introduction

SSD1306 driver is Arduino style C/C++ library. it can be compiled with plain avr-gcc compiler without Arduino libraries and supports monochrome and RGB oleds. It is intended for use with very small microcontrollers (with a little of RAM). It was developed to use as few resources as possible. Since ATTiny controllers have no division and multiply operations, the library uses shift operation to speed up calculations.

Do not forget pull-up resistors for i2c lines.

Key Features

  • Supports color and monochrome OLED displays
  • The library uses as little Flash memory as possible
  • Needs very little RAM (Attiny85 with Damellis package needs minimum 25 bytes of RAM to communicate with OLED)
  • Fast implementation to provide reasonable speed on slow microcontrollers
  • Supports i2c and spi interfaces:
    • i2c (software implementation, Wire library, AVR Twi, Linux i2c-dev)
    • spi (4-wire spi via Arduino SPI library, AVR Spi, AVR USI module)
  • Primitive graphics functions (line,rectangle,pixels, bitmaps)
  • Printing text to display (using fonts of different size, you can use GLCD Font Creator to create new fonts)
  • Includes graphics engine to support double buffering on tiny microcontrollers.
  • Can be used for game development (bonus examples):

Image of arkanoid intro Image of lode runner

Image of menu example Image of color oled

The default i2c pins for embedded implementation can be modified in ssd1306_i2c_conf.h file. For other controllers pins are defined by standard Wire library. The default spi SCLK and MOSI pins are defined by SPI library, and DC, RST, CES pins are configurable through API.

Supported displays:

Display I2C SPI Comments
sh1106 128x64 X
ssd1306 128x64 X X
ssd1306 128x32 X X
ssd1331 96x64 X
ssd1331 128x128 X
il9163 128x128 X
st7735 128x160 X
pcd8544 84x48 X Nokia 5110

Supported platforms

Platforms I2C SPI Comments
Arduino
Attiny85, Attiny45 X X Refer to Damellis attiny package
Atmega328p, Atmega168 X X
Atmega32u4 X X
Atmega2560 X X
Digispark, including PRO version X X check examples compatibility list
ESP8266 X X check examples compatibility list
ESP32 X X check examples compatibility list
STM32 X X stm32duino
Plain AVR
Attiny85, Attiny45 X X
Atmega328p, Atmega168 X X
Atmega32u4 X X
Linux
Raspberry Pi X X i2c-dev, spidev, sys/class/gpio
SDL Emulation X X demo code can be run without real OLED HW via SDL library
Windows
SDL Emulation X X demo code can be run without real OLED HW via MinGW32 + SDL library

Digispark users, please check compilation options in your Arduino prior to using this library. Ssd1306 library requires at least c++11 and c99 (by default Digispark package misses the options -std=gnu11, -std=gnu++11).

The goals of ssd1306 library

  • To use as few RAM as possible
  • To use as few Flash as possible
  • To be as fast as possible
  • To fit Arkanoid game example to Attiny85 microcontroller

Setting up

*Hardware setup is described here

Setting up for Arduino: (variant 1)

Setting up for Arduino: (variant 2)

  • Install ssd1306 library via Arduino IDE library manager

Using with plain avr-gcc:

  • Download source from https://github.com/lexus2k/ssd1306
  • Build the library (variant 1)
    • cd ssd1306/src && make -f Makefile.avr MCU=<your_mcu>
    • Link library to your project (refer to Makefile.avr in examples folder).
  • Build demo code (variant 2)
    • cd ssd1306/tools && ./build_and_run.sh -p avr -m <your_mcu> ssd1306_demo

For more information about this library, please, visit https://github.com/lexus2k/ssd1306. Doxygen documentation can be found at github.io site. If you found any problem or have any idea, please, report to Issues section.

License

The library is free. If this project helps you, you can give me a cup of coffee. Donate via Paypal

MIT License

Copyright (c) 2016-2018, Alexey Dynda

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

SSD1306,SSD1331,SSD1351,IL9163,ST7735,PCD8544/Nokia 5110 LCD display driver library for Arduino

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • C 64.9%
  • C++ 32.6%
  • Shell 1.2%
  • Other 1.3%