Banana Pro Blueprints - Ruediger Follmann - E-Book

Banana Pro Blueprints E-Book

Ruediger Follmann

0,0
39,59 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

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.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB
MOBI

Seitenzahl: 300

Veröffentlichungsjahr: 2015

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Table of Contents

Banana Pro Blueprints
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
1. Introduction to Banana Pro
Banana Pro
Specifications of Banana Pro
Banana Pro onboard LEDs
Getting started
The first boot
Available operating systems for Banana Pro
Android
Linux
The FEX file
Transferring an OS to a hard disk
Add-ons
The LCD module
The 7-inch LCD step-by-step guide
The camera module
A step-by-step guide to the camera module
Cases
GPIO add-ons
An onboard microphone
Summary
2. Programming Languages
Basic principles
Remote connections
Secure Shell
Using xrdp for remote desktop connection
Basic requirements for programming Banana Pro
Editors
Shell programming
Checking the Banana Pro temperature
Controlling Banana Pro's LEDs from SSH
Programming GPIOs from SSH
Another shell example
WiringBP
Python
The basics
A simple web server
Using Python for GPIO
Setting LEDs in Python
A Python window example
C/C++
The WiringBP C code example
C access to onboard LEDs
Debugger
Scratch
Hello world – example for Scratch
Using LN Digital with Scratch
New kernels
Compiling on Banana Pro
Cross-compilation
Summary
3. Wireless Projects
OpenVPN
Connecting from Android
WLAN
Setting up WLAN
Setting up an access point mode
On air
The AirPlay protocol
Using an external USB SPDIF soundcard
AirPrint
Configuring CUPS
Printing from Android and iOS
Serving web pages
Installing PHP and MySQL
Installing contao
A measurement server
The FTDI/SPI control of devices
A web server
Explanations
The Python web server
The Python/C interface
C programming
Summary
4. An Arcade Cabinet
Implementing hardware accelerations
Installing dependencies
Installing modules
Installing packages
Installing a directory
Installing libdri2
Installing libump
Installing the sunxi-mali driver
The X11 version of the sunxi-mali driver
The framebuffer version of the sunxi-mali driver
Installing xf86-video-fbturbo
Getting device permission
Testing hardware acceleration
Implementing libretro emulators
Installing dependent packages
Installing libretro frontend - RetroArch
The X11 version of RetroArch
The framebuffer version of RetroArch
Installing libretro cores
Installing iMAM4ALL libretro core
Installing the SNES libretro core
Configuration
Playing games
Playing a game directly with a command line
iMAM4ALL games
For SNES
Playing a game from the RetroArch menu interface
Testing games
Building PCSX
Installing dependent packages
Installing PCSX
Downloading PCSX ReARMed
Patching
Compiling and installing
Playing PCSX games
Configuration
Testing PCSX games
Making an arcade cabinet for Banana Pro
Preparing the materials
A suitcase
A joystick
A micro USB extended line
A USB hub
An LCD display
An audio extended line
A mini keyboard
Designing a frame
Assembling
Assembling a base frame
Assembling Banana Pro and a joystick
Mounting an LCD
Assembling a top frame
Playing the Banana Pro arcade cabinet
Configuring output to an LCD
Configuring a joystick controller
Playing the game on the arcade cabinet
Summary
5. A Multimedia Center
Kernel preparation
Adding the I2S audio device
Setting the graphics memory to maximum
Deactivating display driver kernel logging
Activating IR driver key repetition
Activating the sunxi lirc driver
Correcting display driver brightness
Adding the DVB-SKY S960 USB box
Installing the accelerated mali driver
Video Disk Recorder (VDR)
Setting display settings
Setting locales
Adding (non-free) Debian multimedia packages
Loading required modules
A network address
Editing the FEX file
Installing required packages
Installing and patching VDPAU
Compiling VDR
Defining a sound device
Adding a default sound device
Using an electrical SPDIF with Banana Pro
Configuring a remote control
irexec
Adding a USB DVB stick
The DVB kernel driver
The DVB userspace driver
VDR scripts
Adding plugins to VDR
Watching DVDs
Listening to audio CDs
Watching teletext
Changing VDR's skin
Streaming TV to mobile devices
Switching to external players
Additional plugins
Remote controlling the VDR
Troubleshooting
Device permissions
Changing libvdpau version
The Xbox Multimedia Center (XBMC) installation
Summary
6. Remote Controlling a Smart Monitor Car
Implementing the IP camera
Installing ffmpeg
Installing nginx
Configuring the nginx server
Starting the nginx server
Accessing the nginx server
Autostarting the nginx server at system boot
Setting up a camera
Camera specifications
Connecting the camera module
Testing the camera module on Banana Pro
Streaming a video via the Internet
Setting up the hardware of a smart monitor car
Preparing the materials
A car suite
The L289N motor drive board
Battery
A 5 inch LCD
Assembly
Configuring the display output for the 5 inch LCD
Controlling a smart monitor car using a remote
Webiopi for Banana Pro
Installing webiopi for Banana Pro
Testing webiopi on Banana Pro
Using webiopi to control the car
The control logic
Writing the webiopi controlling code
Adding the car controls to the IP camera web page

Summary
7. A Laser Engraver
Setting up the frame for laser engraving
Preparing materials
Setting up the laser engraving machine hardware
Configuring software on Banana Pro
Installing dependencies
Installing the GrblController software
Installing software on a PC
Installing Inkscape
Installing Arduino
Loading a program into the laser CPU
Loading bootloader
Loading the driving code
How to use a laser engraver
Generate the G code
Beginning the engraving process
Summary
8. Scratch – Building a Smart House
Configuring LeScratch
Installing the prerequisites
Setting up the system
Setting up Scratch Mesh
Running LeScratch
Controlling the LeScratch peripherals
General Purpose Input Output (GPIO)
Instructions
Example: The GPIO board
Inter-Integrated Circuit
Instructions
Example – a LN-HUB-32IO USB hub
Serial Peripheral Interface (SPI)
Instructions
Example – LN digital or SPI general
Example: LN Digital (the LNDI commands)
The step motor
Technical specifications
Example – the step motor
Real-time clock
Technical specifications
Example – RTC
The ultrasonic sensor
Technical specifications
Example – the ultrasonic sensor
The humidity and temperature sensor
Technical specifications
Example – the DHT sensor
The sound detect sensor
Technical specifications
Example – the sound detect sensor
The AD/DA converter
Technical specifications
Example – the AD/DA convertor
Photoresistor
Technical specifications
Example – a photoresistor
The touch sensor
Technical specifications
Example – the touch sensor
The tilt sensor
Technical specifications
Example – the tilt sensor
The LCD1602 display
Technical specifications
Example – the LCD1602 display
Building the LeScratch smart house
Summary
Index

Banana Pro Blueprints

Banana Pro Blueprints

Copyright © 2015 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

First published: December 2015

Production reference: 1211215

Published by Packt Publishing Ltd.

Livery Place

35 Livery Street

Birmingham B3 2PB, UK.

ISBN 978-1-78355-238-2

www.packtpub.com

Credits

Authors

Ruediger Follmann

Tony Zhang

Reviewers

Lalith Gallage

Nikolaos Margaris

Paul Mundt

Rob Seder

Commissioning Editor

Edward Bowkett

Acquisition Editor

Meeta Rajani

Content Development Editor

Anish Sukumaran

Technical Editor

Chinmay S. Puranik

Copy Editor

Sonia Michelle Cheema

Project Coordinator

Izzat Contractor

Proofreader

Safis Editing

Indexer

Hemangini Bari

Graphics

Disha Haria

Production Coordinator

Conidon Miranda

Cover Work

Conidon Miranda

About the Authors

Ruediger Follmann was born in 1968 in Germany. He studied electrical engineering at RWTH Aachen, Germany, and received his PhD from the University of Duisburg-Essen, Germany. He has worked for IMST GmbH, Germany, for more than 20 years, where he heads the RF circuits and system integration department. IMST is a design and development company with more than 170 employees. He uses embedded boards in many different projects, for example, in order to control MMICs or hybrid electronics. Follmann is the author of many technical articles as well as Das Raspberry Pi Kompendium, Springer.

