Friday, September 16, 2016

Implementing Software-defined radio and Infrared Time-lapse Imaging with Tensorflow on a custom Linux distribution for the Raspberry Pi 3

GNURadio Companion Qt Gui Frequency Sync - multiple FIR filter taps
sample running on Raspberry Pi 3 custom Linux distribution
The Raspberry Pi 3 is powered by the ARM® Cortex®-A53 processor.  This 1.2GHz 64-bit quad-core processor fully supports the ARMv8-A architecture.
For this project, a custom Linux distribution was created for the Raspberry Pi 3.

The custom Linux distribution includes support for GNURadio, several FPGA and ARM Powered® SDR devices, D-STAR (hotspot, repeater, and dongle support), hsuart, libusb, hardware real-time clock support, Sony 14 megapixel NoIR image sensor, HDMI and 3.5mm audio, USB Microphone input, X-windows with xfce, lighttpd and php, bluetooth, WiFi, SSH, TCPDump, Docker, Docker registry, MySQL, Perl, Python, QT, GTK, IPTables, x11vnc, SELinux, and full native-toolchain development support.  

The Sony 14 megapixel image sensor with the infrared filter removed can be connected to the Raspberry Pi 3's MIPI camera serial interface.  Image capture and recognition can then be performed over contiguous periods of time, and time-lapsed video can be created from the images.  With support for Tensorflow and OpenCV, object recognition within images can be performed. 

D-STAR hotspot with time-lapsed infrared imaging.

For the initial run, an infrared Time-lapse Video was created from an initial image capture run of  one 3280x2460 infrared jpeg image captured every 15 seconds for three hours.  40, 5mm, 940nm LEDs, powered by 500ma over 12v DC provided infrared illumination in the 940nm wavelength.

Tensorflow was running in the background (on v4l2 kmod) and providing continuous object recognition and scoring within each image via a sample model.  Finally, OpenCV was also installed in the root file system.

The time-lapse infrared video was captured of my living room using the above setup and custom Linux distribution.  Below this image are images of Tensorflow running in a terminal in the background on the Raspberry Pi 3 and recognizing/scoring objects in my living room.

The Yocto distribution configuration file, image configuration file, custom recipes, and build configuration files are available on github at

Tensorflow running on the Raspberry Pi 3 and continuously capturing frames from the image sensor and scoring objects
GNURadio Companion running on xfce on the Raspberry Pi 3

Friday, September 2, 2016

HamPi - A Custom Linux distribution for the Raspberry Pi 3 and D-Star

The HamPi Linux distribution for the Raspberry Pi 3 is designed for amateur radio operators to communicate on the D-Star network.  This distribution differs from other HAM radio distributions for the Raspberry Pi in that all software components were compiled from their actual sources. In addition, the DVAPTool and DVAPNode software components were not used. Instead, the open source dstarrepeater software was used to communicate with the attached DVAP.  The HamPi Linux distribution is built 100% from open source software.  All components, including the HAM radio software stack which resides in userland were compiled from source.

The HamPi Linux distribution also has support for the Raspberry Pi 3 NoIr Video Camera with Sony image sensor.  Therefore; time lapsed videos can be created on the HamPi with an attached Sony image sensor.

The HamPi distribution and image recipes are available on github. I have not included the HAM radio software source recipes but may at a future time.  ircddbgateway, dummyrepeater, dstarrepeater, and ambeserver were all compiled from source code. dummyrepeater and ircddbgateway can be used without ambeserver as the latest dummyrepeater sources include support for both GPIO based devices and serial/UART devices that are attached over USB.  The functionality from DVAP Node was merged into dstarrepeater which is in turn part of the OpenDV sources. dstarrepeater contains native support for serial/UART devices that are attached via USB.  As noted above, Yocto recipes for ircddbgateway, dstarrepeater, ambeserver, and dummy repeater are not included as part of the HamPi distribution at this point.  The sources for these components are available on github.

The custom Linux Distribution is called the HamPi Distribution and is a Poky variant.
The custom Linux Image is called the HamPi Image.
The Machine type is raspberrypi3 for the Raspberry Pi 3.

The distribution and image contain the following.
  • U-Boot 2016.03
  • GNU/Linux Kernel 4.1.21
  • Device Tree Overlay Device Customization
  • ext3
  • WiFi
  • Bluetooth
  • HDMI, 3.5mm, and USB audio output
  • USB audio input
  • I2C
  • Real-Time Clock support
  • Raspberry Pi 3 Video camera support
  • TCPDump
  • systemd
  • udev
  • devtmpfs
  • SELinux + mls ref policy
  • Docker
  • Containerd
  • Native GCC compilers, make, and autotools
  • OpenSSH client and server
  • XFCE
  • Python
  • WiringPi
  • libusb
  • Perl
  • MySQL
  • OpenFlow
  • libvirt
  • GTK+3
  • Git
  • ffmpeg
  • gstreamer
  • ALSA libraries and utilities
  • Raspicam
  • Development versions of all packages.
  • License files for all software.