(One intermediate revision by the same user not shown)
Line 269: Line 269:
  qmake && make
  qmake && make


*Your thermal camera is ready for use!
*Your thermal camera is ready for use! To get it to work, run:


sudo ./raspberrypi_video


=== Changes and Erros ===
=== Changes and Erros ===

Revision as of 13:30, 30 June 2015

This tutorial was created to help everyone who wants to install a Lepton camera using a Raspberry Pi. We used the information available in many tutorials and added our own knowledge to improve them.

The device that we tested is the Raspberry Pi B + but the installation shouldn't be too different for other versions of the device .

About Lepton camera

Lepton is a complete long-wave infrared (LWIR) camera module designed to interface easily into native mobile-device interfaces and other consumer electronics. It captures infrared radiation input in its nominal response wavelength band (from 8 to 14 microns) and outputs a uniform thermal image.

Environment Specification

Operating Temperature Range -10° C to 65° C

(-20° C to 75° C with some possible performance degradation)

Maximum Operating Temperature 353.15 K (80 °C)
Storage Temperature 40° C to 80° C
Relative Humidity 95 %
Thermal Shock Air-to-air across operating temp. extremes (-10° C to 65° C, 65° C to -10° C)
Vibration Transportation profile, 4.3 grms

Image Characteristic

Intrascene Range 0 K to >400 K

(-273.15°C to > 126.85°C)

Operability : Number of non-defective pixels >99.0%

( < 1 % defect typical )


Applications

  • Safety and Security
  • Automotive
  • Micro and Nano UAV/UGV platforms
  • Home Repair & Energy Efficiency
  • Building Automation & Presence Detection


If you want to know more specifications about the Lepton Camera, you can go on Lepton Datasheet

Fig 1: Lepton Camera

Hardware

Required Materials

These are the materials that you will need to install your Lepton Camera:


  • Raspberry Pi Model B+.
  • A 5V power supply with a micro USB termination.
  1. it need to able to source at least 700mA
  2. It can be a phone charges, they work well.
  • An SD Card:
  1. Bigger than 8 GB and up to 32 GB of storage
  2. No less than class 4.
  • A USB keyboard
  • A mouse ( with a USB connection)
  • A HDMI cable
  • An Ethernet cable and a connection to an Internet-connected network.If you want to use WiFi in your Raspberry Pi, you can buy a adapter WiFi connection. In this tutorial was used a Mini 150Mbps USB 2.0 WiFi Antenna Wireless Network LAN Card Adapter 802.11N/G/B.Adapter WiFi connection

Prepare the SD Card – Formatting

First of all, we are going to format and prepare the SD card. In this section, you are going to use your computer. The first step will be formate the card and the second step will be install the NOOBS software( Your Raspberry will need it). In this tutorial we are using the OS windows. If you have other one, you can check the steps on Different OS.Please, follow this instructions:

Formatting the card

  1. Go online and Download Formatter for Windows
  2. You need unzip your Download and run Setup.exe.
  3. You just need to accept this program in your computer.
  4. Now, you need to open SD Formatter ( The program that you just installed). You should see see something like this"
A1.png
  1. Click Option and set FORMAT SIZE ADJUSTMENT to ON.
    A.2.png
  2. In the place where is written "Drive", you need to select your card. If you are using only one card in your computer, it should be automatically selected.
  3. Now, you can finish the formatting part. You just need click in "format " and then click in "OK" a couple times.
  4. You are DON! Now, we need to installing NOOBS.

Installing the NOOBS Software

  1. Go online in Download Pages and download the most recent NOOBS (offline install) (NOOBS_v1_3_2.zip as of writing this).
  2. You need to extract the ZIP folder. It needs to seen with this:
A3.png
  1. Now, you need to replace this unzip folder in your card.
  1. Your card now is ok! You are DONE with your SD card.

Connections

First of all, you need to be careful with the Lepton camera. It isn’t particularly sensitive to electrostatic discharge, it is a complex and relatively pricey component. You need to take a few precautions while working with it so you don’t accidentally zap it.

You will follow this diagram below. Even Though that representation has 20 GP10 (40 pines) and the Raspberry Pi has just 13 GP10 (26 pines), you just need to take care about the first 26 pines. Therefore, you are going to use the only the first 26 pines, such as the diagram below:

NEW.png

Now, we can start to build the project. Follow the steps below:

1) Connect the monitor

Connect your HDMI cable in your Raspberry and in your monitor. ( Maybe you will need a VGA to HDMI adapter).

2) Connect mouse and keyboard

Next up, connect your mouse and keyboard.These connections will be similar to this:

3) Insert SD Card

Insert your prepared SD card into the Raspberry. Make sure that it is connected.

4) Internet

You will need to make downloads on websites when you work in your software section. Therefore, you need a good internet connection. You can use either a Ethernet cable or a Wifi adapter. In case you chose an wifi adapter, the instructions are here.

5) Connect Power

Make sure that the previous connections are good. If they are working, you can connect the power supply on your Raspberry.

You are done with the Hardware section! Your project should look like this:


WiFi adapter

You can use an WiFi adapter or an Ethernet cable to connect your Raspberry Pi to the internet. In case you choose to use the WiFi adapter, the instructions are the following:

The Raspberry Pi official website provides 3 different tutorials to install the WiFi adapter. Those instructions did not work when we tried them. In case you want to try to use them, they can be found here.

In this tutorial we will be using the commands that worked for us. Command line commands are going to be used to install the WiFi connector.

  • First, Connect your adapter WiFi in your Raspberry Pi.
  • Open your LXT Terminal.
  • The first step will be check out witch WiFi are available for your Raspberry Pi. Therefore, enter with the command below:
sudo iwlist wlan0 scan
  • You will see all the WiFi available for you. Pick up the WiFi that you want to connect. You just need to memorize the ISSD and the password of the WiFi of your choice.
  • Now, enter the following command:
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf
  • you need to add the code below to the file. Remember the early step that you needed to do ( Memorize the IDSS and the Password).
network={
   ssid=" Your ESSID"
   psk="Your_wifi_password"
}

Here is an example for you:

network={
   ssid=" MichiganTech"
   psk="12345678"
}

  • When you finish, use Ctrl + X, chose Y, and press Enter. ( it will save the changes you have done)
  • Now, you will active your changes.Therefore, use:
sudo ifdown wlan0
  • Now enter the following command:
sudo ifup wlan0
  • you can check if your WiFi is working using the command below:
iwconfig
  • You probably will see your Wlan0 connect in the WiFi that you have chosen.

Software

When you finish the Hardware part you will work on the Software part.

Raspbian

Raspbian is a free operating system based on Debian optimized for the Raspberry Pi hardware. It is the operating system that you will be using on you Pi.

When you finish the Hardware part you will work on the Software part.


  • As your monitor start to receipt the Raspberry signal, you will be able to see a screen like the one shown below.(It can take some time for the monitor to recognize the Raspberry signal, but it is normal.)
    AB1.png
  • Click in the first option ( Raspberry RECOMMENDED).
  • Click in "Install". It will take about 30 minutes to install.

After this part your Raspberry Pi is ready for use

FLIR Lepton thermal camera software

When the installation of Raspbian is finished, it is time to install the FLIR Lepton thermal camera software. We are using Pure Engineering code to run the Lepton

  • Now, you need to open the LXTerminal, where you will type your commands. Click in the icon showed in the picture below:
Incone .png
  • When it is done, you need to enter the command below. It will open the configuration section for you.
sudo raspi-config
  • You will see this windows:
    AB2.png
  • Go to “Advanced Options”.
  • You need to activate the "SPI". For this, follow the instructions below:
    • Select SPI
    • You need to enable the SPI interface: click "YES"
    • Click in "OK"
    • You need that your SPI Kernel Module to be loaded by default, therefore click "YES" .
    • Click in "OK"
  • After this, do the same to I2C.
  • Now, you will be asked if you want to reboot your Raspberry Pi. Do it.
  • Now, it is time to use the internet connection. You need to download the QT application( example codes from Pure Engineering). Therefore, make sure that you have a good internet connection.
  • For the next steps, enter the following command:
sudo apt-get install qt4-dev-tools
  • After this, you will be asked to enter with "y" or "n". Enter "y".
  • Now go to the internet icon and this website: https://github.com/PureEngineering/LeptonModule
  • When you open the website, click in “Download ZIP” (it is in the right side of your screen).
  • Move your downloaded folder to the pi directory.
  • Now unzip the zipped folder. Use the command:
unzip LeptonModule-master.zip 
  • Now change the current directory to the folder "raspberrypi_video" that is in the "LeptonModule-master" folder. Do that using the command:
cd /home/pi/LeptonModule-master/raspberrypi_video
  • Now, you need to cd into the “LeptonSDKEmb32PUB” directory and run "make":
cd /home/pi/LeptonModule-master/raspberrypi_video/leptonSDKEmb32PUB
make
  • After this, cd back to the “raspberrypi_video” directory:
cd /home/pi/LeptonModule-master/raspberrypi_video
  • Now, run:
