I want to read the output of OV7670 camera module that produces 8-bit output at a very high frequency. The output pixel clock frequency is around 8MHz. I have to sample those 8-bit data at raspberry pi's GPIO at every falling edge of pixel clock. I am coding the same in python. can anyone can say at what speed raspberry pi samples at GPIO?

  • 1
    Why don't you just run your script and find out?
    – joan
    Commented Mar 8, 2020 at 17:28
  • I tried counting the number of pixel clock rising/falling clocks per second by enabling interrupt, but it didn't count the exact number. The pulses it counted is way more less than what it should be! Commented Mar 8, 2020 at 17:37
  • So you already know the answer. You might be able to optimise your script slightly but you will never achieve your aim with Python on the Pi.
    – joan
    Commented Mar 8, 2020 at 17:42
  • So raspberry pi isn't suitable for this application?or I can achieve this with raspberry pi using scripts other than python? Commented Mar 8, 2020 at 17:45
  • 1
    Does this answer your question? How fast can GPIO pins toggle? Commented Jan 29, 2021 at 10:35

3 Answers 3


If you want to work with video on a Pi, you can get a USB VGA webcam for almost the same price as the OV7670 module, and get the video stream via v4l interface ("/dev/video") which will work faster and be easier to use.

If you want to play with low-level video acquisition, get a fast microcontroller with a dedicated data port (1 pins which can be read at once in a single byte). The Pi is not really suitable for this.


We have recently tested the read speed for two python libraries, PIGPIO and RPi.GPIO, by simulating on the raspberry an 8-bit sipo register with an 8-bit D flip flop connected on it's parallel output.

The test was performed on a Raspberry Pi 3b.

Both libraries perform well for frequencies of up to 5 KHz, with accuracy above 99%. The accuracy of the Rpi.GPIO library deteriorates over 5 KHz and at 50 KHz it is incapable of performing this task.

The PIGPIO library performs comparably better, with its accuracy being above 99% for frequencies up to 20 KHz. Above that frequency, its performance gradually deteriorates and at 110 KHz it cannot read correctly any phrase at all.

You can find the exact test setup and results on this this post: https://atman-iot.com/blog/raspberry-pi-benchmark/


I'm facing a similar issue. I want to read clock signal of 10Mhz. I'm able to read only up to 7MHz clock signal.

However, in my code, the GPLEV0 reading speed is about 40M times a second. Even with this reading speed, the clock is not able to read. [Makes no sense to say reading at 40MSPS yet not able to catch the clock at 10MHZ. But it is happening with me]

Anyways, the code to read GPLEV0 in a tight loop 30M times a second has been posted in the links below. To read at 40M times a second, you'll have to run the code in a service and add a start/stop triggering mechanism.

Here is my detailed issue with the code:


Recommended GPIO to read 10Mhz clock in CM4

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.