Book Image

Banana Pro Blueprints

By : Tony Zhang
Book Image

Banana Pro Blueprints

By: Tony Zhang

Overview of this book

This book follows a tactical plan that will guide you through the implementation of Banana Pro and its configurations. You will then learn the various programming languages used with Banana Pi with the help of examples. In no time at all, you’ll be working on a wireless project that implements AirPlay servers, hotspots, and so on. Following this, you’ll develop a retro-style arcade kiosk game. Then we’ll move on to explore the multimedia features of Banana Pro by designing and building an enclosure for it. After this, you’ll learn to build a remote-controlled smart car and we’ll examine how to control a robotic arm. The book will conclude with the creation of a home sensor system that has the ability to expand or shrink to suit any home.
Table of Contents (15 chapters)
Banana Pro Blueprints
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Add-ons


There are a lot of add-ons available for Banana Pro. LeMaker offers LCD modules in three different sizes from 3.5 inches up to 7 inches. Moreover, LeMaker offers a camera board that can be directly connected to Banana Pro. Last but not least, several cases are available that allow the mounting of an WLAN antenna, while others even provide a hard disk housing.

The LCD module

This table shows the resolution of LeMaker LCDs depending on their panel size:

LCD panel size

Resolution

3 to 5 inches

320 x 240 pixels

5 inches

640 x 480 pixels

7 inches

1024 x 600 pixels

Table 8: The LeMaker LCD panel size resolutions.

In dependence of the LCD panel size, LeMaker offers three different binary files that can be used in order to initialize the LCDs while booting (script.bin). The files are available from GitHub (https://github.com/LeMaker/fex_configuration). This GitHub tree provides both FEX files and compiled FEX files (bin files). Be sure to download the ones for Banana Pro as Banana Pi files are also available. Banana Pro files are named banana_pro_Xlcd.bin, whereas, X represents the LCD panel size (3 to 5, 5, or 7 inches, respectively). Copy this file to the first partition of your microSD card and rename it as script.bin (or whatever your bin file is called).

Tip

Do not overwrite bin files without creating a backup first. There are a lot of settings included in these files, and once the files are lost, changes must be applied step by step again manually.

When operating the LCD display, be sure that your power supply can deliver enough current. While a 2A supply may be sufficient to operate Banana Pro and a 2.5 inch hard disk, the display will draw another 750mA. In this case, a 5V/3A supply is required.

The 7 inch LCD module data is summarized in the following table:

Specifications for the 7 inch LCD module

LCD size

7.0 inch(diagonal)

Interface

Parallel LVDS of 8-bits

Resolution

024 x 3(RGB) x 600

Driver element

a-Si TFT active matrix

Dot pitch

0.05(W) × 0.15(H) mm

Connections to Banana Pro

40-pin FPC to the Display Sensor Interface (DSI)

Surface treatment

Glare

Color arrangement

RGB-stripe

View direction

6 o'clock

Power

5V/550mA

Active area

153.6(W) × 90.0(H) mm

Dimensions

165.75(W) ×105.39(H) × 2.45(D) mm

Weight

300 g

Table 9: The LeMaker 7 inch LCD module specifications

The 7-inch LCD step-by-step guide

In the following section, the installation and operation of a 7 inch LeMaker LCD is described. In the first step, the system will be updated:

sudo apt-get update
sudo apt-get upgrade

Let's look at the software part afterwards. Replace the /boot/bananapro.bin directory with your boot directory and script.bin with your binary startup file:

git clone http://github.com/LeMaker/fex_configuration
cd fex_configuration/
sudo cp bin/banana_pro_7lcd.bin /boot/bananapro/script.bin

Afterwards, edit the /etc/modules file and add the lcd module to it. If the lcd module is already available and commented out using #, simply remove the hash sign as shown in the following screenshot:

Figure 18

After this, power off Banana Pro before installing a cable for the 7 inch LCD. The 7 inch display comes together with a 100 mm and 0.5 mm spacing flexible printed circuit (FPC) cable.

Figure 19: The LeMaker 7 inch LCD with the FPC cable and Banana Pro

Turn the LCD around carefully and gently pull out the brown cable clamp from both ends:

Figure 20

Push the flexible cable carefully. Make sure it is straight and the silver conductive end faces downwards toward the blue circuit board, and blue tape faces upwards (Figure 18). After the cable has been inserted completely, push down on both sides of the cable clamp at the same time.

Installing a cable on Banana Pro is pretty much the same as installing the cable on the preceding LCD module. The cable connects to the CON2 connector of Banana Pro board. Do not use the CON1 camera connector. Again, pull out the cable clamps at both sides and push the cable in from the top. The blue protective tape must face the Ethernet jack, while the conductive fingers at the end of the cable face Banana Pro board (Figure 21):

Figure 21: Connecting the LCD to Banana Pro

After the cable is inserted completely, push down on both sides of the clamp and boot your Banana Pro. You should now see this booting screen on the LCD (refer to Figure 22).

Figure 22: Banana Pi using the 7 inch LCD module

The flex cable that's provided is quite short (100 mm only). If you want a larger cable, you may search the Internet for FPC cable 40 0.5 mm. The LCD is capable of showing the X11 desktop (refer to Figure 23) as well as high-resolution videos in full HD.

Figure 23

Banana Pro shows an H264 video on a 7 inch LCD using mplayer. This will look similar to what is shown in the following image:

Figure 24

The camera module

Banana Pro camera module (Figure 25) uses an Omnivision 5640 CMOS image sensor in an autofocus module and with an integral IR filter. The camera module connects to Banana Pi board via the CSI (CON1). It fulfils the specifications provided in Table 10.

Figure 25: The Banana Pi/Pro camera module.

The following are the specifications for the LeMaker Banana Pro camera module:

Specification type

Requirements

Image sensor

An omnivision 5640 CMOS image sensor in an autofocus module with an integral IR filter (650±10nm)

Resolution

5 megapixels

Active array size

2592 x 1944

Maximum frame rate

1080p 30fps@24Mhz

Picture formats

JPEG PNG YUV420 RGB888

Video formats

Raw h.264

Connection to Banana Pro

A 40-pin FPC to the CSI-0 (Camera Sensor Interface)

Image control functions

  • Automatic exposure control (AEC)

  • Automatic white balance (AWB)

  • Automatic black-level calibration (ABLC)

  • Automatic band filters

  • Mirror and flip functions

Temperature range

For an OS: -30 °C to 70 °C

For a stable image: 0 °C to 50 °C

Lens size

1/4" (quarter inch)

Dimensions

36 x 32 x 10 mm

Weight

5 g

Table 10

A step-by-step guide to the camera module

The installation of a camera module is as easy as the installation of an LCD module. Firstly, required kernel modules will be inserted and are specifically used by this component:

sudo modprobe ov5640
sudo modprobe sun4i_csi0

The preceding commands load the Omnivision camera kernel driver and the CSI driver. In order to load these drivers permanently, add the ov5640 and sun4i_csi0 modules to /etc/modules using this command:

sudo nano /etc/modules

Tip

If your Linux OS does not have a module called sun4i_csi0, try sun4i_csi instead.

Before installing the hardware to your Banana Pro, make sure it is shut down and disconnected from any power supply. Similar to the LCD module cable, remember to also not touch the silver ends of the camera module flexible cable. The cable, again, is quite short (about 6 cm in length).

The Banana Pro camera module connector is shown in Figure 24. Open the connector and insert the flexible cable carefully (Figure 25).

The connector in Banana Pro is called CON1. Do not use CON2 instead as this is the LCD connector (refer to The LCD module section). Using the wrong connector can cause serious damage to your Banana Pro or the extension board because the pin definitions are completely different.

Open the CON1 connector and put the free end of the camera flexible cable into this connector as shown in Figure 26. Finally, confirm that both ends of the flexible cable are sitting correctly in their sockets. Before using the camera, peel off the plastic foil that covers the lens. The complete arrangement can be seen in the following figure:

Figure 26

The mplayer software can be used in order to test the camera:

sudo apt-get install mplayer
sudo mplayer tv://

On a television, the result would look like what is shown in the following image:

Figure 27

Cases

Although Banana Pro has been available since the end of 2014, there are already a few cases available. Most cases are acrylic cases (refer to this image):

Figure 28: The Banana Pro acrylic case (source: Amazon.com)

Lenovator offers a case that can integrate both Banana Pro and a 2.5 inch hard disk drive (Figure 29). The case allows the mounting of the original LeMaker Wi-Fi antenna that's provided together with Banana Pro.

Figure 29: The Lenovator Banana Pro case with a hard disk bay

Banana Pro uses an onboard U.FL connector (refer to Figure 30). The female U.FL connectors are not designed with reconnection in mind, and they are only rated for a few reconnects before replacement is needed.

Figure 30: Banana Pro onboard the UFL antenna connector (source: Wikipedia)

For those of you who do not want to integrate a hard disk into a case, the acrylic case of Allnet may be a good choice. The case comes with an R-SMA 5 dBi omnidirectional antenna and adapter cable from U.FL to R-SMA.

Figure 31: The Banana Pro acrylic case with the 5 dBi antenna and R-SMA connector (source: the Allnet shop)

GPIO add-ons

Lenovator provides a general purpose input/output (GPIO) interface called LN digital. LN digital is designed to plug in Banana Pro's GPIO header

GPIO can be used for input (such as reading sensor information) and output (such as controlling relays and motors). So, the peripherals you buy are typically either input or output devices for GPIO. This extends the basic functionality that are offer from the GPIO on the Pi. The board offers the following:

  • 8 open-collector outputs

  • 8 LED indicators

  • 8 digital outputs

  • 4 tactile switches

  • 2 changeover relays

It can be plugged directly into Banana Pro GPIO socket and programmed in Python, Scratch, or C (refer to Chapter 2, Programming Languages).

Figure 32: The LN digital interface board for Banana Pro

An onboard microphone

Banana Pro provides an onboard microphone. Recordings can be made using this command:

sox -t alsa default output.wav

The preceding command requires sox to be installed. If sox is not available, it can be installed using this command:

sudo apt-get install sox

Press Ctrl + C to stop the recording. The recording will be saved as output.wav in the current directory. Recordings can be listened to using this command:

mplayer output.wav

The microphone sensitivity can be set using the following command:

alsamixer

The complete audio installation and settings will be explained in detail in Chapter 4, An Arcade Cabinet.

Figure 33: Setting the microphone sensitivity using alsamixer