Live data from Hacker News

SSD1306 display drivers and font rendering

subalpinecircuits.com

1–10 of 35 posts

Re: SSD1306 display drivers and font rendering

#2
I really love the SSD1306 for its educational value. If you've bought a sensor kit for Arduino or ESP32 or Pico or whatever, chances are decent that you already have an SSD1306 lying around. There's so much example code for it. And the datasheet was pretty easy to grok IMO. My first exposure to it was in the pico-examples repo: https://github.com/raspberrypi/pico-examples/tree/master/i2c...

There's a few Rust libraries for it, too. And it's supported in Wokwi! https://wokwi.com/projects/425067706980448257

Re: SSD1306 display drivers and font rendering

#4
It’s generally quite easy to use these over I2C without a driver. You can crib the sequence of initialization commands from the example code supplied by the manufacturer (or loads of examples on GitHub), and then the commands to draw to the screen are pretty straightforward. The chip has its own display RAM, so you don’t need to worry about redrawing every time the display refreshes or anything as low-level as that.

Re: SSD1306 display drivers and font rendering

#5
Go for the SPI version, which is the same chip but just s different breakout board.

Many ESP32's can only do 400kHz I2C, whereas their SPI peripheral can often do 80 MHz or more (although you wouldn't want to go that fast here). 400kHz sort of works, but if you also want to handle other I2C devices it can easily become a problem.

Re: SSD1306 display drivers and font rendering

#6
This display is the modern 16x2 display for hardware hackers: cheap and versatile.

One of my favorite hacks is running this display over HDMI [0].

Note that it’s possible to refresh it at higher rates by using partial refreshes. Or even higher to 150 fps [1].

[0] https://hackaday.com/2022/04/01/making-your-own-technically-...

[1] https://hackaday.com/2018/05/08/push-it-to-the-limit-ssd1306...

Re: SSD1306 display drivers and font rendering

#7
post #5

Go for the SPI version, which is the same chip but just s different breakout board. Many ESP32's can only do 400kHz I2C, whereas their SPI peripheral can often do 80 MHz or more (although you wouldn't want to go that fast here). 400kHz sort of works, but if you also want to handle other I2C devices it can easily become a problem.

(author here) I've been pondering this, yeah. I'm currently sharing the I2C bus with a DAC and that's working alright, but the refresh rate issue is enough to make me consider SPI. I know the SPI peripheral supports DMA as well, and the I2C one doesn't (sort of? I know there's "async" transmit now but can't tell if that's really doing DMA)

Re: SSD1306 display drivers and font rendering

#8
post #4

It’s generally quite easy to use these over I2C without a driver. You can crib the sequence of initialization commands from the example code supplied by the manufacturer (or loads of examples on GitHub), and then the commands to draw to the screen are pretty straightforward. The chip has its own display RAM, so you don’t need to worry about redrawing every time the display refreshes or anything as low-level as that.

Interesting! That could be good way to boost the speeds here for sure, as I'm still pushing out a full framebuffer out with every update and am not usually updating the whole screen.

Re: SSD1306 display drivers and font rendering

#9
post #5

Go for the SPI version, which is the same chip but just s different breakout board. Many ESP32's can only do 400kHz I2C, whereas their SPI peripheral can often do 80 MHz or more (although you wouldn't want to go that fast here). 400kHz sort of works, but if you also want to handle other I2C devices it can easily become a problem.

I2C is nice because it is (with Adafruit and Sparkfun’s Stemma QT/Qwiik) literally plug and play for beginners, with a wide variety of sensors available.

Plus not needing to dedicate a control pin per device added to the bus. Though of course if data throughout is an issue SPI is better than I2C.

Re: SSD1306 display drivers and font rendering

#10
Here's a rust version i made with bitmapped fonts for both i2c and SPI https://github.com/scopenews/minimalSSD1306driver/ I was running this on my pi as a demo.

I normally work with C++ on esp32 for these little displays, and in there I use a screen buffer for partial refreshes which makes them very fast !!

Post reply on HN