I'm trying to use FLIR Lepton 3 module with Raspberry Pi 0 W board running Raspbian 9 Stretch. I followed all official FLIR recomendations: connected Lepton module to Raspberry in the correct way (SPI0 port, CE0 as CS pin). I2C and SPI busses have been enabled trough raspi-config. I'm trying to use raspberrypi_video application from this (official) repository:


Everything complied correctly after installing all required libs and after a little rework to adapt the code to the Lepton3 module (different picture size among other) I can see frames coming out but the rate is poor (well below 9Hz .. more probably 0.25 Hz) picture looks like is dived in 4 bands and mixed in the wrong order or taken with a different timing (attached a sample)... I think is some kind of problem of SPI bandwidth or loss of synchronization. The application is not reporting any error/exception during execution.

RPi0W Capture

I tried also with more Lepton3 specific code without more luck (same issues). I tried also changing CE0 with CE1 (and changing spi device code accordingly) without any positive effect as it was obvious.


Someone tried succesfully the same configuration? I know someone did since there's a video of my same configuration running fine:


Of course I tried the code reported along youtube video but the result is always the same (except for the color palette).

I had no issues using the same configuration on Raspberry Pi 3 B+, video frames are played at the maximum rate (~9Hz) without any visible artifacts.

RPi3B+ Capture

I don't think it's a problem of hardware resources since top CPU load during my test on RPi0W was never over 30%. Of course I tried with a different RPi0W unit without any appreciable difference.

I found a partial fix adding spidev.bufsiz=131072 sentence to /boot/cmdline.txt (thnx to Luke Van Horn) now the image is not splitted in 4 bands (maybe they are just 2 but more in synch) but the frame rate is still poor (0.5 - 0.25Hz).


  • Check your RAM usage, CPU isn't everything.
    – user96931
    Apr 30, 2019 at 20:13
  • good hint but I think it's not the problem...
    – weirdgyn
    May 1, 2019 at 7:30
  • 1
    I found the problem (I'll publish the resulting code later). It's not a matter of memory but merely a problem of synchronization. The original code rely on a very poor synchronization principle (not for the coding in itself but camera protocol is not 100% sync-aware) this lead to a large amount of segment/frame skipping. This could be tuned by working on some delay values. I think is better to rely on more reliable media. Since camera can be set to provide an IRQ on each frame I'm using this trigger to get frame data. This allowed to achieve all frames at (almost) maximum rate even on RPi0W.
    – weirdgyn
    May 7, 2019 at 9:31
  • how did you implement the synchronization, are you polling the GPIO, or have you used interrupts in the cpu?
    – curious
    Aug 17, 2023 at 17:30
  • as stated in the answer below the only practical solution to this issue was to use VSYNC interrupt output from FLIR module and to bind it to event handler whitin your code. Anyway LEPTON has many other HW issues that often prevents any solution from working properly in 'real life' environment...I would not recomend to use such module with a Raspberry... I add the resulting code github repo if you want to take a look...
    – weirdgyn
    Aug 26, 2023 at 6:48

1 Answer 1


I haven't found a proper way to fix the code as is but I found a more reliable way to code the same functionality. I will post the code later but if someone need an hint about Lepton frame syncronization issues I suggest to set GPIO3 to output a VSYNC event and to handle it accordingly.

This's the resulting code

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.