I am working the Lepton FLIR thermal camera and trying to get a video stream from it using the Raspberry Pi. When I hooked it up and used the already existing code I got a red box on a black screen. When I tried unplug it and plug it back in (the way Spark Fun recommended to fix this problem) I continued to have this problem.

So I found this simplified code online that was supposed to help me fix my problems. However when I set it up I just get nothing but a red screen and the error message "Packet reset counter hit 750" keeps showing up in the console.

I've tried using all the fixes recommended in the forum, but nothing has worked, including increasing the number from 750 to something higher like 100000.

Does anyone on here have any suggestion or solutions? All I want to do is get a video using the FLIR thermal camera.

  • I was referring to the recommendation in the Google Group that I linked to. I was trying to avoid having someone just say "why did you just do what the comments said to do?"
    – sgmm
    Aug 5, 2016 at 15:12
  • Fair enough. This is a little bit of esoteric topic so may take a few days for anyone in the know to notice anyway.
    – goldilocks
    Aug 5, 2016 at 15:29
  • Ya I've been banging my head against this for a few days so I figured I might as well post it here and see if anyone had some past experience.
    – sgmm
    Aug 5, 2016 at 15:30
  • Wow... :D I always wanted to play with those FLIR's - They look really nice! But what is this Lepton FLIR? Its just the camera module? You trying to directly hook it up to the Pi...via USB? CSI? We need to see more.... ehm :D Details plz. To be honest you may not find more info about that here.. its seems like 90% of questions now a days relate to controlling Christmas trees off GPIO (You now, te season's upon us soon)
    – Piotr Kula
    Nov 2, 2016 at 21:49

4 Answers 4


I have the same problem like you with the red square in the video screen. I used the simplified code it still doesn't work. Then I got a new Lepton module and plug it in. It finally works well. I also changed the setup in the LeptonThread.cpp as following:

const char *LeptonThread::device="/dev/spidev0.1";

By default, it uses /dev/spidev0.0"; I changed to /dev/spidev0.1"; and it works well for me.

You need qmake && make to re-compile the code after you change it. Hope this helps.


The LeptonModule code I think you're referring to displays a little red square in its Qt window prior to establishing an SPI connection with the FLIR sensor. If the connection fails for some reason, the red square remains.

There are several reasons why the SPI connection may fail. One is often that the chip select pin should be CS1 not CS0. You can fix this by shifting to the appropriate GPIO pin (quick), or by modding and rebuilding the code (slow). More prosaic reasons include having dodgy wiring, or having failed to set your Pi up to work with SPI (raspiconfig).

Per @ppumkin's suggestion to use the SDK: if you're using the LeptonModule code, you are building with the SDK.


So looking around really I noticed the protocol used on the Lepton is VoSPI (Video over SPI) Frankly never heard of that before but its plausible because the frame size is 80 x 60, which is not a crazy amount of data with some kind of AGC applied format which is selectable (Did you select the correct one?)

I assume you got it hooked up to SPI correctly but one of the problems seems to be the Input Clock rate. Now we know Raspbian is not very great at generating consistent clock rates consistently so you may be experiencing problems with this - The same way may other FLIR'ers are experiencing.

So you may need a separate clock device. I suspect they did not include a crystal in the LEPTON to keep the size down and embedded devices usually have access to some kind of constant clock any way. (They recommend 25Mhz) Did you provide that?

This software you talk about and the arbitrary values... No clue- Sounds like you just changing values without understanding what they supposed to be doing.

They do have an SDK to download, why are you not using that?


What you are experiencing is a loss of sync between the Lepton module and your Raspberry Pi. This is a result missing the start of any one frame (even one of the two duplicate frames.) Your code must be able to capture at 27 fps without interruption to maintain sync. Recall that even though your effective frame rate is only 9 FPS, the two duplicate frames require a 27 FPS capture rate.

The best solution I have come up with to manage this is to have a dedicated thread that does nothing but capture frames. As soon as one is captured a listening thread is signaled and the data is consumed to be packed and further processed. I have been using the Lepton for months (many hours continuously, with many different modules) without a single loss of sync using this method.

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.