Im currently making a costum 10x10 led matrix, and for it to be able to display senseable stuff, im trying to segment the display into 10 vertical lines which cycle at at least 100hz. Would a Python script on a raspberry pi be able to cycle its GPIO pins at this speed? Or Would an arduino or other Microcontroller be able to do it better?
Short answer: It will probably work, since I assume you don’t need the timing to be reliable. It could start to glitch if the pi is under heavy load.
Since you’re using python I’ll assume you’re using linux. Linux isn’t a real time operating system, so it is generally terrible at doing things like this. The issue is your program can be paused by the scheduler while the OS is doing something else, so any timing you request is not guaranteed. Now, a pi is ridiculously overpowered for this, so you’ll probably get away with it if that’s all the pi is doing, but under heavy load you could see the OS prioritise other processes and your display will freeze.
You could install the preempt_rt patches to make it do real time better, this changes Linux into something that resembles a real time operating system, I don’t have any experience with it though.
Generally something like this is better done by a microcontroller, because it isn’t constantly trying to juggle a hundred different tasks like an operating system is.
There are custom RTOS like Zephyr which run on pi.
Also Linux has RTOS versions which are pretty decent.
This sounds kind of marginal to me, since you want the timing to be steady to stop the display from looking weird. You are better off with something like a Pi Pico and you will want to write the code in C (or similar) instead of Python. At that point 100 hz even on the main cpu is not a big deal. The Pico also has special i/o processors (PIOs) that can do this kind of thing more precisely even at MHz speeds, but they are limited and a pain to program.
There is an Adafruit board to control LED Matrices from a Pi with hardware assistance if you want: https://www.adafruit.com/product/2345
It says the current version works only on the pi 4, not the 5, for whatever reason. They are working on a pi 5 version.
Like others said, the bottle neck will be the OS doing it’s thing with python rather than the hardware. Remember that you can perform pulse width modulation with the GPIO, so they can physically toggle states really very fast.
I seem to recall that there is a GPIO header file for C available for the pi somewhere. If python proves too slow for what you want to do, you could look into writing something in C instead to try to speed things up potentially.
Not sure but I think the limiting rate is actually Python syscalling the kernel rather than the actual GPIO hardware.
So you think a Python interpreter like an arduino is better?
RPI pico is probably a better choice. A rpi 5 can do stuff like WiFi servers and browsers but that’s not what you will do with it.
Thats what I was planning
Tho, is it possible to connect a Pico w (with wifi) to my network and pull data from an API Server? Or do I have to somehow manually transfer that via some gpio Pins and an extra library?
No it works with simple WiFi stuff.
https://github.com/F5OEO/rpitx
It can handle frequencies from 5 KHz up to 1500 MHz.
You should be fine, although maybe other pins dont work as well. Why 100hz out of curiosity?
https://www.mikrocontroller.net/articles/LED-Matrix
My source says, the human eyes stop seeing the flicker of a segmented led Matrix at about 100Hz. Since Python is a POS at being fast, ill make due with 100hz
There is a lot of pseudoscience around human vision and frequencies, so I’d take that with a grain of salt. 100hz isnt that fast as far as microcontrollers go, so you should be able to reach that target. Good luck!




