Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LED display flickering #495

Closed
DebaGracias opened this issue Jan 30, 2018 · 5 comments
Closed

LED display flickering #495

DebaGracias opened this issue Jan 30, 2018 · 5 comments

Comments

@DebaGracias
Copy link

Hi All,
I am using Python 2.7 on my Raspberry Pi 3 .I was successfully able to display a count up timer on the left of the LED display and a scrolling text on the right.I am able to see flickers.I have switched off on-board sound (dtparam=audio=off in /boot/config.txt),although there is minor improvement the led still flickers after every 2 secs.I am also using python threads to carry out some tasks.Is that causing the flickering?
Is there any setting or option that I can enable so that I can eliminate the flickering of LED?

Thanks,
Debasish

@hzeller
Copy link
Owner

hzeller commented Jan 30, 2018

How do you do the scrolling/counter thing ? Make sure to not accidentally blank the other half of the screen.

If there is a lot of processing going on that requires memory access, you can saturate the memory bus thus reducing the throughput the matrix update needs. So if you do something CPU and memory intensive, you will cause the matrix to flicker. So try to offload that (e.g. by pre-calculating things; the led-image-viewer precalculates animations in off-screen buffers beforehand so that it then can stream it later.
In general it is a good idea to move to C++ if you want to do something CPU intensive.

Finally, make sure to run a version of this library that is fresher than a week, because about a weekend ago I tweaked some defaults that might reduce flicker.

@hzeller
Copy link
Owner

hzeller commented Jan 30, 2018

Also make sure to do the isolcpus setting.

@DebaGracias
Copy link
Author

DebaGracias commented Feb 3, 2018

Thank you for your reply.I tried using the latest version of the library and also setting isolcpus to 3.There is a minor improvement with this but the LED still flickers.
Here is the piece of code that i'm using to display the timer and the scrolling message:

   while True:
            self.offscreen_canvas.Clear()
            strTime = self.strTime           
            self.message = self.response
            if self.message != '':                    
                length = graphics.DrawText(self.offscreen_canvas, font, self.pos, 15, textColor, self.message)
                self.offscreen_canvas.SetImage(self.image, -35,0)
                graphics.DrawText(self.offscreen_canvas, fontTimer,posTimer, 10, textColor, strTime)
                
                self.pos -= 1
                if (self.pos + length < 0 or length == 0):
                    self.pos = self.offscreen_canvas.width
                
                mins,secs=divmod(int(self.t),60)
                timeformat='{:02d}:{:02d}'.format(mins,secs)
                self.strTime = timeformat
                self.t+=0.02
              
                time.sleep(0.02)
                self.offscreen_canvas= self.matrix.SwapOnVSync(self.offscreen_canvas)

            if(self.t >= 60):
               self.SwitchOffLED()

Is something wrong with my code?
The LED model is http://arduino.ru/forum/apparatnye-voprosy/led-matrix-32x16-c5-4x8v10-dual-color-rg and I bought it from https://www.aliexpress.com/item/40-inch-101cm-ios-And-Android-Wifi-wireless-remote-Programmable-Advertising-LED-Display-Board-Bright-Red/32752577115.html?spm=a2g0s.9042311.0.0.F3UzUv.
How can I completely eliminate the flickering?

@hzeller
Copy link
Owner

hzeller commented Feb 17, 2018

Make sure you don't have anything else running on the Pi (a shell running top, some cron-job doing stuff regularly etc.), this will mess up timings inside the Pi. If there are other things running on the Pi, slight brightness variations are to be expected.
Essentially follow some recommendations in the documentation.

Also, the panel you're using looks more like a HUB12; did you verify the logical level of the output-enable ? Often they need to be reversed.

@hzeller hzeller closed this as completed Feb 17, 2018
hzeller added a commit that referenced this issue Mar 17, 2018
masking faint flickers.

Addresses flicker observations mentioned in #556 #551 #276 #495 #483 #478 #467
@hzeller
Copy link
Owner

hzeller commented Mar 17, 2018

Check out the new compile-time option in FIXED_FRAME_MICROSECONDS in lib/Makefile. It will allow to time-buffer glitches created by the rest of the system.

hzeller added a commit that referenced this issue Mar 18, 2020
… on loaded system.

This used to be a compile-time option FIXED_FRAME_MICROSECONDS but
it is very useful to tweak at runtime.

Issues #276 #458 #467 #478 #483 #495 #551 #556 #571 #626 #651 #710
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants