Page tree
Skip to end of metadata
Go to start of metadata

Introduction

This page will show you step-by-step how to interface a FLIR Lepton module to the BeagleBone Black/Green.

Hardware Requirements

 

BeagleBone Black at Digi-Key
BeagleBone Green at Digi-Key

LCD4/LCD7 for BeagleBone Black/Green:
LCD4 at Digi-Key
LCD7 at Digi-Key

FLIR Lepton:
Lepton Breakout Board at Digi-Key
FLIR CAMERA IR 80X60 50 DEGREE 9HZ at Digi-Key
FLIR CAMERA IR 80X60 50 DEG W/SHUTTER at Digi-Key
FLIR CAMERA IR 80X60 25 DEGREE 9HZ at Digi-Key

 

Software Requirements

Install latest console image to eMMC

Today the latest version is: 2018-10-07 (these are just monthly snapshots, so always check for the latest)

IOT Image: (BeagleBone Black/Green eMMC)
wget https://rcn-ee.net/rootfs/bb.org/testing/2018-10-07/stretch-iot/BBB-blank-debian-9.5-iot-armhf-2018-10-07-4gb.img.xz

sha256sum: dcd36dcd330d2c6959f86ed13ce88c79515052dcd5c184dd75b0f19ec6c2be02

Insert microSD into pc adapter and check device node name (in our case /dev/sdd):

voodoo@hades:~$ lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sde      8:64   1   3.7G  0 disk 
└─sde1   8:65   1   3.3G  0 part 
sda      8:0    0 465.8G  0 disk 
└─sda1   8:1    0 465.8G  0 part /

Download the *.img.xz and write to microSD card via etcher.io:

voodoo@hades:~$ wget https://rcn-ee.net/rootfs/bb.org/testing/2018-10-07/stretch-iot/BBB-blank-debian-9.5-iot-armhf-2018-10-07-4gb.img.xz
 
voodoo@hades:~$ sudo /opt/etcher-cli/etcher -d /dev/sdf BBB-blank-debian-9.5-iot-armhf-2018-10-07-4gb.img.xz 
? This will erase the selected drive. Are you sure? Yes
Flashing: 17.08 MB/s [========================] 100% eta 0s    
Validating: 0 B/s [========================] 100% eta 0s      
 
Checksums:
  - /dev/sdf: d3aae7d1a808c4826f1e0b45d6d1bac3876ea55cacbb38225d5428d27f4e990ec25ad3e85bd503212a63da2e3fceda7cb666cb4977a02dbd94caf676c1d88cfd

Insert microSD into BeagleBone Black/Green and wait for flashing procedure to finish. (device should shutdown)

Utilize g_serial on usb mini connector

Since we will be using an LCD, we will be losing access to the J1 serial debug header on the baseboard, you can use the pre-loaded g_serial module via: (note, no boot logs will be shown)

gtkterm -p /dev/ttyACM0 -s 115200 &

Setup basic window manager

For this project we are going to use openbox & slim to provide a very basic desktop environment on the LCD.

sudo apt update ; \
sudo apt upgrade ; \
sudo apt install openbox slim xinit xserver-xorg-video-fbdev x11-xserver-utils git libpam-gnome-keyring feh i2c-tools unclutter

Setup /etc/X11/xorg.conf

/etc/X11/xorg.conf
Section "Monitor"
        Identifier      "Builtin Default Monitor"
EndSection
Section "Device"
        Identifier      "Builtin Default fbdev Device 0"
        Driver          "fbdev"
EndSection
Section "Screen"
        Identifier      "Builtin Default fbdev Screen 0"
        Device          "Builtin Default fbdev Device 0"
        Monitor         "Builtin Default Monitor"
EndSection
Section "ServerLayout"
        Identifier      "Builtin Default Layout"
        Screen          "Builtin Default fbdev Screen 0"
EndSection

Check bootloader version

debian@beaglebone:~$ sudo /opt/scripts/tools/version.sh | grep bootloader
bootloader:[eMMC-(default)]:[/dev/mmcblk1]:[U-Boot 2018.03-00002-gac9cce7c6a]:[location: dd MBR]

Update Kernel:

debian@beaglebone:~$ cd /opt/scripts/tools/
debian@beaglebone:/opt/scripts/tools$ sudo ./update_kernel.sh --lts-4_14

Install device tree overlays source for LCD4/LCD7

git clone https://github.com/beagleboard/bb.org-overlays --depth=1
cd ./bb.org-overlays
./dtc-overlay.sh
./install.sh

Shutdown system via:

sudo systemctl poweroff

Install LCD4/LCD7 and powerup BeagleBone Black/Green

Configure SLIM for autologin

Set Default User:

/etc/slim.conf
# default user, leave blank or remove this line
# for avoid pre-loading the username.
#default_user        simone
default_user debian

Enable auto-login

/etc/slim.conf
# Automatically login the default user (without entering
# the password. Set to "yes" to enable this feature
#auto_login          no
auto_login yes

Enable openbox:

echo "exec openbox-session" > /home/debian/.xsession

Lepton qt application

Build/Install Lepton application

sudo apt install build-essential qt4-dev-tools
 
git clone https://github.com/groupgets/LeptonModule

Apply this patch, to push the application to the upper left:

diff --git a/software/beagleboneblack_video/main.cpp b/software/beagleboneblack_video/main.cpp
index 264b0a2..f31c467 100644
--- a/software/beagleboneblack_video/main.cpp
+++ b/software/beagleboneblack_video/main.cpp
@@ -18,7 +18,7 @@ int main( int argc, char **argv )
 	QApplication a( argc, argv );
 	
 	QWidget *myWidget = new QWidget;
-	myWidget->setGeometry(400, 300, 340, 290);
+	myWidget->setGeometry(20, 20, 340, 290);
 
 	//create an image placeholder for myLabel
 	//fill the top left corner with red, just bcuz

and finally build the project

cd /home/debian/LeptonModule/software/beagleboneblack_video/leptonSDKEmb32PUB/
make
cd ..
qmake && make

AutoStart this application on bootup:

mkdir -p /home/debian/.config/openbox/
echo "feh --bg-scale /opt/scripts/images/beaglebg.jpg" > /home/debian/.config/openbox/autostart
echo "/home/debian/LeptonModule/software/beagleboneblack_video/bbb &" >> /home/debian/.config/openbox/autostart

Increase LCD brightness

echo "echo 100 >> /sys/devices/platform/backlight/backlight/backlight/brightness" >> /opt/scripts/boot/am335x_evm.sh

LCD4 Setup

Enable the "BB_SPIDEV0" overlay in /boot/uEnv.txt:

uboot_overlay_addr4=/lib/firmware/BB-SPIDEV0-00A0.dtbo

LCD7 Setup

We need P9.30 for SPIDEV1, which is the enter key on the LCD7, so disable P9.30 in BB-BONE-LCD7-01-00A3.dts

diff --git a/src/arm/BB-BONE-LCD7-01-00A3.dts b/src/arm/BB-BONE-LCD7-01-00A3.dts
index a1c7833..4fdfc2d 100644
--- a/src/arm/BB-BONE-LCD7-01-00A3.dts
+++ b/src/arm/BB-BONE-LCD7-01-00A3.dts
@@ -48,7 +48,6 @@
 		"P9.15",	/* keys: gpio1_16 LEFT */
 		"P9.23",	/* keys: gpio1_17 RIGHT */
 		"P9.16",	/* keys: gpio1_19 UP */
-		"P9.30",	/* keys: gpio3_16 DOWN */
 		"P9.21",	/* keys: gpio0_3 ENTER */
 
 		"ehrpwm1a",
@@ -57,7 +56,6 @@
 		"gpio1_16",	/* LEFT */
 		"gpio1_17",	/* RIGHT */
 		"gpio1_19",	/* UP */
-		"gpio3_16",	/* DOWN */
 		"gpio0_3",	/* ENTER */
 		"lcdc",
 		"tscadc";
@@ -111,7 +109,6 @@
 					BONE_P9_15 (PIN_INPUT | MUX_MODE7) /* gpmc_a0.gpio1_16 */
 					BONE_P9_23 (PIN_INPUT | MUX_MODE7) /* gpmc_a1.gpio1_17 */
 					BONE_P9_16 (PIN_INPUT | MUX_MODE7) /* gpmc_a3.gpio1_19 */
-					BONE_P9_30 (PIN_INPUT | MUX_MODE7) /* mcasp0_axr0.gpio3_16 */
 					BONE_P9_21 (PIN_INPUT | MUX_MODE7) /* spi0_d0.gpio0_3 */
 				>;
 			};
@@ -222,14 +219,6 @@
 				};
 				button@4 {
 					debounce_interval = <50>;
-					linux,code = <108>;
-					label = "down";
-					gpios = <&gpio3 16 0x1>;
-					gpio-key,wakeup;
-					autorepeat;
-				};
-				button@5 {
-					debounce_interval = <50>;
 					linux,code = <28>;
 					label = "enter";
 					gpios = <&gpio0 3 0x1>;

Then rebuild:

cd ./bb.org-overlays
make clean
./install.sh

Enable the "BB_SPIDEV1" overlay in /boot/uEnv.txt:

uboot_overlay_addr4=/lib/firmware/BB-SPIDEV1-00A0.dtbo