Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (testpypi.python.org).
Help us improve Python packaging - Donate today!

A small library to drive an OLED device with either SSD1306, SSD1325, SSD1331 or SH1106 chipset

Project Description

Python library interfacing OLED matrix displays with the SSD1306, SSD1325, SSD1331 or SH1106 driver using I2C/SPI on the Raspberry Pi and other linux-based single-board computers - it provides a Pillow-compatible drawing canvas, and other functionality to support:

  • scrolling/panning capability,
  • terminal-style printing,
  • state management,
  • color/greyscale (where supported),
  • dithering to monochrome

A list of tested devices can be found in the wiki.

The SSD1306 display pictured below is 128 x 64 pixels, and the board is tiny, and will fit neatly inside the RPi case.

As well as display drivers for various physical OLED devices, there are emulators that run in real-time (with pygame) and others that can take screenshots, or assemble animated GIFs, as per the examples below (source code for these is available in the examples directory:

Documentation

Full documentation with installation instructions and examples can be found on https://ssd1306.readthedocs.io.

License

The MIT License (MIT)

Copyright (c) 2016 Richard Hull & Contributors

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.

Contributing

Pull requests (code changes / documentation / typos / feature requests / setup) are gladly accepted. If you are intending to introduce some large-scale changes, please get in touch first to make sure we’re on the same page: try to include a docstring for any new method or class, and keep method bodies small, readable and PEP8-compliant. Add tests and strive to keep the code coverage levels high.

GitHub

The source code is available to clone at: https://github.com/rm-hull/ssd1306.git

Contributors

  • Thijs Triemstra (@thijstriemstra)
  • Christoph Handel (@fragfutter)
  • Boeeerb (@Boeeerb)
  • xes (@xes)
  • Roger Dahl (@rogerdahl)
  • Václav Šmilauer (@eudoxos)
  • Claus Bjerre (@bjerrep)

ChangeLog

Version Description Date
Upcoming TBD  
1.5.0
  • Performance improvements for SH1106 driver (2x frame rate!)
  • Support for 4-bit greyscale OLED (SSD1325)
  • Landscape/portrait orientation with rotate=N parameter
2017/01/09
1.4.0
  • Add savepoint/restore functionality
  • Add terminal functionality
  • Canvas image dithering
  • Additional & improved examples
  • Load config settings from file (for examples)
  • Universal wheel distribution
  • Improved/simplified error reporting
  • Documentation updates
2016/12/23
1.3.1
  • Add ability to adjust brightness of screen
  • Fix for wrong value NORMALDISPLAY for SSD1331 device
2016/12/11
1.3.0
  • Support for 16-bit color OLED (SSD1331)
  • Viewport/scrolling support
  • Remove pygame as an install dependency in setup
  • Ensure SH1106 device collapses color images to monochrome
  • Fix for emulated devices: do not need cleanup
  • Fix to allow gifanim emulator to process 1-bit images
  • Establish a single threadpool for all virtual viewports
  • Fix issue preventing multiple threads from running concurrently
  • Documentation updates
2016/12/11
1.2.0
  • Add support for 128x32, 96x16 OLED screens (SSD1306 chipset only)
  • Fix boundary condition error when supplying max-frames to gifanim
  • Bit pattern calc rework when conveting color -> monochrome
  • Approx 20% performance improvement in display method
2016/12/08
1.1.0
  • Add animated-GIF emulator
  • Add color-mode flag to emulator
  • Fix regression in SPI interface
  • Rename emulator transform option ‘scale’ to ‘identity’
2016/12/05
1.0.0
  • Add HQX scaling to capture and pygame emulators
  • SPI support (NOTE: contains breaking changes)
  • Improve benchmarking examples
  • Fix resource leakage & noops on emulated devices
  • Additional tests
2016/12/03
0.3.5
  • Pygame-based device emulator & screen capture device emulator
  • Add bouncing balls demo, clock & Space Invaders examples
  • Auto cleanup on exit
  • Add bounding_box attribute to devices
  • Demote buffer & pages attributes to “internal use” only
  • Replaced SH1106 data sheet with version that is not “preliminary”
  • Add font attribution
  • Tests for SSD1306 & SSH1106 devices
  • Add code coverage & upload to coveralls.io
  • flake8 code compliance
  • Documentation updates
2016/11/30
0.3.4
  • Performance improvements - render speeds ~2x faster
  • Documentation updates
2016/11/15
0.3.3
  • Add PyPi badge
  • Use smbus2
2016/11/15
0.3.2
  • Fix bug in maze example (integer division on python 3)
  • Use latest pip
  • Add tox & travis config (+ badge)
  • Add RTFD config
  • Documentation updates
2016/11/13
0.3.1
  • Adjust requirements (remove smbus)
  • Default RTFD theme
  • Documentation updates
2016/11/13
0.3.0
  • Allow SMBus implementation to be supplied
  • Add show, hide and clear methods
  • Catch & rethrow IOError exceptions
  • Fix error in ‘hello world’ example
  • Cleanup imports
  • Allow setting width/height
  • Documentation updates
2016/11/13
0.2.0
  • Add Python 3 support
  • Add options to demos
  • Micro-optimizations
  • Remove unused optional arg
  • Fix bug in rendering image data
  • Added more examples
  • Add setup file
  • Support SH1106
  • Documentation updates
2016/09/06
Release History

Release History

This version
History Node

2.0.0

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting