FLIR Lepton module usage on APF & OPOS

From ArmadeusWiki
Jump to: navigation, search

Page under construction... Construction.png Informations on this page are not guaranteed !!

FLIR Lepton(tm) thermal camera have been tested on APF6 and OPOS6UL platforms. This page detail how to give it a quick try.

Hardware

  • you can use devt kit bought from sparkfun or digikey. Don't forget to buy breakout board AND the sensor ;-).
  • only 80x60 models have been tested yet

Connecting Lepton breakout board to your Dev

APF6Dev OPOS6ULDev
You can use SPI1 on J5 connector (+3V3 and GND)
Apf6dev j5.jpeg
J5 Lepton(tm) breakout
+3V3 (pin 1) VIN
GND (pin 19) GND
SPI1_SCLK (pin 5) CLK
SPI1_SS0 (pin 9) CS
SPI1_MISO (pin 6) MISO
NC/GND MOSI
You can use SPI bus of RPi compatible connector:
J5 Lepton(tm) breakout
+3V3 (pin 1) VIN
GND (pin 9) GND
SPI_CLK (pin 23) CLK
SPI_CS0 (pin 24) CS
SPI_MISO (pin 21) MISO
NC/GND MOSI

Software

  • Even if initially developped for platforms like RaspberryPi or BeagleBone, the following tools are able to run on APF/OPOS:

https://github.com/groupgets/LeptonModule

  • flirpi: it converts and shows Lepton data to framebuffer
  • raspberry_capture: it can capture Letpon frames and store it as images or raw file
  • v4l2lepton: it takes data from Lepton, converts them to RGB and send them to v4l2loopback device. This way Lepton is directly usable with V4L compatible applications like gstreamer.

All these software are using spidev interface to get data from Lepton, so before using them you have to:

# modprobe spidev

flirpi/fblept

  • To display IR image on framebuffer (here magnified by 8x on APF6Dev):
./fblept -m 8 -d /dev/spidev0.0

v4l2lepton

  • First you have to load v4l2loopback kernel module:
# modprobe v4l2loopback
  • It will create you a virtual video camera input in /dev/video0 (if you don't have another camera on your system). To check it:
# v4l2-ctl -d /dev/video0 --all
  • Then launch following the command (in background) to fill virtual camera buffer with IR images:
./v4l2lepton /dev/video0 &
  • Then you can use this device as a normal camera. Example to display Lepton image on APF6Dev LCD:
# gst-launch-1.0 v4l2src device=/dev/video0 ! imxg2dvideosink
  • If your SOM has no IPU/2D accelerator, you can directly use software renderer in framebuffer:
# gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! videoscale ! video/x-raw,width=320,height=240 ! fbdevsink
  • You can also do H.264 encoding and send the stream on the network (here 192.168.0.X is the adress of the Host PC):
# gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! videoscale ! \
     video/x-raw,width=320,height=240,framerate=30/1 ! imxvpuenc_h264 ! \
     rtph264pay ! udpsink host=192.168.0.X port=9001
  • If you don't have any VPU (Video Processing Unit), you can use software encoding (slow):
# gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! x264enc ! rtph264pay ! udpsink host=192.168.0.X port=9001
  • If you have an i.MX6 SOM (and so a VPU and an IPU), you can even do HDMI display and H.264 encoding simultaneously:
# gst-launch-1.0 v4l2src device=/dev/video0 ! videoconvert ! videoscale ! \
      video/x-raw,width=320,height=240,framerate=30/1 ! \
      tee name=t \
      t.src_0 ! queue ! imxg2dvideosink \
      t.src_1 ! queue ! imxvpuenc_h264 ! rtph264pay ! udpsink host=192.168.0.106 port=9001

Links