qmake && make
  • Your thermal camera is ready for use! To get it to work, run:
sudo ./raspberrypi_video

Changes and Erros

Video size

It is possible to change the video size:

1 – Open the main.cpp file. It is located in the "raspberrypi_video" folder

Main.cpp-in the folder2.png

2 - The part of the code showed in the picture below defines the size and position of the video window. The numbers in the red box define where the window will appear in your screen and the numbers in the green box define what size that window will have.

2015-06-02 09-52-57.png

3 - You will also need to change the size of the image that is sent to the placeholder window and the position of the "Perform FFC" button.

Image size-FFC position.png

4 - To save your changes go to the left top side of the page press "file" and click in "Save"

5 - After you finish, go to the LXTerminal, cd to the "raspberrypi_video" folder and run "qmake && make"

6 - Your changes were saved, run the program and check if that is what you wanted. If you don't like the resolutions you can change it back or change it to another size

Perform FFC

We experienced an error when pressing the "Perform FFC" button. If you experience the same error you can follow the instructions below:


1 – Go to LXterminal and execute the following command:

sudo nano /etc/modules

2 – Go to the last line and write: “i2c-dev”

3 – Press “ctrl o”

4 – Press Enter

5 – Reboot the system. The FFC should be working now

Recording Video

The current best way to record the video produced by the FLIR Lepton camera is to connect the raspberry to a PC or laptop. That is easily achievable using VNC (Virtual Network Computing). VNC allows a user to remotely control the desktop interface of another computer. Other advantages of using VNC with Raspberry are:

  • There are many open source screen recorder programs
  • It will allow the user to control the raspberry using linux or windows system
  • The recorded files will be saved in the user’s computer, therefore, it won't be necessary to store it in the Raspberry memory card
  • It won't be necessary to attach a monitor, keyboard and mouse to the Raspberry
  • Using VNC we can easily carry the thermal camera system

VNC connection

To set up a VNC is easy. You will need to set up both the raspberry and the computer that you will be using to remotely control your raspberry.

Setting up the Raspberry Pi

- Go to the LXTerminal and install the Tight VNC Package

sudo apt-get install tightvncserver


- Run the TightVNC Server

tightvncserver


- The server will require you to enter a password. The password needs to have more than 4 and less than 9 characters

  • The LXTerminal doesn't allow you to see the password you are typing. Just type it and press enter.


- Start a VNC session

vncserver :1 -geometry 1920x1080 -depth 24
  • The ":1" represents the number of the VNC session (you can have more than one VNC sessions)
  • It is possible to change the resolution of the screen. In this example we are using full HD resolution (1920x1080)


- If you wish to set up a VNC session from the start up, follow the instructions on the elinux.org website

- If you want to end a VNC session, use the command:

vncserver -kill :display
  • ":display" is the number of the VNC session
Setting up your computer
  • In the last step of setting uo your computer you will need the IP address of your Raspberry Pi. If you don't know the ip adress of your Raspberry Pi, execute the following command on the LXTerminal:
ip addr show
  • The IP address is the number in the blue box
IP address


Windows

Follow the instructions for your Windows based computer on the Raspberry.org: Windows website.

Linux

Follow the instructions for your Linux based computer on the Raspberry.org: Linux website.

Mac OS

Follow the instructions for your Mac OS based computer on the Raspberry.org: Mac OS website.

Screen recorder software

You will need a screen recorder software to capture the video that the Lepton Thermal camera is sending to your computer. You can use whichever program you want. We are listing some open source software options.

Windows

We downloaded and tested ShareX. ShareX is a open source software that allows screen recording, printing screen and has many tools. You can download the software for free at getsharex.com

Linux

Mac OS

Recording video on the Raspberry

This is a work in progress

Install ffmpeg from source. This step is very important. It won't work with the Raspbian version of ffmpeg because the Debian version of libavcodec doesn't contain the H264 libraries needed for the flash streaming protocol.(From the Raspberry Forum)

sudo aptitude remove ffmpeg
cd /usr/src
sudo mkdir ffmpeg
sudo chown `whoami`:users ffmpeg
git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpeg
./configure
make
sudo make install


  • Running ffmpeg
ffmpeg -f x11grab -s 1024x768 -r 25 -i :0.0+250,150 /tmp/out.avi

This will grab the image from desktop, starting with the upper-left corner at (x=250, y=150) with the width and height of 1024x768. In this example the video is being saved in a temporary folder, you can save it in another folder. "out.avi" is in the format "filename.fileformat".

You can find more information about ffmpeg here and in the ffmpeg.org website.

Cookies help us deliver our services. By using our services, you agree to our use of cookies.