Tony Zhang was born in 1990 in China. He studied control science and engineering at HIT, China, and received his master's degree in 2015. Since 2014, Tony has been working with LeMaker community, where he is the cofounder and is heading the R&D department.

About the Reviewers

Lalith Gallage is a charted IT professional with more than 12 years of experience in information communication technology, including embedded control designing, industrial automation, and CMS (SharePoint Server, Joomla, sensenet, Umbraco, and Odoo) customization. He has published several articles on the CodeProject website (http://www.codeproject.com/) and enjoys writing in his free time.

He is currently working at Sri Lanka Telecom and is a guest lecturer at many leading institutes in Sri Lanka in the fields of microcontroller and C# programming. In his free time, he likes to relax in his aquaponic garden.

He has expertise in several known languages, such as C++, C#, Python, PLSQL, PHP, and ASP.NET. He is also proficient in certain hardware platforms such as Arduino, Raspberry Pi, Banana Pi, Rabbit, and PIC.

His professional qualifications include a masters degree in IT from Cardiff Metropolitan University, UK, BIT from the University of Colombo, Sri Lanka, national diploma in engineering sciences (electronics and telecommunication) from Sri Lanka, and CITP from the UK.

Nikolaos Margaris currently works as a senior frontend developer on a collaboration and communication software that uses AngularJS and NodeJS. He enjoys clean and performant JavaScript code and tests it too. In his spare time, he likes reading about new technologies and wandering through the IoT world. Good music and some retro PC/console games have always added flavor to his life. Reviewing this book was an enjoyable experience for him, and he hopes to come across more opportunities like this one. You can find out more about him at http://www.nikolaosmargaris.gr/.

All thanks to my soul mate, Vaya. Her love and patience gives meaning to my life.

Paul Mundt is the founder and managing director of Adaptant Solutions AG, a software and solutions company focused on providing adaptable technologies and solutions needed to enable cross-sectorial data utilization and exploration in an evolving data regulation and compliance landscape.

Previously, Paul was the CTO of OS & Virtualization, and director of the system software department at Huawei's European Research Center, leading an R&D department responsible for the future OS and virtualization strategy and architecture, focusing on the areas of heterogeneous systems, convergence of Cloud and HPC, and the future data center architectures.

Earlier, at Renesas, he was responsible for establishing both the initial open source strategy and vision, while leading the organization to consistently become one among the top 10 contributors to the Linux kernel, resulting in wide-reaching system software and IP consolidation across a diverse MPU/MCU product portfolio.

He has more than 15 years of experience in both Linux kernel development and technology management across a diverse range of domains (HPC, embedded, enterprise, and carrier grade). He has also previously worked for Nokia, TimeSys, and MontaVista in various technical and leadership positions.

Rob Seder has been involved in information technology for over 20 years. He has been a technophile and geek from an early age. His day job primarily involves working on Microsoft .NET technologies, but he also invests heavily in Linux, Mac, IoT, automation, 3D printing, and other interesting infrastructures or development technologies. Rob has mostly worked in financial and insurance industries over the years, and he enjoys keeping himself up to date with the most current technologies that are available.

You can find Rob's blog at http://blog.robseder.com or contact him at @RobSeder on Twitter.

www.PacktPub.com

Support files, eBooks, discount offers, and more

For support files and downloads related to your book, please visit www.PacktPub.com.

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.

Why subscribe?

Fully searchable across every book published by PacktCopy and paste, print, and bookmark contentOn demand and accessible via a web browser

Free access for Packt account holders

If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.

Preface

The book mainly focuses on some popular applications and projects using Banana Pro. It first introduces the basic usage of Banana Pro, including its hardware and software, and then some applications, such as a multimedia center and laser engraver. The sole purpose of this book will be to show what you can do with Banana Pro through a number of projects, ranging from home automation projects, cameras around the house, and robotics.

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 in-depth examples.

What this book covers

Chapter 1, Introduction to Banana Pro, introduces the Banana Pro single board computer. It explains all its available interfaces as well as the installation of the Linux OS, which will be used in this book.

Chapter 2, Programming Languages, explains several programming languages, such as Python, C/C++, and Scratch. In several examples, the usage of these programming languages is shown through a step-by-step approach.

Chapter 3, Wireless Projects, introduces wireless projects. It shows how Banana Pro can be used as a wireless hotspot or print server. Additionally, the serving of web pages is explained in combination with content management systems. Finally, a measurement server is set up in order to control an electronic circuit.

Chapter 4, AnArcade Cabinet, describes how to turn Banana Pro into an arcade cabinet. A step-by-step approach shows you how to install and configure different game emulations. This chapter also describes the steps required to set up a cabinet house with the help of a joystick and an LCD display for Banana Pro.

Chapter 5, A Multimedia Center, introduces the usage of Banana Pro as a multimedia center. You will be shown how a DVB receiver is set up through a series of steps. This receiver allows the recording of TV transmissions, watching DVDs, and listening to audio CDs.

Chapter 6, Remote Controlling a Smart Monitor Car, teaches you how to make a small mobile car with the remote monitor function. It describes how to realize the IP camera function on Banana Pro. It also shows you how to set up a small mobile car. Finally, you will see how a web page can be used to control the car and view the video of the camera in the car.

Chapter 7, A Laser Engraver, shows the laser engraver made by Banana Pro along with a laser CPU. You will learn how to design the frame of the laser engraver and use different kinds of software on the Banana Pro. The laser CPU and PC can be used together to engrave patterns on some special types of material such as cardboard.

Chapter 8, Scratch—Building a Smart House, describes how to use Scratch and some other GPIO libraries together to control different sensors. Then, you will learn how to combine all the sensors together in a virtual small house to simulate the smart house.

What you need for this book

You would need Banana Pro, an SD card (a minimum of 4 GB is recommended), an AC plug, a hard disk drive, and a USB DVB receiver (optional).

Who this book is for

This book is for all embedded board enthusiasts who want to use their credit-card-sized computer boards for extraordinary projects. An example of LeMaker's Banana Pro computer as a home entertainment center or a arcade cabinet is described in a step-by-step approach. Get the most out of your embedded board using it in your daily lives or for challenging projects. This book is the perfect guide for these purposes.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail <[email protected]>, and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from: http://www.packtpub.com/sites/default/files/downloads/BananaPiBlueprints_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the ErrataSubmissionForm link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at <[email protected]> with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at <[email protected]>, and we will do our best to address the problem.

Chapter 1. Introduction to Banana Pro

Embedded boards are part of our lives. We use them daily, and sometimes even without recognizing or knowing about them. They are included in mobile phones, washing machines, or implemented in our televisions. These little computers work in the background and consume very little power.

This chapter introduces Banana Pro. Banana Pro is an updated version of Banana Pi that's been designed by the LeMaker team (http://www.lemaker.org) from China. LeMaker is a charitable organization and aims to provide educational services by selling its Banana boards and building a community around this technology, similar to what the Raspberry Pi foundation in the UK has done.

Banana Pro is the current flagship of LeMaker. It is compatible with many Linux-based operating systems including Android. In this chapter, Banana Pro is introduced to you along with its connection possibilities. The most popular operating systems in the market today are explained here and the principal installation as well as the boot process is described.

There are already many add-ons available for Banana Pro, such as LCD modules in various sizes, a camera module, or modules that connect to GPIO pins. Sections of this chapter deal with the detailed installation of an LCD module, describing the step-by-step installation and operation of a camera module and provide background information on additional add-ons.

In particular, this chapter includes the following sections:

Banana ProGetting startedOperating systemsAdd-ons

Banana Pro

Since Raspberry Pi was born, a lot of new embedded boards have seen the light of day. A very popular one is Banana Pro. It came into the market in late 2014, is affordable ($45 USD), and offers many interfaces (Figure 1).

Banana Pro is the size of a credit card (92 mm x 60 mm and 48 g) and uses an Allwinner A20 system on chip. This includes a dual core CPU (ARM Cortex-A7, 1 GHz), a Mali 400 MP2 GPU, and a 1 GB SDRAM. Additionally, there is also a AP6181 Wi-Fi module onboard. Banana Pro makes use of the AXP209 Power Management Unit (PMU), which is very power efficient and allows power monitoring.

Figure 1: Banana Pro is a dual core computer featuring many connectors (source: http://en.wikipedia.org/wiki/Banana_Pro).

Specifications of Banana Pro

Table 1 summarizes the Banana Pro specifications. Everything is available to build a complete computer system, including a hard disk or connection to a television or computer screen. Both the Gb LAN and WLAN guarantee easy integration into networks and fast operation, for example, as NAS. USB sockets allow the usage of a keyboard, mouse, or even DVB receivers (refer to Chapter 4, An Arcade Cabinet). The 40-pin General Purpose Input Output (GPIO) header allows arbitrary experiments that feature different bus systems, such as CAN (Controller Area Network) or SPI (Serial Peripheral Interface). Different LEDs provide board statuses; CSI (Camera Serial Interface) and LVDS (Low Voltage Differential Signaling) interfaces are also available. The CSI interface can be used in order to connect a camera and LVDS interface that can be used for display connection purposes. Even an onboard microphone is implemented. The following are the Banana Pro specifications:

Components

Specification

System on chip

Allwinner A20, SATA 2, two USBs, and one Micro-USB

CPU

1 GHz Cortex-A7 dual-core

GPU

Mali 400 MP2, OpenGL 2.0/1.1 (hardware accelerated)

Memory

1 GB DDR3 SDRAM

Power

5V/2A using Micro-USB (DC and/or USB OTG)

PMU

AXP209

USB

Two USBs of the 2.0 version and one USB 2.0 OTG

Low level connectors

A 40-pin GPIO header, including UART, I2C, SPI, PWM, CAN, I2S, and SPDIF

Storage

A Micro-SD card, SATA 2.0, and a 2.5 inch hard disk power supply onboard

Network

10/100/1000 Ethernet RJ 45 and 150 Mbps Wi-Fi 802.11 b/g/n

Display

HDMI-A 1.4, a composite video (PAL and NTSC) (via 3.5 mm TRRS jack shared with an audio output), and LVDS/RGB/CPU display interface (DSI) for raw LCD panels. 11 HDMI resolutions from 640×480 to 1920×1080 plus various PAL and NTSC standards

Video

An HD H.264 2160p video decoding. A multiformat FHD video decoding, including Mpeg1/2, Mpeg4, H.263, H.264, and so on. An H.264 high-profile 1080p@30fps or 720p@60fps encoding

Camera

An 8-bit parallel camera interface

Audio outputs

HDMI, analog audio (via a 3.5 mm TRRS jack that's shared with composite video out), I2S audio (also potentially for audio input), and an electrical SPDIF audio output

Audio input

An onboard microphone

Buttons

A reset button, power button, and a U-boot button

LEDs

A power status LED (red), Ethernet status LED (blue), and a user-defined LED (green)

Other

An onboard IR receiver

Dimensions

92 mm x 60 mm and 48 gm

Table 1: Banana Pro specifications

Contrary to many other embedded boards, Banana Pro offers a SATA connector for the direct connection to a 2.5 inch hard disk connection. Moreover, for SSDs or a 2.5 inch hard disk, a power connector is onboard.

Tip

Note the correct polarity of the SATA/DC power connector. Compared to CubieBoard or Cubietruck, Banana Pro uses the concept of changed polarity. Therefore, when ordering a Banana Pro SATA/DC cable, be sure of the DC polarity (Figure 2).

Figure 2: The Banana Pro SATA/DC cable (source: Amazon.com)

All the connectors of Banana Pro are explained in Figure 3. These are as follows:

Debug TTL UART: This interface can be used in order to connect to a serial console PC/laptop via a serial USB cable for debugging purposes.Display interface: Use this connector to connect to an LCD. LeMaker offers three different sizes of LCDs that are up to 7 inches in size.HDMI: Using an HDMI (type A) or an HDMI (type A) cable (HDMI 1.4), this socket allows the connection to a monitor or television. In addition to this, digital audio can be transferred through this connector.SATA 2.0 interface and SATA/DC 5V: Banana Pro has a SATA 2.0 connector onboard. Furthermore, the DC for SSDs or 2.5 inch hard disks can be directly supplied (Figure 2).The micro USB power: Connect your 5V micro USB power supply to this connector in order to boot Banana Pro. While the 1.2A power supply may be sufficient to boot the board without a hard disk, I recommend at least a 2A power supply when the hard disk is connected to the board. Also, keep in mind that a 7 inch LCD connected to the board will consume an additional 750mA.

Figure 3: Connectors of Banana Pro

USB OTG: This allows for switching between a host and target mode. When in host mode, power will be drawn from Banana Pro to a drive or USB device that's connected. Many OTG implementations are currently limited and do not enable the powering of all devices.

Figure 4: The USB OTG to USB adapter (source: Amazon.com)

Tip

Using an adapter cable (Figure 4), USB devices can be connected to this port.

Reset button: Pushing this button will reboot Banana Pro. Note that pushing this button during an operation may result in data corruption. It is recommended that you always shut down Banana Pro using the sudo halt –p command when using Linux.Camera interface: This connector allows the usage of the LeMaker camera.Power button: This button will boot Banana Pro after shutdown.40-pin GPIO header: This header provides different signals, such as SPI, CAN, I2S, I2C, UART, or SPDIF.Microphone: The microphone can be used for recordings (mono).AV output: This connector combines analog videos and analog audio in a so-called TRRS jack (Figure 5):

Figure 5: The TRRS connector for Banana Pro. Pin 1 is audio left, pin 2 is audio right, pin 3 is video out and pin 4 is ground.

Tip

There are adapter cables available that separate audio and videos (Figure 6):

Figure 6: The TRRS splitter for audio and videos

IR Receiver: Banana Pro features an onboard IR receiver that receives remote control signals.2 x USB: Connect your USB devices here.Ethernet interface: Banana Pro provides a 1 Gb Ethernet interfaces that offers a true GB speed.The microSD card slot: Banana Pro boots from a microSD card since a direct boot from a hard disk is not possible. However, a root filesystem can be directed to the hard disk once it's booted from the microSD card.FEL button: FEL is a low-level subroutine that's contained in the BootROM on Allwinner devices. It is used for the initial programming and recovery of devices using a USB.

In addition to the preceding connectors, Banana Pro offers a WLAN module that can also work as an access point. Banana Pro does not supply a real-time clock (RTC). However, there are RTC add-on boards available at http://www.wvshare.com/product/PCF8563-RTC-Board.htm.

Figure 7: The RTC add-on board for Banana Pro. Source: http://www.wvshare.com.

Banana Pro onboard LEDs

Banana Pro features several LEDs onboard. The red LED lights up as soon as DC power is supplied to the board. The blue LED shows Ethernet activity. The green and blue LEDs can be set individually. Chapter 2, Programming Languages, will show you how these LEDs can be programmed.

Getting started

LeMaker offers several predefined images for download. These can be found at http://www.lemaker.org/product-bananapro-resource.html. Simply download the image file you want and copy it to a microSD card. The minimum required SD card size is 4 GB.

Tip

When using the Windows OS, WIN32 Disk Imager (http://sourceforge.net/projects/win32diskimager) can be used in order to transfer an image to an SD card. However, make sure that you select the correct drive for the Win32 Disk Imager. An incorrect drive may result in loss of data.

Figure 8: Win32 Disk Imager can be used in order to transfer Banana Pro image files to a microSD card (source: SourceForge.net)

Using Linux, image files can be transferred to a Micro SD card using the following command:

sudo dd bs=4M of=/dev/sdX if=/path/to/banana_pro.img

For uncompressed images, use the following command

gzip -dc /home/your_username/image.gz | sudo dd bs=4M of=/dev/sdX

For compressed images, replace /dev/sdX with your SD card. Note that the block size is set to 4M and will work most of the time. If it doesn't, try 1M, although this will take a considerably longer to complete.

There is one exception for Banana Pro using the Android operating system. Using Win32 Disk Imager or the dd command of Linux will not work here. Special software called PhoenixCard will be required. PhoenixCard for Windows can be downloaded from https://drive.google.com/file/d/0B_VynIqhAcB7NTg2UkRDdHRWX2s/edit. Before you do this, the SD card should be formatted by clicking on Format to Normal (Figure 9):

Figure 9: Copying Android to an SD card for Banana Pro by first formatting the SD card to normal

It is mandatory to select the Startup from the Write Mode. After formatting the card, click on the OK button in the Information window. In a second step, the Android image can be burned to the SD card (Figure 10). This step will take a few minutes to complete.

After writing any image to the microSD card, put the SD card into Banana Pro SD card slot and connect the DC power supply afterwards. This will boot your image. Currently, Banana Pro supports Android 4.4. Version 4.4 is available from this forum at http://www.bananapi.com/index.php/forum/adroid/117-android-4-4-for-banana-pi-beta-1-release-note.

Figure 10: Copying the Android OS to an SD card for Banana Pro by burning an image to an SD card

Set up your Banana Pro according to Figure 11 after you've copied the image to the SD card.

The first boot

Depending on the chosen image, the first boot will take 20 to 30 seconds. The first boot on Android will take much longer, so be patient.

Tip

Some Android versions may require two micro USB power connectors at the same time. One must be supplied to the micro USB DC before boot, and the other one to the micro USB OTG. During my experiments with Android 4.2, one power supply connection was sufficient.

Figure 11: Setting up Banana Pro before the first boot (source: http://www.lemaker.org/cn/product-bananapro-guide.html)

Available operating systems for Banana Pro

This section presents some of the available operating systems for Banana Pro. Here, Android has briefly described some of the most important Linux distributions:

Figure 12: A screenshot of operating systems available on the LeMaker web page

Tip

LeMaker offers image versions for both Banana Pi and Banana Pro. However, be sure to download the correct image.

Figure 13

Android

Although Android is based on Linux, both architectures are quite different. This can be seen even in the example of low-level C language routines, which Google exchanged for Android. In addition to this, Google prohibits all code that's licensed under GPL (GNU Public License). For this reason, Android only implements a rudimentary shell featuring only a few shell commands. Due to the C-library incompatibilities, normal Linux code, even if it's especially compiled for the ARM architecture, will not run under Android. Nevertheless, Android is a very popular operating system (OS) that's used by many phones and tablets. It fully supports graphic hardware in terms of accelerated video and 3D graphics. For this reason, the first Banana Pro version of Kodi (formerly known as XBMC and Xbox Media Centre) made use of an accelerated Android graphics library (refer to Chapter 4, An Arcade Cabinet).

Applications for Android can be developed using a special software development kit (SDK) and Java itself as most Android applications are based in Java. Although this book concentrates on Linux projects rather than Android projects, we will take a short look at Android on Banana Pro.

LeMaker provides three different Android images: one for a 5 inch TFT, the second for a 7 inch TFT, and the third using the HDMI cable as a video output. To install an Android OS, simply download the required version. You most probably want to start with the HDMI enabled version. Use PhoenixCard (as seen in the previous section) in order to write the image to an SD card. Insert this SD card and boot Android. After a while, the start screen of Android will be visible.

Figure 14: This is Android 4.4 running on Banana Pi/Pro (http://www.bananapi-kaufen.de/wp-content/uploads/2014/07/800px-Android_v2.jpg)

Android can be controlled by using a keyboard and mouse. Bluetooth and WLAN will work out of the box and some applications are already preinstalled.

Figure 15: Android 4.4 running on Banana Pro (source: bananapi.com)

Linux

There are a variety of Linux distributions available on the LeMaker download site (Figure 13). The most famous operating systems are Raspbian, Bananian, Lubuntu, and Gentoo. LeMedia