Best way to prevent OLED flickering- Tachometer project

I'm working on a project for a tachometer for a lathe. I'm using a 128x128 RBG OLED for the display. The issue I'm having is that each time the RPM changes and I need to write a new value to the screen the screen flickers due to having to set the background color to black then rewrite the entire number. An additional problem is that as the RPM increases in digits then decreases the extra digits remain on the screen.

The only way I can think to solve this is to write each digit individually to the screen in a specific position and as the loop runs only update the digits that change with each pass through the loop. That would make my RPM value "right justified" as it were on the screen. Which brings up the issue of leading 0's at lower RPM's. Seems like a lot of coding to tackle.

Has anyone found a way to solve a similar issue?

1 Like

Has anyone found a way to solve a similar issue?

Yes, every one of the ?hundreds of times this problem has been posted, usually in the "Displays" section.

OK, I'll go with "dozens" then. :grinning:

Suppressing the flicker involves a series of steps.

  • Do not update the display more than five times per second.
  • Do not update the display unless the value changes.
  • Clear only the section where the number is written.
    Whenever writing numbers, determine whether they are more than 9, more than 99, more than 999 etc. and write the appropriate number of blanks before the numbers first.
1 Like

Something else you may try, if you're using these calls.

display.SetTextColor(WHITE, BLACK);

You can use this without display.clearDisplay(); It's smart enough to know when to overwrite pixels when messages change. I'm not sure how often it writes, if it's only when pixels change, but worth a shot.

Still, you prob can't update more than 5 times a second with it, tho.

1 Like

A 4 digit 7 segment LED display works well if u only need to display one parameter. Instant response, no flickering and easy to read in bright light.


Unfortunately I need to display more information and a 7 segment display won't work. Even if I update the display once per second it flickers on that update when it fills a black rectangle before displaying the new numbers. I started rewriting the previous text in black first (the bg color) instead of filling a rectangle. That helps some but there's still a perceptible flicker as it redraws the numbers.

thanks you just saved me soo much time :slight_smile:

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.