1
\$\begingroup\$

Using SSD1306 based OLED on a STM32 based board. The OLED needs to display a QR code that can be scanned using a mobile phone. On other times, OLED needs to display other information, but there is no requirement for high update rates.

Problem: When displaying QR core, screen's own redraw rate makes the QR code hard to scan. On the phone, this represents itself as a black horizontal bar, covering portions of the code most of the time.

This is not related to the code and I make sure screen gets no further data after the initial drawing.

Searching everywhere, people talks about high refresh rates, optimising I2C etc., but these are all about how fast the code can update the screen.

Is there a way to make the screen's internal redraw rate faster or slower? There are two parameters mentioned on the data sheet Display Clock Divide Ratio/ Oscillator Frequency which gives some hope, but changing these (perhaps a bit randomly) didn't help so far.

PS: eInk is not an option due to cost.

\$\endgroup\$
4
  • \$\begingroup\$ Please post relevant parts of code or a minimum example to reproduce the problem. Are you constantly refreshing the screen or just when needed? \$\endgroup\$
    – winny
    Aug 17, 2023 at 9:12
  • \$\begingroup\$ @winny the SSD1306 controller chip constantly drives the content to the OLED screen by itself even if you don't write anything to the SSD1306. \$\endgroup\$
    – Justme
    Aug 17, 2023 at 9:49
  • \$\begingroup\$ @Justme I have used it in one of my personal projects but just used the standard Arduino library for it. Do you know if the refresh rate is possible to set? Or perhaps OP is redrawing the entire screen from software at some rate? \$\endgroup\$
    – winny
    Aug 17, 2023 at 9:54
  • \$\begingroup\$ @winny It reads on first datasheet page that refresh rate is programmable. But it may not matter. The mobile phone camera has a rolling shutter and the OLED will have only one row of pixels lit at one given moment, so it may not be possible to adjust the OLED so that a random phone can capture all pixels from OLED. At least the phone must be set to longest possible exposure. \$\endgroup\$
    – Justme
    Aug 17, 2023 at 10:08

4 Answers 4

2
\$\begingroup\$

The SSD1306 data sheet says the display refresh rate is adjustable.

You can select the clock divider ratio and also the clocks per row and multiplex ratio.

But whatever you do, it means that only one row of pixels is driven at one given time, so both the display will scan the data out, and a typical mobile phone will also use rolling shutter to scan the image instead of having a more expensive global shutter.

So it may be extremely difficult to take a photo or video of the OLED screen, as you have limited amount of adjustments available for the OLED screen and likely there is no settings that are suitable for all phones.

The only way to try making good capture may be to adjust phone settings to capture light longer.

\$\endgroup\$
1
  • \$\begingroup\$ I got it, well explained, thank you. \$\endgroup\$
    – Charles
    Aug 18, 2023 at 17:41
1
\$\begingroup\$

Given that the source of the problem is the combination of the OLED driver's multiplexing of the rows and the phone camera's rolling shutter, simply adjusting the multiplexing rate can't guarantee a good capture with every phone. Increasing the multiplexing speed as much as possible will help, but you should look into a non electronic fix. Your goal is to make the camera increase its shutter time as much as possible, to capture the entire screen without black bars. To achieve that, you should set the OLED brightness as low as is still acceptable, and surround the display with a dark frame. Depending on how the display will be placed you could maybe put a sort of hood around it to block more surrounding light.

\$\endgroup\$
1
  • \$\begingroup\$ Thank you for this suggestion, it makes sense. \$\endgroup\$
    – Charles
    Aug 18, 2023 at 17:40
1
\$\begingroup\$

The read out time of a CMOS pixel on a rolling shutter sensor is so fast they're often used to make time of flight sensors by pulsing LEDs and looking at the difference in brightness between pixels exposed at different times, with the picoseconds or nanoseconds of delay due to the speed of light causing variations in pixel brightness similar to what you observe.

With that in mind, unless you can update at billions of frames per second, that black line is always going to spend more time over some pixels then others during the exposure period, so changing the display timing will not remove it. It will always be somewhere in the pattern.

The one thing you can change is the cameras exposure time. You need to get the user to put the exposure time as long as possible so that the black line averages out as much as possible. Turn the brightness down as low as it will go and put the display in a dark box with as little ambient light as possible.

That or get a display that doesn't depend persistent of human vision to create the illusion of a uniformly lit screen. An LCD is a good choice.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ This "Get a display that doesn't depend on persistence of vision" is the correct answer, worthy of some emphasis. Camera sensors don't have "persistence of vision". \$\endgroup\$
    – Ben Voigt
    Aug 17, 2023 at 21:09
1
\$\begingroup\$

I modify this value to 0xF0 which gave me a good result enter image description here

\$\endgroup\$
1
  • 1
    \$\begingroup\$ This isn't an answer but personal experience \$\endgroup\$
    – MiNiMe
    Oct 9, 2023 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.