Вы находитесь на странице: 1из 49

Getting started with Android Development • Installing Pepper Flash

ODROID
Year One
Issue #8
Aug 2014

Magazine

INTRODUCING
THE ODROID-W
HARDKERNEL’S MICRO-SIZED PI-COMPATIBLE
BATTERY-POWERED WEARABLE COMPUTER!
MAKE YOUR
OS SPOTLIGHT: OWN ODROID
POCKET ROCKET AND
COUCH POTATO SMARTWATCH
THE ULTIMATE ANDROID
• THE NEXT-GENERATION ODROID-U3+
GAMING IMAGE WITH • STEP-BY-STEP BASICS OF LINUX KERNEL COMPILATION
1080P VIDEO PLAYBACK • INSTALL A WEB SERVER WITH NGINX AND LIGHTTPD
What we stand for.
We strive to symbolize the edge technology,
future, youth, humanity, and engineering.

Our philosophy is based on Developers.


And our efforts to keep close relationships with
developers around the world.

For that, you can always count on having the quality


and sophistication that is the hallmark of our products.

Simple, modern and distinctive.


So you can have the best to accomplish
everything you can dream of.

We are now shipping the ODROID U3


devices to EU countries! Come and visit
our online store to shop!

Address: Max-Pollin-Straße 1
85104 Pförring Germany

Telephone & Fax


phone : +49 (0) 8403 / 920-920
email : service@pollin.de

Our ODROID products can be found at:


http://www.pollin.de/shop/suchergebnis.html?S_
TEXT=odroid&log=internal
EDITORIAL
H
ardkernel had a busy month, and released several new
products that once again prove that they are the innovative
leaders in ARM micro-computing. Not only has Justin and
his team developed a new model for both the U and XU series, but
they have also created a tiny wearable Raspberry Pi-compatible
product that packs extra features.
The ODROID-VU is the USB touch-
screen that you’ve been waiting for!
A 9-inch model with 10-point multi-
touch input will be available in the middle
of August, and will not only work with the
ODROID family of computers, but is also
compatible with any Windows, Ubuntu and An-
droid machine that supports USB monitors.
The ODROID-W is a tiny version of the Raspberry Pi
that is intended for embedded, battery-powered applications such
as wearables and micro-controllers. It offers many new features not includ-
ed with the original Raspberry Pi, including removable USB ports, while remain-
ing very affordable.
And finally, the long-anticipated ODROID-XU3 is now available, and it is the
fastest ODROID ever made! It’s got everything the first-generation XU-E offers,
with some extra features:
• Samsung Exynos5422 Cortex™-A15 2.0Ghz quad core and
Cortex™-A7 quad core CPUs
• Mali-T628 MP6 GPU supporting OpenGL ES 3.0/2.0/1.1 and OpenCL
1.1 Full profile
• Built-in energy sensors like the XU-E

We’ll be reporting more about the ODROID-XU3 in the October issue, but you
can get your XU3 now at the Hardkernel Store at http://bit.ly/1prRcPL.
In Linux kernel news, forum user @dsd gives us a report on the newest 3.17
kernel, which appears to now have ODROID support! Follow the original thread
at http://bit.ly/1s5Ov7z:
“Samsung has been doing a load of work upstreaming ODROID support into of-
ficial Linux. The first patches will go into Linux-3.17, although a load more patch-
es are needed to make this usable as a desktop system - might take a few more
releases before all patches are polished and included.
They are also working on upstreaming ODROID support into uboot, and they
have a nice feature there, they have found a way to automatically detect X2 vs
U2/U3 (by checking for the extra LED on the X2). So now uboot will automatically
pick the right device tree to load. That means one appropriately crafted “OS im-
age” will work for X2, U2 and U3.”
This issue has lots of information for hardware enthusiasts, including an in-
depth look at the different types of eMMC modules that Hardkernel makes and a
hands-on look at the powerful ODROID-SHOW. We also feature a guide to com-
piling your own kernel directly from the Hardkernel GitHub repository, a tutorial
for installing the light-weight Nginx web server on an ODROID, Nanik begins his
fascinating series on Android Application Development, and more!

ODROID Magazine, published monthly at http://magazine.odroid.com/, is your source for all things ODROIDian.
Hard Kernel, Ltd. • 704 Anyang K-Center, Gwanyang, Dongan, Anyang, Gyeonggi, South Korea, 431-815
Makers of the ODROID family of quad-core development boards and the world’s first ARM big.LITTLE architecture
based single board computer.
Join the ODROID community with members from over 135 countries, at http://forum.odroid.com/, and explore the
new technologies offered by Hardkernel at http://www.hardkernel.com/.
STAFF

ODROID Magazine

Rob Roy, Bo Manuel


Chief Editor Lechnowsky, Adamuz,
Editor Spanish
I’m a computer Editor
programmer liv- I am President of
ing and working in Respectech, Inc., a I am 31 years old and
San Francisco, CA, de- technology consultancy live in Seville, Spain, and
signing and building web applica- in Ukiah, CA, USA that I founded in was born in Granada. I have recently
tions for local clients on my network 2001. From my background in elec- become a father, and my son is now 5
cluster of ODROIDs. My primary tronics and computer programming, I months old. It is an incredible experi-
languages are jQuery, Angular JS manage a team of technologists, plus ence! A few years ago I worked as a
and HTML5/CSS3. I also develop develop custom solutions for compa- computer technician and programmer,
pre-built operating systems, custom nies ranging from small businesses to but my current job is related to quality
kernels and optimized applications worldwide corporations. ODROIDs are management and information technol-
for the ODROID platform based one of the weapons in my arsenal for ogy: ISO 9001, ISO 27001, and ISO
on Hardkernel’s official releases, for tackling these projects. My favorite de- 20000. I am passionate about comput-
which I have won several Monthly velopment languages are Rebol and Red, er science, especially micro computers
Forum Awards. I use my ODROIDs both of which run fabulously on ARM- such as the ODROID, Raspberry Pi,
for a variety of purposes, including based systems like the ODROID-U3. etc. My other great hobby is mountain
media center, web server, applica- Regarding hobbies, if you need some, biking, and I occasionally participate in
tion development, workstation, and I’d be happy to give you some of mine semi-professional competitions.
gaming console. You can check out as I have too many. That would help
my 100GB collection of ODROID me to have more time to spend with my
software, prebuilt kernels and OS wonderful wife of 23 years and my four
images at http://bit.ly/1fsaXQs. beautiful children.

Nicole Scott, Bruno Doiche,


Art Editor Art Editor

I am currently a Is enjoying his time


Digital Strategist off on vacation for
and Transmedia the month of August.
Producer who specializ-
es in online optimization and inbound
marketing strategies, social media di-
recting and team coordination, as well
as media production for print, TV,
film, and web. I also have experience
in graphic and website design, social
networking management and advertis-
ing, video editing and DVD authoring.
I own an ODROID-U3 which I use to
run a sandbox web server, live in the
California Bay Area, and enjoy hiking,
camping and playing music. Check
out my web page at http://www.ni-
colecscott.com.
ANDROID DEVELOPMENT - 6
INDEX
MOUNT YOUR INTERNAL SD CARD - 9

INTRODUCING THE ODROID-W - 10

SEARCH WITH GOOGLE BBS / FIXING ANDROID OVERSCAN - 14

ALL ABOUT HARDKERNEL’S EMMC MODULES - 15

LINUX KERNEL COMPILATION - 17

YOUTUBE PLAYER ALTERNATIVE - 21

INTERESTING LINUX COMMANDS PART 1 - 22

ODROID U3 VS ODROID U3+ - 23

INSTALL A HOME WEB SERVER - 25

INTERESTING LINUX COMMANDS PART 2 - 25

ODROID-VU AFFORDABLE 9” USB HDMI TOUCH SCREEN - 30

PEPPERFLASH CHROME PLUGIN FOR LUBUNTU 14.04 - 32

ANDROID GAMING: MUPEN64PLUS - 33

IO SHIELD DEMYSTIFIED - 34

DIGGING (INTO) THE ODROID-SHOW - 36

OS SPOTLIGHT: POCKET ROCKET AND COUCH POTATO - 41

MEET AN ODROIDIAN: BO LECHNOWSKY - 47


ANDROID DEVELOPMENT

ANDROID DEVELOPMENT:
USING THE LINUX KERNEL
A GUIDE TO THE
ANDROID-SPECIFIC
DRIVERS
by Nanik Tolaram

L
inux is the heart of Android, and
it depends heavily on it for its op-
eration, and without it Android
would not be able to run. However,
Android does not use a “plain vanilla”
Linux kernel, which means you cannot
download a kernel from www.kernel.org CONFIG_ANDROID=y
and immediately use it to run Android. CONFIG_ANDROID_BINDER_IPC=y
There are a number of drivers, code and CONFIG_ANDROID_LOGGER=y
configuration options to be added in or- CONFIG_ANDROID_RAM_CONSOLE=y
der for Android to work properly, and CONFIG_ANDROID_RAM_CONSOLE_EN-
this article will walk through those spe- ABLE_VERBOSE=y
cific drivers and configuration, as well CONFIG_ANDROID_RAM_CONSOLE_ER-
as discuss the drivers that are needed ROR_CORRECTION=y
to ‘Android’-ify the Linux kernel upon CONFIG_ANDROID_RAM_CONSOLE_ER-
which the Android framework depends. ROR_CORRECTION_DATA_SIZE=128
Most of the driver code that needs to be CONFIG_ANDROID_RAM_CONSOLE_ER-
added is located inside the kernel/driv- ROR_CORRECTION_ECC_SIZE=16
ers/staging/android folder as can be CONFIG_ANDROID_RAM_CONSOLE_ER-
seen in Figure 1. ROR_CORRECTION_SYMBOL_SIZE=8
Figure 1 – Driver list inside the /staging/
There are also a number of drivers CONFIG_ANDROID_RAM_CONSOLE_ERROR_ android directory
that are located outside the base direc- CORRECTION_POLYNOMIAL=0x11d
tory /staging/android that are already CONFIG_ANDROID_TIMED_OUTPUT=y
in the Linux Kernel mainline. This ar- CONFIG_ANDROID_TIMED_GPIO=y
binder.c
ticle is by no means an exhaustive list for CONFIG_ANDROID_LOW_MEMORY_
all of the drivers needed, but is a good KILLER=y
The binder driver is the main back-
starting point to get a better understand- CONFIG_ASHMEM=y
bone driver for applications in Android,
ing of the different drivers needed for and is the gatekeeper of communication
Android. If you look inside the Makefile, which between different processes that are run-
Below are the configuration options is located inside the drivers/staging/ ning, written in native (C/C++) or Java.
that need to be included as part of the android directory, you will see the ker-
Without this driver, Android applica-
kernel zImage. The following configura- nel drivers that are specific to Android. tions will not work at all, since it mounts
tion is taken from the file odroidu_an- In the following sections we are going to the essential /dev/binder virtual filesys-
droid_defconfig inside the kernel/ take a closer look at the different driv- tem. Android uses the binder driver
arch/arm/configs folder, as shown in ers inside this directory, starting with the extensively, and because applications
the following table. binder driver. utilize this framework, any application is
indirectly reliant on the binder driver.
ODROID MAGAZINE 6
ANDROID DEVELOPMENT

early suspend drivers work together as


one unit to manage power resources
in an Android device. The sample
screenshot shows the content of the
wakelock virtual filesystem inside the
Nexus 7.
Example odroidu_android_defconfig configuration
ram_console.c
ashmem.c quest certain services that use always-on
Location: /kernel/mm/ hardware so that they still operate when The RAM console drive can be la-
the device goes to sleep in order to con- belled as a Linux log helper driver. Its
The name ashmem stands for An- serve battery power. function is to save the content of the
droid Shared Memory, and as the name The wakelock driver is built on top of
implies, is a driver that facilitates mem- Linux power management driver. Linux
ory sharing between processes , nd pro- provides power management functions
vides a mechanism for Linux to reclaim such as suspend and resume, where it al-
memory if it finds itself under memory lows the device to be ‘suspended’ by run-
pressure. Ashmem makes the /dev/ash- ning on a low power mode, or ‘resumed’
mem directory available for applications by coming back from sleep. The wake-
to access its functionality. lock driver is a communication mecha-
The driver works using a file descrip- nism allowing user space applications
tor which can be shared by processes by and system tasks to determine whether Ashmem pinning and unpinning
utilizing the binder driver that was dis- the device is allowed to go to suspend flowchart
cussed previously. The unique character- mode. The driver will not suspend the
istic of ashmem is that when the process device if there are active wakelocks in the Linux log to a different memory loca-
dies, the memory goes with it, so there system. tion before the device reboots. The
will not be any orphaned memory. It is Imagine if you are running a music content of the Linux log (which nor-
also smart enough to allow applications player on your mobile phone and the mally is accessed using dmesg) can be
to specify which memory area can be re- system decided that it’s time to suspend, viewed after reboot in the /proc/last_
claimed or not, which is known as un- your music player stopped playing. Or, kmsg virtual file system. If the device
pinning and pinning. imagine if the system is about to suspend shuts down completely with no power
In order to save memory space, the and there is an incoming phone call, but supplied to it, the last Linux log will
unpinned pages are periodically re- you can’t receive it since the system is not be stored the next time you startup
claimed by using the LRU algorithm. in the process of suspending. Wakel- the device. This is because the device
Ashmem has its own shrinker that is ock makes it possible to avoid the above is completely shut down and there is
called when available memory gets low. described scenarios, allowing you to use no power to retain the content of the
The normal use case on using ashmem is your device without having to worry memory. As long as there is power sup-
shown in the float chart in Figure 3, to when it will go to suspend mode. The plied to the device, the next time you
the bottom-right. wakelock driver introduced a new virtual restart, you will be able to extract the
filesystem called /proc/wakelocks. last Linux log through the last_kmsg
wakelock.c Power management, wakelock and virtual filesystem. This driver is very
Location: /kernel/power
Figure 3 – Ashmem regions
This is the a controversial driver that
started the heated discussion between the
Android kernel team and Linux kernel
developers back in the days when Google
had just starting committing its code for
the mainline kernel, and was considered
by purists to be a hack. This driver gives
userspace applications the ability to re-

ODROID MAGAZINE 7
ANDROID DEVELOPMENT

hit, which means that only when the


memory falls to the lowest free mem-
ory available than the application will
be killed. The following table lists the
different value that the framework will
use to assign to launched process:

HIDDEN_APP_MAX_ADJ
HIDDEN_APP_MIN_ADJ
SERVICE_B_ADJ
PREVIOUS_APP_ADJ
HOME_APP_ADJ
SERVICE_ADJ
BACKUP_APP_ADJ
HEAVY_WEIGHT_APP_ADJ
The wakelocks drivers area considered a Google hack by purists PERCEPTIBLE_APP_ADJ
VISIBLE_APP_ADJ
FOREGROUND_APP_ADJ
useful for troubleshooting issues such into different categories: main, events, PERSISTENT_PROC_ADJ
as kernel panic, out of memory or any radio and system. The following vir- SYSTEM_ADJ
other kind of problem that causes a tual filesystem are made available from MIN_HIDDEN_APPS
kernel panic. the driver:
Internally, the driver only accomo-
earlysuspend.c /dev/log/system dates a maximum of 6 different values,
Location: /kernel/power /dev/log/radio so the framework does an internal con-
/dev/log/events version to fit it to the available slots.
You can see this driver in action /dev/log/main The different values can be found in
when you leave your device inactive the /sys/module/lowmemorykiller/pa-
for few minutes and the screen turns Android provides a log viewer ap- rameters/adj virtual filesystem.
off by itself. It’s responsible for mak- plication called logcat that allows The settings of free available mem-
ing sure all the necessary components us to view the log in a more hu- ory threshold are linked in a 1:1 ratio
inside your device are ‘suspended’ man readable format. The screen- with the adj value, and it is stored in
to conserve energy. This driver and shot shows a sample of the content the /sys/module/lowmemorykiller/pa-
wakelock go hand-in-hand. It relies of the /dev/log/radio in its raw rameters/minfree virtual filesystem.
on Linux’s power management driver, form, which is not very easy to read The minfree value is in pages of 4k.
and can be triggered by sending state For example, if it says the free memory
information to the following /sys/ lowmemorykiller.c is 8192, it means (8192 * 4k) = 32768
power/state filesystem. which converts to 32KB (32768 /
If you have root access to your de- This driver takes care of killing pro- 1024).
vice, you can trigger the early suspend cesses from memory when the amount The way in which the minfree
by executing the following command: of free memory hits a certain threshold. threshold is mapped with the value
Every time an application is launched, from adj is explained in this chart:
echo mem > /sys/power/state it is assigned a value to indicate what
kind of application it is. This ‘marker’ Minfree threshold mapped with adj value
will indicate to the driver whether this
logger.c process can be killed. adj minfree
As an example, looks at the phone 0 8192
The logger driver is the central log- application that you use to receive and 1 10240
ging driver used by Android system, make calls. The application will be 2 12288
which is also made available to user ap- ‘marked’ to a value that indicates to 4 14336
9 16384
plications via the built-in logger API. the driver to kill the application only 15 20480
Internally, the driver splits the logging when the last low memory threshold is
ODROID MAGAZINE 8
ANDROID DEVELOPMENT TIPS AND TRICKS

MOUNT YOUR
INTERNAL SD
CARD
WHEN BOOTING FROM
EMMC IN LINUX
by @gripped and Rob Roy

W
hen booting from an eMMC
module, the SD card slot
can be used for extra storage
instead of a USB drive. To begin, insert
a EXT4-formatted SD card, then turn
on the ODROID and boot up your fa-
vorite Linux distro. Note that since the
SD slot is not hot-pluggable, the card
needs to be inserted before the system
is booted. Type the following into the
Terminal window in order to determine
the device name for the SD card:
$ sudo fdisk -l
Snapshot of the output of typing cat /dev/log/radio in Terminal Device Boot Start ...
/dev/mmcblk0p1 8192 ...
What the mapping means is that if timed GPIO drivers registration as /dev/mmcblk1p1 8192 ...

the free memory threshold is less than they happen. The timed_gpio is one of
On an X2 or U3, the /dev/
20480 (20480 x 4k = 80k), the driver the drivers that register itself to timed_
mmcblk0 device is the SD card, and
will start killing processes which have output, and the other is the vibration
/dev/mmcblk1 is the eMMC module,
value of 15 and above. The same thing driver. As you may have guessed, the but on an XU they are reversed. To
happens when the free memory avail- vibration component is responsible for mount the SD card, substitute your
able is less than 8192 (8192 x 4k = making your phone vibrate. username and device name in the fol-
32k). In that case, any process that has lowing sample script:
value larger than 0 will be killed. alarm-dev.c
Location: /kernel/drivers/rtc $ cd ~
$ mkdir sdcard
timed_gpio.c / $ sudo mount /dev/mmcblk0p1 \
timed_output.c The alarm driver relies on high res- /home/USERNAME/sdcard
$ sudo chown USERNAME:USERNAME
olution timer infrastructure provided
These combo drivers are use for in Linux. The driver has got its own Now you can store your data in
driving a particular GPIO hardware virtual filesystem, /dev/alarm, that is /home/USERNAME/sdcard and it
pins for a certain period of time, and is used by the user application to com- will reside on the SD card instead.
made available to give code running in municate with the driver. This technique can be used to mount
userspace access to the GPIO pins. In This driver is tied to the wakelock the SD card at any location, including
order to use this driver, you must know functionality, allowing the alarm to /var/www for a web server.
which pin you want to drive, high or continue working even when the de- To automatically mount the SD
low signal, and for how long. In de- vice is in sleep mode, which is the sole card at boot, add a line to /etc/fstab by
vices that have this driver enabled, it reason why the alarm driver exists. It substituting the device and username:
exposes the /sys/bus/platform/driv- provides the alarm management that is # should be on a single line
ers/timed-gpio virtual filesystem. used in our user applications or frame- /dev/mmcblk0p1
/home/USERNAME/sdcard
The timed_gpio depends on anoth- work, in order to support key services. ext4
er driver called timed_output, where Next month, we’ll take a look in- defaults,noatime,nobootwait
0 2
its main function is to keep track of side the Android APK file.

ODROID MAGAZINE 9
ODROID -W

INTRODUCING THE
ODROID-W
A MINIATURE RASPBERRY PI-COMPATIBLE
WEARABLE COMPUTER
by Justin Lee

T
he ODROID-W is a min-
iature wearable comput-
ing module which is ful-
ly compatible with all software • DC/DC step-up converter An early revision of the ODROID-W, which
available for the Raspberry Pi (RPi). for 5Volt rails (USB host and was nicknamed the ODROID-Pi
HDMI) from a Li-Polymer bat-
The W stands for: tery

Wearable device development • USB Host port can be placed on


top or bottom as preferred
Widely applicable Internet of Things
(IoT) development • DIY friendly 100mil/2.54mm
pitch GPIO ports (up to 32
Workable DIY electronics prototyp- ports) for handy prototyping
ing
The ODROID-W = RPI + RTC + ADC
+ UPS + Battery Gauge with significant
The ODROID-W measures a very minimalism.
small 60 x 36 x 7mm (2.4 x 1.4 x 0.3”).
It also includes many new features and
improvements over the original Pi:
Development History

• Li-polymer rechargeable battery In early 2014, we had an important


charger and fuel gauge circuit project with our partner companies to
for wearable and robotics ap- help them with prototyping a few wear-
plications able & Internet of Things (IoT) devices.
The ODROID-W adds extra features to
We first considered using the
a fully compatible Raspberry Pi clone
• Real Time Clock (RTC) to ODROID-U3 as a base platform. Al-
keep accurate time without an though the ODROID-U3 is 8~12 times cessory possible, we decided to make
Internet connection by adding a faster than the Raspberry Pi, the power our own (tiny) version of a Raspberry
coin battery consumption of the U3 isn’t suitable for Pi, which allows full use of many widely
wearable devices like watches or necklac- available Pi peripherals such the Pi Cam-
• 12-bit precision ADC to mea-
es. We even considered using the Rasp- era module connector and 26-pin GPIO
sure the dynamic voltage signals
berry Pi itself due to the lower power re- port. The HDMI port and SD slot were
via two single-ended inputs
quirements and nice Linux BSP support, changed to micro-sized connectors, and
• DC/DC step-down converters but the PCB of the RPi was huge (much the MIPI DSI port was removed due to
for higher power efficiency bigger than the ODROID-U3). limited PCB space. In addition to its
To create the smallest wearable ac- smaller size, the ODROID-W maintains

ODROID MAGAZINE 10
ODROID - W

This prototype of a U3 smartwatch


required too much power. Side-by-side size difference comparison between the Raspberry
Pi and the ODROID-W without the USB attachment

Processor: Broadcom BCM2835


ARM11 700Mhz

Memory: Samsung 4Gbit (512MB)


LPDDR2 SDRAM

The Raspberry Pi smartwatch was far PMIC: Ricoh RC5T619 includes


too big to be viable. DCDCs, LDOs, ADCs, RTC, Battery
charger and Fuel gauge Top view of Rev. 1 ODROID-W board
full compatibility with all existing Rasp-
berry Pi software and peripherals. DCDC: TI TPS61259 is 5V step-up
The first sample ODROID-W PCB DCDC for USB host and HDMI
was designed on April 14, 2014, and had block
a few jumper wires. The second run was
designed on May 19, 2014, which cor- Video output: HDMI type-D
rected some of the electronics designs (Micro-HDMI)
and added an eMMC module socket for
test purposes, even though the eMMC is USB: High-speed USB 2.0 host
not much faster than SD card due to the
GPIO connectors: Rasperry Pi-com- Bottom view of Rev. 1 ODROID-W board
slow eMMC host speed in the SoC. In
patible 13x2-pin header on the top
testing the eMMC speeds, we discovered side as well as bottom side for 2-way
only ~10% improvement. The third stacking 20+6 pin header for addition-
sample (rev 0.3) was thoroughly tested, al GPIO/RTC/USB connection.
and is ready for mass production.
The unit price for the ODROID-W GPIOs: A total of 32 GPIOs and 2
is US $30 and it will be available for ADCs are available.
purchase from the Hardkernel Store at
http://www.hardkernel.com. Camera connector: 15pin MIPI-CSI2

Memory card slot: Micro-SD (T- Top view of Rev. 2 ODROID-W board
We didn’t follow the instructions care-
Flash)
fully enough and got this instead.
Power: Micro-USB socket for 5V
input. Li-Polymer battery connector
(Molex 53398-0271)

RTC Power: Backup battery connec-


tor (Molex 53398-0271)

Overall PCB Dimensions:


60 x 36 mm Bottom view of Rev. 2 ODROID-W board

ODROID MAGAZINE 11
ODROID -W

Closeup detail of ODROID-W with Docking Board and LCD

The Docking Board accessory,


which attaches to the ODROID-W
on either the top or bottom, offers
4 USB host ports and an Ethernet
port. You can also choose a 320x240
QVGA TFT LCD-included ver-
sion.
Please watch our Youtube vid-
eo of the ODROID-W Docking
Board at http://bit.ly/1rII5Li for
a live demonstration of the board’s
capabilities. The base price for the
Docking Board is $20, and the TFT
LCD-included version is $30. The schematic diagram for the ODROID-W PCB
The PCB schematic for the
ODROID-W is shown to the right
for reference.

DIY Smartwatch
Example

This DIY smartwatch has some


limited but very cool features, and is
intended to be tightly coupled with
your Android smartphone via Blu-
etooth.
Whenever a message arrives on
your phone, a notification is sent
to the watch, as seen in our video at Hardware materials for assembling the Odroid-W smartwatch
http://bit.ly/1sOkTOC.

The following page illustrates how to assemble your very own fashionable smartwatch from an ODROID-W!
For detailed schematics and software links, please refer to the original post at http://bit.ly/1rYW8LR.

ODROID MAGAZINE 12
ODROID - W

Smartwatch Assembly

Solder a disassembled USB Bluetooth module and a few buttons. Place double-sided tape on the LCD and on the ODROID-W PCB.

Stack the battery and LCD on the ODROID-W PCB


Connect the TFT LCD module with several wires.
with double-side tape as shown above.

Assemble the watch straps. Please note that the hinge holders
Final assembly of ODROID smartwatch with screen attached.
should be soldered first.

ODROID MAGAZINE 13
TIPS AND TRICKS ODROID -W

SEARCH WITH Software

GOOGLE BBS • Debian (Raspbian) OS is run-


ning on the Linux Kernel 3.10.
WHAT IF GOOGLE
WERE INVENTED IN • LXDE X11 window manager
THE 1980S ? (This can be removed if you
want)
by Rob Roy
• Qt 4.8.4 framework library

F
or a retro-style Google experi-
ence, visit the Google BBS at
• Qt application to display the
http://bit.ly/1iXk8yF. Don’t
forget to bring your moon boots and clock and SMS / Mail / Call
walkman! notification

• Android application software


• Micro-HDMI cable
(written in Java) to push the
notification to the smartwatch
• Micro-USB cable
from a smartphone
• 5V/2A Power supply for the
The full source code will be released Docking board, which is
via Github at http://www.github.com/ required only when the USB
hardkernel. devices need 600mA or higher.
FIXING Official accessories • ODROID-VU (9-inch
ANDROID • Docking board with TFT LCD
1280x800 TFT HDMI
monitor with touch screen)
OVERSCAN • Docking board without TFT
A SIMPLE APP TO Summary
LCD
CHANGE THE This tiny version of the Raspberry Pi
• Connector package (26-Pin
DESKTOP header, 26-Pin header socket,
can run a full Raspbian desktop environ-
ment on its own, or be used in conjunc-
RESOLUTION 20-Pin header socket, 7-Pin
tion with pre-existing and widely avail-
header socket and USB host
by Rob Roy right-angle type) able Pi hardware to create an extremely
portable yet powerful computing solu-

L
ugalabs offers an Android app • RTC Backup battery (CR2032 tion, perfect for wearable applications.
from the Google Play store with Molex 51021-0200 wired Please post any questions that you may
that can change the resolution connector) have to the ODROID forums at http://
of the desktop in order to fix HDMI forum.odroid.com.
monitor overscan issues. For more • Lithium Polymer battery
details, please visit its Google Play (3.7V/720mAh with Molex
Store page at http://bit.ly/XYfZ51. 51021-0200 wired connector)

• Micro-SD 8GB(UHS-1 class)


card of Raspbian with RTC/
PMIC device driver patch

• RTL8188CUS based USB WiFi


module To submit your own ODROID-based
project for publication, send an email
• 720p USB Webcam to odroidmagazine(at)gmail.com.

ODROID MAGAZINE 14
EMMC MODULES

ALL ABOUT
HARDKERNEL’S
EMMC
MODULES
THE ODROID ADVANTAGE Hardkernel’s removable clip eMMC modules, which are
by Justin Lee usually soldered into the board, are unique to ODROIDs.

T
he Exynos-4412 CPU includes 330MB/sec of host bus bandwidth by a few USB memory card readers. So it
an eMMC 4.41 compatible host DDR. is worthwhile to check the compatibility
controller, with a maximum bus We’ve been selling 2 different eMMC list at http://bit.ly/1nPBE4i.
speed limited to 100MB/sec, an actual modules: The Green or Blue PCB has The chart on the following page is the
clock speed of 48Mhz with DDR. The the eMMC 4.5 chips. full list of eMMC modules we are selling
ODROID-X, X2, U2, U3, Q and Q2 The Red PCB has the eMMC 5.0 now. The round label indicates the OS
are all based on the Exynos-4412 CPU. chips. The eMMC 5.0 chip is slightly and capacity.
The Exynos-5410 CPU, which is smaller but it has the same BGA array The eMMC 4.5 Blue(or Green)
used by the the ODROID-XU, XU+E size, so that we can keep using the same PCBs will be obsolete soon except for
and XU-Lite, includes an eMMC 5.0 PCB. 8GB models.
compatible host controller. However, Most eMMC manufactures are mov- Even you have a different or
the hardware design was unable to sup- ing to eMMC 5.0. So it is hard to pur- wrong eMMC, you can use it for
port the eMMC 5.0 HS400 mode, be- chase the eMMC 4.5 chips anymore ex- your ODROID if you install a
cause there was no public specification cept for the lower capacity like 4GB and proper boot loader and OS image.
of eMMC 5.0 when we designed the 8GB. Recently, we started using 16GB
ODROID-XU. As a result, all the XU and 32GB eMMC chips from Sandisk Reference
series have the eMMC 4.5 (HS200) while we keep buying 8GB and 64GB
specification which reaches a maximum eMMC from Toshiba. The eMMC board schematics
speed of 160MB/sec since the actual When you install a new OS image http://bit.ly/1p4TX6N
clock speed is 160Mhz with SDR. onto the eMMC module, you need a
The Exynos-5422 CPU also has an USB memory card reader and an eM- The reader board schematics
eMMC 5.0 compatible host controller. MC-to-MicroSD converter board (read- http://bit.ly/1p9j0Z3.
The ODROID-XU3 is based on Exynos- er board). Please refer to the images be-
5422 and supports the eMMC HS400 low to understand how to use it. The following page is a handy guide to all
mode. The actual clock is 166Mhz and The reader board can’t be detected by of Hardkernel eMMC modules!

The eMMC reader attaches to the Top view of eMMC reader and eMMC mod- Bottom view of eMMC reader and eMMC
eMMC module with a small clip ule inserted into SD card reader module inserted into SD card reader

ODROID MAGAZINE 15
EMMC MODULES

EMMC MODULE REFERENCE CHART

ODROID MAGAZINE 16
LINUX KERNEL

LINUX KERNEL
COMPILATION
GET FULL CONTROL OF
YOUR OPERATING SYSTEM
LIKE A LINUX JEDI
by Venkat Bommakanti

A
s you make progress in using $ uname -a $ cat /etc/os-release
Linux, it is inevitable that you
would want to tweak your setup Linux u3-2 3.8.13.26 #1 SMP PRE- NAME=”Ubuntu”
in order to accommodate changes in EMPT Wed Jul 9 22:14:37 UTC 2014 VERSION=”14.04, Trusty Tahr”
your hardware setup, such as integrating armv7l armv7l armv7l GNU/Linux ID=ubuntu
an external device. Such tasks usually re- ID_LIKE=debian
quire modifications to the Linux kernel This output indicates the image used PRETTY_NAME=”Ubuntu 14.04 LTS”
or linking to a new driver. This article is based on the 3.8.y.z kernel, built on VERSION_ID=”14.04”
provides details on starting with natively Wed Jul 9 22:14:37 UTC 2014. HOME_URL=”http://www.ubuntu.com/”
building a pristine kernel using only the You can get additional image infor- SUPPORT_URL=”http://help.ubuntu.
ODROID itself. This article does not mation using the following commands com/”
address cross-compiling, which relates and observing the output: BUG_REPORT_URL=”http://bugs.
to building an ODROID kernel using a launchpad.net/ubuntu/”
secondary host machine such as an x86. $ cat /proc/version
Linux version 3.8.13.26 (root@ After installing a newly built kernel,
Requirements THEserver) (gcc version 4.7.2 the above information is useful for com-
(crosstool-NG 1.17.0) ) #1 SMP parison when verifying that the kernel
1. Any ODROID board, with an ap- PREEMPT Wed Jul 9 22:14:37 UTC has actually been updated.
propriate power adapter. 2014
2. A bootable 8+ GB MicroSD card or Preparing the system
eMMC module containing the lat-
$ cat /etc/lsb-release
est Lubuntu image available from the
DISTRIB_ID=Ubuntu Prior to building a kernel, you would
Hardkernel website.
3. A network where the device has ac- DISTRIB_RELEASE=14.04 need to setup the appropriate software
cess to the Internet and the ODROID DISTRIB_CODENAME=trusty environment. First, launch a terminal
forums. DISTRIB_DESCRIPTION=”Ubuntu 14.04 session and switch to the root user, using
4. Optional SSH access to the U3 via LTS” the command:
utilities like PuTTY (MS Windows 7+)
or Terminal (Mac, linux to perform the $ lsb_release -a $ sudo -s
steps from a remote host computer.
No LSB modules are available. All build related activities need to be
System basics Distributor ID: Ubuntu performed by the root user, which can
Description: Ubuntu 14.04 be enabled with the su command after
Initially, for reference, it is a good LTS typing the root password.
idea to note the version of the initial ker- Release: 14.04 Install the initial set of needed com-
nel version included with the installed Codename: trusty ponents, using the following installation
image with the following command: command:

ODROID MAGAZINE 17
LINUX KERNEL

# apt-get install build-essential # gcc --version # git --version


libqt4-dev perl python git gcc-4.8.real (Ubuntu/Linaro git version 1.9.1
4.8.2-19ubuntu1) 4.8.2
Enter Y to accept proposed option, Copyright (C) 2013 Free Software Fetch the
and allow for the command to com- Foundation, Inc. source code
plete. This is free software; see the
source for copying conditions. Create a temporary directory in your
This is a comprehensive version of the There is NO home directory and navigate to it using
command, highlighting all components warranty; not even for MERCHANT- the commands:
required for building a kernel. Some of ABILITY or FITNESS FOR A PARTICU-
the required components may already be LAR PURPOSE. # mkdir hk-src
installed in your present image, which # cd hk-src
will not be affected by the above com- # pkg-config --modversion QtCore
mand since only missing components 4.8.6 Your copy of the downloaded source
will be installed. code will reside here. Hardkernel uses
# perl --version GitHub for the source-control of its
The installation output may suggest open-source software for U3.
additional optional components. Al- This is perl 5, version 18, sub-
though not mandatory, you may install version 2 (v5.18.2) built for Use the following command to check
those using the component list, like arm-linux-gnueabihf-thread-multi- out the 3.8 repository, which is recom-
this: 64int mended for the X2 and U3:
(with 41 registered patches, see
# apt-get install nas libqt4- perl -V for more detail) # git clone --depth 1 https://
declarative-folderlistmodel Copyright 1987-2013, Larry Wall github.com/hardkernel/linux.git
libqt4-declarative-gestures ... -b odroid-3.8.y odroid-3.8.y
libqt4-declarative-particles Cloning into ‘odroid-3.8.y’...
libqt4-declarative-shaders # python --version remote: Counting objects: 44530,
Python 2.7.6 done.
For desktop images, presuming the
default window-system backend is based
on X11/Xorg, you should install libxcb Kernel configuration options are available for experienced users to add and change drivers
and its accompanying packages. This
is also used for building QT4. It is in-
stalled using the command:

# sudo apt-get install “^libx-


cb.*” libx11-xcb-dev libglu1-me-
sa-dev libxrender-dev

Enter Y to accept proposed option.


QT4 support may not exist on Hardker-
nel images by default.

Check the system

It is essential to make sure the system


is ready for compilation. In this example
case, the following commands/outputs
are useful to verify that all of the tools
are available and up to date:

ODROID MAGAZINE 18
LINUX KERNEL

remote: Compressing objects: 100%


(42780/42780), done.
remote: Total 44530 (delta 3428),
reused 16016 (delta 1191)
Receiving objects: 100%
(44530/44530), 122.03 MiB |
161.00 KiB/s, done.
Resolving deltas: 100%
(3428/3428), done.
Checking connectivity... done.
Checking out files: 100%
(42143/42143), done.

In this case, we will fetch a cloned


copy of only the latest commit to the
3.8.y kernel, instead the entire reposi-
tory. Please note that if you are using an
ODROID-XU, clone the 3.4.y branch
instead:

# git clone --depth 1 https://


github.com/hardkernel/linux.git
-b odroid-3.4.y odroid-3.4.y

Hardkernel maintains open-source kernel repositories that are downloadable for free.

Select a defconfig

Change to the source root directory ing command, ignoring any warnings: Novice users should review and go
using the command: through the options list but not alter any
root@u3-2:~/odroid-3.8.y# make selections. Experienced users may want
# cd odroid-3.8.y/
odroidu_defconfig to adjust the selections in the kernel con-
HOSTCC scripts/basic/fixdep figuration menu based on their in-depth
This is where all build related activi- ... knowledge of the kernel.
#
ties are launched from. Check the list of
supported defconfig files using the com- # configuration written to .config Baseline resource
mand: # usage

# ls -lsa arch/arm/configs/
Configure additional To understand the implications of
odroid*defconfig
modules the build process on resource usage, it
100 -rw-r--r-- 1 root root 101207
is useful to get a picture of the resource
Jul 14 13:11 odroidu_defconfig
In this example case, since QT4 sup- usage, before and during, the build pro-
96 -rw-r--r-- 1 root root 96792
port was added (xconfig is a QT4 UI), cess, as shown in the screenshot of the
Jul 14 13:11 odroidx2_defconfig
the xconfig module needs to be built us- command top.
96 -rw-r--r-- 1 root root 96797
ing the following command to launch an
Jul 14 13:11 odroidx_defconfig
editor for the selection of options: Build the kernel and
selected modules
# make xconfig
In our case, we will select the
odroidu_defconfig version, which con- CHECK qt To compile the kernel as fast as pos-
tains hardware configuration options MOC scripts/kconfig/qconf.moc sible, using all 4 processors available in
specific to the U3. Now, perform the HOSTCXX scripts/kconfig/qconf.o the U3, type the following command in
first build step by executing the follow- HOSTLD scripts/kconfig/qconf the Terminal window:

ODROID MAGAZINE 19
LINUX KERNEL

include/config/kernel.release`
update-initramfs: Generating /
boot/initrd.img-3.8.13.26

Convert the current initrd into a u-


boot compatible version, which adds a
64byte u-boot header:

# mkimage -A arm -O linux -T ram-


disk -C none -a 0 -e 0 -n uInitrd
-d /boot/initrd.img-`cat include/
config/kernel.release` /boot/uIni-
Resource usage before build starts
trd-`cat include/config/kernel.
release`
# make -j5 zImage modules # make modules_install
Image Name: uInitrd
Created: Mon Jul 14 14:17:02
It is recommended to perform the Update initramfs 2014
build process on an ODROID that uses
Image Type: ARM Linux RAMDisk
active fan cooling. You can experiment Prior to boot-up using the new ker-
Image (uncompressed)
with higher -j values only if you are able nel, the following steps need to be per-
Data Size: 2196336 Bytes =
to keep the temperature of the ODROID formed to create the initial RAM filesys-
2144.86 kB = 2.09 MB
below the thermal limits. For the above tem (initramfs). First, copy the current
Load Address: 00000000
command, the build process may take config to /boot so update-initramfs can
Entry Point: 00000000
15 ~ 30 mins, depending on pre-existing run properly, using the command:
system activity. Pay attention to build-
Save the current uInitrd using the
time warnings, especially related to your # cp .config /boot/config-`cat in-
command:
changes, if any. clude/config/kernel.release`
It is interesting the note the very high # ls -lsa /boot/conf*
# cp /media/boot/uInitrd /boot/
cpu-core usage (~90%) during the build 100 -rwxrwxrwx 1 root root
uInitrd-`uname -r`
process, as seen in the above figure. As 101420 Jun 13 01:02 /boot/config-
# ls -lsa /boot/u*
expected, the fan was spinning non- 3.8.13.23
2144 -rwxrwxrwx 1 root root
stop! 100 -rwxrwxrwx 1 root root
2195134 Jul 13 22:43 /boot/uIni-
101207 Jul 14 14:15 /boot/config-
trd
Install kernel and 3.8.13.26
2144 -rwxrwxrwx 1 root root
modules 2195134 Jul 14 14:17 /boot/uIni-
Recreate the initramfs using the com-
trd-3.8.13.26
The freshly built kernel and mod- mand:
ules can be installed using the following
Enable the new uInitrd using the
commands: # update-initramfs -c -k `cat \
command:

# cp arch/arm/boot/zImage /media/
boot/zImage Resource usage (top with P option) during build process

ODROID MAGAZINE 20
LINUX KERNEL YOUTUBE PLAYER

# cp /boot/uInitrd-`cat include/
config/kernel.release` /media/
YOUTUBE PLAYER
boot/uInitrd
# ls -lsa /boot/u*
2144 -rwxrwxrwx 1 root root
ALTERNATIVE
2195134 Jul 14 14:18 /boot/uIni- USE TAMPERMONKEY
trd
2144 -rwxrwxrwx 1 root root
TO WATCH VIDEOS
2195134 Jul 14 14:17 /boot/uIni- by Jeremy “Cartridge” Kenney
trd-3.8.13.26

Reboot

If no errors have been encounterd,


reboot the system using the following
commands so that the new kernel may
take effect:
Is your Youtube defaulting to the GreaseMonkey is, it’s an extension that
# sync && reboot HTML5 player, and any Chrome injects scripts into the website you are
Web-Store addon that you’ve tried using and other neat features using
After the reboot has completed, you does not work for forcing Flash Play- scripts.
can verify that the new kernel is installed er instead? Are you tired of not using You can go to Chrome’s Webstore
using the uname command to compare the resolution you want on Youtube and grab the Extension from http://bit.
the timestamp and kernel version from or the bland white look of Youtube’s ly/1iL5YRd. You can use scripts on any
before and after the build: Skin? Knowing a trick or two about website that does not have a security
Youtube can help you address these against scripts.
# uname -a issues, and even give you the option There’s endless possibilities for devel-
Linux u3-2 3.8.13.26 #1 SMP PRE- for a full screen or windowed version opers and an easy interface for beginners
EMPT Mon Jul 14 14:02:33 PDT 2014 of your video clip for faster multi- that allows for quick and easy manage-
armv7l armv7l armv7l GNU/Linux tasking. ment of your scripts.
Here’s a neat simple trick using If you are using an earlier build of
For questions, please visit the Tampermonkey and a short script! Chromium for use on early Debian
original forum post at http://bit. Tampermonkey is like Grease- Builds, install the Legacy Tamper-
ly/1ucMAlN. monkey (Firefox) but for Chrome. monkey instead. This requires you to
And for those who don’t know what Download the CRX from this website

Tampermonkey is available from the Chrome Web Store

ODROID MAGAZINE 21
TIPS AND TRICKS YOUTUBE PLAYER

INTERESTING at http://tampermonkey.net. To install,


Right-click and Save As to the folder of
Click install, then open up your You-
tube and a window will prompt you to
LINUX your choice, then open up Chromium show you where the new settings are.
settings and click on the Extension tab. Click on the Player tab and enable
COMMANDS Drag ‘n’ Drop the CRX file you have Flash Playback in Player Type. if you
CUTE PROGRAMS downloaded from the link above onto have a fast connection, disable Dash
the Extension Tab Page. Finally, test out Playback for faster loading and fix vari-
FOR YOUR NEXT the new options by going to http://www. ous hiccups made by a weak wifi signal.
COFFEE BREAK youtube.com and watching a video. You now have access to more options
you can think of, and can customize You-
by Rob Roy
Youtube Center tube in any way you like, even changing

W
ant to see some of the fun the player theme and color.
side of Linux? Try these This script gives you access to op- The script can be disabled by clicking
commands: tions you may have never seen before on on the Tampermonkey button in the ex-
Youtube. You get to make use of Auto tension bar beside the Address bar, then

All aboard!
$ sudo apt-get install sl
$ sl

Predict the future


$ sudo apt-get install \
fortune-mod
$ fortune

Moo
$ sudo apt-get install cowsay
$ cowsay ‘ODROIDS are cool!’

Changing the player settings in the Youtube Center


Cow fortune teller
Resolution to adjust the video to the res- clicking Dashboard and unchecking the
$ sudo apt-get install \
olution of your choice, set the width and extensions of your choice.
cowsay \
fortune-mod
height of the windowed player, enable Have fun enjoying YouTube!
$ fortune | cowsay or disable use of Dash Playback (which
is block buffering instead of loading the We got YouTube working, and now all he
full clip for safe use on 3G). does is upload videos of his expert gaming
X11 cow divination You can also add a download button
skills.

$ sudo apt-get install \


on each video you watch to select the
xcowsay \ format of your choice, add a repeat but-
fortune-mod ton if you like that song you’re playing,
$ fortune | xcowsay and many more features.
One of the more useful options is
The X11 cow is always right! the HTML5 Alternative, Flash Play-
back. Go to Youtube Center’s Github
at http://bit.ly/MANHYG, scroll down
to Download and click Dropbox. Your
Tampermonkey should open up right
away and prompt you if you want to in-
stall the script you have chosen.
ODROID MAGAZINE 22
ODROID-U3+

ODROID-U3 VS
ODROID-U3+
THE NEXT GENERATION IN THE
ODROID-U SERIES
by Justin Lee

The U3+ improves upon the popular U3 by


adding another USB port via host mode

W
e’ve been shipping the using an external bulky USB hub. It’s a age current on the HDMI port. It puts
ODROID-U3+ (Rev dual-use port that works both ways! the PMIC into an undefined state and
0.5) since the end it prevents the auto-power-on function.
of June 2014, with 4 main im- New USB host We moved the reverse current protection
provements over the original U3: power protector IC IC from HDMI connector side to CPU/
NCP380 PMIC side, which solved the problem-
• Micro-USB port is able to work atic auto-power-on issue. Now we can
in USB host mode.
AP2411 was used in Rev 0.2 PCB as turn on the board automatically by sim-
a USB bus power protector. However, ply inserting the DC power jack even
• The USB host power protector
IC was changed from AP2411 to some users reported that it could be when the HDMI is connected.
NCP380. damaged by an electrical shock on the
USB port. HW SPI port
• HDMI reverse-current blocking To solve this issue, we removed the
IC AP2331 was placed on the chip and added a wire, which changed it The Serial Peripheral Interface (SPI)
correct place. to more durable NCP380 that includes bus is a synchronous serial data link that
many reliable features like Under volt- operates in full duplex mode. The SPI
• HW SPI port was added. age lock-out, Built-in Soft start, Ther- bus is added on the new J5 (IO Port #2)
mal Protection, Soft turn-off, Reverse 4-pin connector on the PCB. Note that
voltage Protection, ESD Compliance to SPI ports support only master mode and
USB host mode with IEC61000-4-2 (Level 4), 8.0 kV (Con- a 1.8V interface like the other IO ports
Micro-USB port tact), and 15 kV (Air). on Exynos processor. You can use 4 pins
as GPIO mode as well as SPI mode. Af-
By adding a power control IC HDMI reverse- ter booting, the pins are in GPIO mode
RT9715, the Micro-USB port can work current blocking IC by default.
in the USB host mode as well as in USB
device mode, which we call Dual-Role- Some monitors or TVs have leak- Pin map bottom side view
Device (DRD). Just plug in an OTG-
to-Host cable and you will have another
USB host available for peripherals, so
that you can enjoy 4 USB ports without

OTG-to-Host cable to allow use of the


Micro-USB port as a 4th USB host port

ODROID MAGAZINE 23
ODROID-U3+

$ sudo modprobe spi-s3c64xx

Then, load the module to activate the


generic SPI, and you will have a standard
SPI node.

$ sudo modprobe spidev


$ /dev/spidev1.0
Pin Descriptions Chart of U3+ GPIO pin arrangements
The procedure for Serial Flash also
This example script sets all pins to begins by loading the module to active
echo 1 > /sys/class/gpio/gpio23/
output and toggle 5 times at 1Hz fre- the SPI host.
value;
quency. At the beginning of the appli-
echo “GPB[4],GPB[5],GPB[6],GPB[7]
cation launch, it unloads the SPI driver $ sudo modprobe spi-s3c64xx
set output HIGH”
modules to make sure the GPIO mode,
sleep 1;
and releases the GPIOs for the next us- Then, load the serial flash (misc)
age at the end. driver, and you will have a Serial Flash
echo 0 > /sys/class/gpio/gpio20/
value; node.
modprobe spi-s3c64xx
echo 0 > /sys/class/gpio/gpio21/
modprobe odroid-ioboard
value; $ sudo modprobe odroid-ioboard
dmesg | grep ioboard
echo 0 > /sys/class/gpio/gpio22/ $ /dev/ioboard-spi-misc
modprobe -r odroid-ioboard
value;
modprobe -r spi-s3c64xx
echo 0 > /sys/class/gpio/gpio23/ Please note that spidev.ko and odroid-
value; ioboard.ko can’t be loaded at the same
count=0
echo “GPB[4],GPB[5],GPB[6],GPB[7] time.
stop=5
set output LOW”
sleep 1; SPI host interface driver:
echo 20 > /sys/class/gpio/export http://bit.ly/1qz8gHs
echo 21 > /sys/class/gpio/export
if [ $count -eq $stop ]; then
echo 22 > /sys/class/gpio/export SPI generic driver
echo “GPIO TEST STOP”
echo 23 > /sys/class/gpio/export http://bit.ly/1rILc5X
echo 20 > /sys/class/gpio/unex-
port
echo out > /sys/class/gpio/ Serial SPI Flash add-on driver
echo 21 > /sys/class/gpio/unex-
gpio20/direction example http://bit.ly/1sOpccA
port
echo out > /sys/class/gpio/
echo 22 > /sys/class/gpio/unex-
gpio21/direction
port We tested a Serial SPI Flash memory
echo out > /sys/class/gpio/
echo 23 > /sys/class/gpio/unex- SST25WF020A on the new IO Shield,
gpio22/direction
port and the maximum speed was 40Mhz of
echo out > /sys/class/gpio/
exit 0 SPI clock. To learn more about the SPI-
gpio23/direction
fi DEV driver in detail, please visit http://
done bit.ly/WAgUYC.
while :
The ODROID-U3 Rev 0.5 has some
do
Let’s access the SPI mode. If the ver- great hardware improvements, so we
count=$(($count+1))
sion of your kernel was downloaded be- called it the ODROID-U3+. You can
fore July 17, 2014, you must first update find the latest U3 Rev 0.5 schematics
echo 1 > /sys/class/gpio/gpio20/
the kernel first. here at http://bit.ly/1oUShMn. In ad-
value;
dition, the new U3 IO Shield Rev 0.3
echo 1 > /sys/class/gpio/gpio21/
SPI driver module has been improved to include a new SPI
value;
Flash memory which can be connected
echo 1 > /sys/class/gpio/gpio22/
For generic SPI usage, first load the to an SPI bus (http://bit.ly/1nSPTFj).
value;
module to activate the SPI host.

ODROID MAGAZINE 24
WEB SERVER TIPS AND TRICKS

INSTALL A HOME INTERESTING


LINUX
WEB SERVER COMMANDS
CUTE PROGRAMS
USING LIGHTTPD AND NGINX
FOR YOUR NEXT
TO PUBLISH YOUR WEBSITES COFFEE BREAK
by @hamiko and Venkat Bommakanti by Rob Roy

W
ant to see some more of the
fun side of Linux? Try these

O
ne of the most common uses for commands:
or eMMC module containing the lat-
a Linux machine is to create a est U3 Lubuntu image available from
web server for the purposes of Odd name
the Hardkernel website.
hosting a website, which is an essential 3. A network where the device $ sudo apt-get install toilet
component to any business strategy or has access to the Internet and the $ toilet -f mono12 -F metal \
personal project. Whether you want to ODROID forums. ODROID Magazine
create a live production server or a per- 4. Optional SSH access to the U3
sonal one for your home intranet, this via utilities like PuTTY (MS Win-
article describes the steps involved in dows 7+) or Terminal (Mac, linux to
enabling two of the popular light-weight perform the steps from a remote host
web servers: nginx & lighttpd (aka computer.
lighty).
Although Apache server is also a pop- Server Installation
ular choice for Linux web hosting, it is The toilet command thankfully does
covered extensively on the PHP website Although it is possible to install not do what you think it does!
at http://bit.ly/1wXDju1 with specific both web servers on the U3 at the same
instructions for the ODROID located at time, the steps below assume that only
one web server is being installed. For Enter the matrix
http://bit.ly/1rIb9Te.
The instructions also include add- simultaneous use, any configurations
$ sudo apt-get install cmatrix
ing support for a secure web server conflicts, such as the use of the default
$ cmatrix
(openSSL-based HTTPS) and scriptable web port 80 by both servers, should be
web applications (PHP5-FPM). FPM, resolved first.
Chase the mouse
which stands for FastCGI Process Man-
ager, is an efficient alternative to the
$ sudo apt-get install oneko
classic FastCGI implementation. If you
$ oneko
are concerned about security related is-
sues and configuration when hosting a
Do you want to play
website, it is recommended to research it
a game?
well and implement relevant procedures
before enabling access to the Internet.
$ sudo apt-get install espeak
Periodic OS updates are also recom-
$ espeak \
mended.
‘Do you want to play a game?’

Requirements Cozy warm fire


1. Any ODROID board, with an ap-
$ sudo apt-get install libaa-bin
propriate power adapter.
$ aafire
2. A bootable 8+ GB MicroSD card

ODROID MAGAZINE 25
WEB SERVER

1 - Lighttpd and Nginx

Setup root rights, by running the command sudo -s

2 - Nginx 2 - Lighttpd
Install nginx using the command: Install lighttpd using the command:

# sudo apt-get install nginx # sudo apt-get install lighttpd

Launch nginx using the commands: Launch lighttpd using the commands:

# sudo service nginx stop # sudo service lighttpd stop
# sudo service nginx start # sudo service lighttpd start

3 - Nginx and Lighttpd

Launch a web-browser such as firefox and point to the ip-address of the device,
using the URL http://<u3-ip-address>

4 - Nginx 4 - Lighttpd

Install self-generated ssl keys/certificates, using the Check if SSL has been enabled in the lighttpd applica-
following (single-line) commands (use command help tion, using the command:
to get details on specified options):
# lighttpd -v
# mkdir /etc/nginx/ssl lighttpd/1.4.33 (ssl) - a light and fast webserver
# sudo openssl req -x509 -nodes -days 365 \ Build-Date: Jan 28 2014 17:19:37
-newkey rsa:2048 -keyout \
/etc/nginx/ssl/nginx.key \ Note that the output reflects that SSL is enabled. Now,
-out /etc/nginx/ssl/nginx.crt install self-generated ssl keys/certificates, using the
following (single-line) commands:
Appropriate destination directories first need to be
created, if not already present. # mkdir /etc/lighttpd/ssl
# sudo openssl req -x509 -nodes -days 365 \
When prompted for certificate information, you can -newkey rsa:2048 -keyout \
enter information such as: /etc/lighttpd/ssl/lighttpd.key \
-out /etc/lighttpd/ssl/lighttpd.crt
Country Name (2 letter code) [AU]:US
State or Province Name [Some-State]:CA Appropriate destination directories need to be cre-
Locality Name (eg, city):San Jose ated first, if not already present.

ODROID MAGAZINE 26
WEB SERVER

4 - Nginx 4 - Lighttpd
Organization Name:YourCompany Enter the certificate information as indicated for the
Organizational Unit Name:Engineering nginx case. Similarly check installed certificate.
Common Name:YourName
Email Address:you@yourcompany.com In addition, generate the corresponding .pem file using
the commands:
Check generated certificate, using the command:
# cd /etc/lighttpd/ssl
# openssl s_client -connect localhost:443 \ # cat lighttpd.key lighttpd.crt | sudo tee \
-reconnect lighttpd.pem

If the certificate information entered earlier is now This .pem file is later used in the lighttpd configuration
emitted, then it can be assumed the certificate was file.
generated properly.
Add SSL configuration to the lighttpd configuration, us-
Add SSL configuration to the nginx configuration, using ing the following steps:
the following steps:
# cd /etc/lighttpd/
# cd /etc/nginx/sites-available # cp lighttpd.conf lighttpd.conf-orig
# cp default default-orig # medit lighttpd.conf
# medit default
Add the following block:
The server block should match this example:
$SERVER[“socket”] == “:443” {
server { ssl.engine = “enable”
listen 80 default_server; ssl.pemfile = “/etc/lighttpd/ssl/lighttpd.pem”
listen [::]:80 default_server ipv6only=on; server.document-root = “/var/www”
}
# ssl support
listen 443 ssl; Check if the configuration update is ok, using the
(single-line) command:
root /usr/share/nginx/html;
index index.html index.htm; # sudo lighttpd -t -f \
/etc/lighttpd/lighttpd.conf
# Make site accessible from http://localhost/ Syntax OK
server_name localhost;
ssl_certificate /etc/nginx/ssl/nginx.crt; Relaunch lighttpd using the commands:
ssl_certificate_key /etc/nginx/ssl/nginx.key;
# sudo service lighttpd stop
location / { # sudo service lighttpd start
# First attempt to serve request as file, then
# as directory, then fall back to a 404. Relaunch firefox and point to the ip-address of the de-
try_files $uri $uri/ =404; vice, using the HTTPS URL https://<u3-ip-address>.
# Uncomment to enable naxsi on this location
# include /etc/nginx/naxsi.rules On the first access, certain dialog boxes will be prompt-
} ed seeking a response.

Relaunch nginx using the commands: Select the following options:



# sudo service nginx stop I understand the Risks
# sudo service nginx start Add Exception

ODROID MAGAZINE 27
WEB SERVER

4 - Nginx 4 - Lighttpd

Relaunch Firefox and point to the ip-address of the The welcome screen should appear as shown in the
device, using the HTTPS based URL https://<u3-ip- figure below.
address>.
The circled exclamation icon indicates SSL has been
On the first access, certain dialog boxes will be prompt- configured OK. Note that the exclamation indicates
ed seeking a response. Select the following option that a self-generated certificate is in use.
buttons:

I understand the Risks


Add Exception
Confirm Security Option

The welcome screen should appear as shown in the


figure to the right.

The circled exclamation icon indicates SSL has been


configured OK. Note that the exclamation indicates that
a self-generated certificate is in use.

5 - Nginx and Lighttpd

Install PHP5-FPM and other modules using the command:

# apt-get install php5-cgi autoconf automake autotools-dev curl libapr1 libtool curl libcurl4-openssl-
dev php-pear php-xml-parser php5 php5-cli php5-common php5-curl php5-dev php5-gd php5-sqlite php5-fpm php5-
mysql

6 - Nginx 6 - Lighttpd

Configure nginx for php support, using the following Update lighttpd for php support, using the following
configuration (socket-based) options: (socket-based) configuration options:

# cd /etc/lighttpd/conf-
# cd /etc/nginx/sites-available/
available/
# medit default
# cp 15-fastcgi-php.conf 15-fastcgi-php.conf-orig
# medit 15-fastcgi-php.conf

index index.html index.htm index.php;
Add the following (socket-based) configuration:
fastcgi.server += ( “.php” =>
location ~ .php$ {
((
fastcgi_split_path_info ^(.+.php)(/.+)$;
“socket” => “/var/run/php5-fpm.sock”,
“broken-scriptfilename” => “enable”
fastcgi_pass unix:/var/run/php5-fpm.sock;
))

)
fastcgi_index index.php; include fastcgi_
params;
}
Enable additional fastcgi configuration, using the com-
mands:

ODROID MAGAZINE 28
WEB SERVER

6 - Lightppd

# lighttpd-enable-mod fastcgi
# lighttpd-enable-mod fastcgi-php

These commands create files/links:

# ls -lsa /etc/lighttpd/conf-enabled
total 0
lrwxrwxrwx 1 root root 33 Jul 13 16:14 10-fastcgi.
conf -> ../conf-available/10-fastcgi.conf
lrwxrwxrwx 1 root root 37 Jul 13 16:15 15-fastcgi-
php.conf ->

Once you’ve reached this screen, make sure to congratulate your-


self for becoming an expert level web server installer! ../conf-available/15-fastcgi-php.conf

7 - Nginx and Lighttpd


Update the fpm configuration: Update the php configuration file:

# cd /etc/php5/fpm/pool.d/ # cd /etc/php5/fpm/
# cp www.conf www.conf-orig # medit php.ini
# medit www.conf

Add the following (socket-based) configuration: Enable the following config line:
listen = /var/run/php5-fpm.sock cgi.fix_pathinfo=1

8 - Nginx 8 - Lighttpd
Create a sample .php script file, using the commands: Create a sample .php script file, using the commands:

# grep -w ‘^[^#]*root’ \\ # cd /var/www


/etc/nginx/sites-available/default root \\ # echo ‘<?php phpinfo(); ?>’ > info.php
/usr/share/nginx/www;
# cd /usr/share/nginx/www Relaunch lighttpd using the commands:
# echo ‘<?php phpinfo(); ?>’ > info.php
# service php5-fpm stop && \
Relaunch nginx using the commands: sudo service lighttpd stop
# sudo service lighttpd start && \
# service php5-fpm stop && sudo service nginx stop service php5-fpm start
# sudo service nginx start && service php5-fpm start
Relaunch Firefox and navigate to the .php file using the
Relaunch Firefox and navigate to the .php file using the URL http://<u3-ip-address>/info.php
URL http://<u3-ip-address>/info.php
Verify that the PHP Info page is displaying properly.
Verify that the PHP Info page is displaying properly.

Additional Resources

Read more about nginx at http://wiki.nginx.org, and learn about Lighttpd at http://lighttpd.net.

ODROID MAGAZINE 29
ODROID-VU

ODROID-VU
AFFORDABLE 9” USB
HDMI TOUCH SCREEN
A PORTABLE
MULTITOUCH SCREEN
FOR ANDROID, LINUX
AND WINDOWS
by Justin Lee

Y
ou’d think that, with the massive
growth in tablet computing, it The Odroid VU - A 9 Inch 1280 x 800 Multi Touch Screen Display
should be an easy matter to:

1. Locate a small high-definition display 1920x1080, and you can buy a price tag to match! And most of
(HD) LCD screen a full-size monitor at that resolution, them have no touch screen option.
2. Connect it to an HDMI/LCD but that’s not what we’re about. We’re So we decided to develop a 9-inch uni-
driver board looking for something small and por- versal HDMI screen with 10-points ca-
3. Attach a capacitive multi touch table, which is where it gets a bit tricky. pacitive multi touch input for ODROID
screen on the LCD users. The name of display is ODROID-
4. Hook that up to your ODROID or
There are very few small, portable, VU, which is pronounced as “view”. We
other HDMI device
HDMI screens available on the mar- hope this product can be a “View point”
Unfortunately, it’s not quite that ket. Most of the ones out there have for your computer.
simple at all, or we’d all have done it al- 800x480 or 800x600 pixels. These
ready! The ODROID computers can are largely aimed at professional pho- Specifications
tographers and videographers, with
A back view of the Odroid VU components Display: 9-inch 1280 x 800 pixels
TFT LCD

The ODROID-VU is Touch screen: Capacitive multi-


available from the touch 10 points input (USB HID)
Hardkernel Store
at hardkernel.com
Dimensions: 224 x 153 x 11 mm
with the plastic frame.

Power: 5V/1A DC

Ports: Power, Micro-USB, Type-A


HDMI, Audio jack (3.5mm stereo)

5 keys: Volume control, Brightness


control, Power on/off

ODROID MAGAZINE 30
ODROID-VU

ODROID-VU board closeup detail


What’s inside points at the same time. It also has the
USB HID Multi-touch standard proto-
The HDMI to LVDS converter IC col which is compatible with Linux and XBMC, Chromium and Terminal on Ubuntu
MST7871KM has an HDMI receiver Windows. with U3 on the ODROID-VU
and an LVDS transmitter with analog The USB VID:PID is 2808:81c9
audio output. The IC also has an inter- which is very important information
nal frame buffer to scale up/down the when you modify the HID kernel driv-
image to fit into the 1280x800 output. er.
Volume up/down and Backlight bright-
ness control are also managed by the IC Use Cases
with On-Screen user interface.
The single-chip capacitive touch You can connect the ODROID-VU
panel controller FT5826QSL supports to ODROID boards as well as PC, TV
mutual capacitive touch panel up to 10- and other embedded boards if they have
HDMI output.
Some ODROID boards can’t gen-
erate a proper HDMI master clock
for 1280x800 native resolution of
ODROID-VU. So 1280x720(720p)
is scaled up to 1280x800 to fit the full
screen. 1920x1080 input is also sup-
ported via scale-down function.
You can purchase the ODROID-
VU, which comes with a power supply ODROID-U3 running Android 4.4 with an
and micro-USB cable, at the Hardker- ODROID-VU attached as the main screen
nel store (http://bit.ly/UmZEod).
Block diagrams of ODROID-VU assembly Laptop running Windows 8.1 with an
Raspberry Pi and Debian with ODROID-VU ODROID-VU used as a side monitor

ODROID MAGAZINE 31
PEPPER FLASH

PEPPERFLASH
CHROME PLUGIN FOR
LUBUNTU 14.04
AN EASY WAY TO WATCH
ADOBE FLASH ON YOUR
ODROID LINUX SYSTEM
by @Miltos
edited by Venkat Bommakanti

T
he Adobe Flash Player for the
Chrome web browser in Ubuntu
was discontinued by Adobe sev-
eral years ago, with no alternative avail-
able for playing Flash videos in Linux 5. PepperFlash Ver. 12.0.0.77 for the Terminal window:
until recently. Google recently released Lubuntu 14.04
an updated Flash-compatible player pl- 6. PCMan File Manager (pcman- $ sudo pcmanfm
ugin called PepperFlash, which includes fm) for Lubuntu 14.04
an ARM Ubuntu version. This article Right-click the icon for the down-
describes the steps needed to download Download loaded tarball, which should be visible
this plugin from Google and add it to the PepperFlash in the right-most pane, and selecting
Chrome web browser running Lubuntu the Extract Here menu option.
14.04 LTS on any ODROID board, in- Login to the ODROID using the The plugin will be extracted to the
cluding the X, U and XU series. default username of “odroid”, and /home/odroid/Downloads/Pepper-
download the precompiled packaged Flash directory, as shown in the second
Requirements version of the ODROID compatible screenshot.
PepperFlash by navigating to http://bit. It is easier for some users to use the
1. Any ODROID board, with an ly/1yYEDQf in the Chrome browser command-line terminal window almost
appropriate power adapter. window, which will be saved to the / entirely for these next steps. However,
2. A bootable 8+ GB MicroSD home/odroid/Downloads directory. using pcmanfm simplifies the process
card or eMMC module contain- Launch a terminal session and navi- for those who want to save some typing.
ing the latest Lubuntu image gate to the downloads directory, then In pcmanfm, copy the PepperFlash
available from the Hardkernel launch pcmanfm with root privileges directory and paste it into the /usr/lib
website. by typing the following command in directory.
3. A network where the device has
access to the Internet and the Contents of the directory after the PepperFlash tarball is extracted
ODROID forums.
4. Optional SSH access to the
ODROID via utilities like
PuTTY (MS Windows 7+) or
Terminal (Mac, linux to perform
the steps from a remote host
computer.

ODROID MAGAZINE 32
PEPPER FLASH ANDROID GAMING

Configure Pepper
Flash plugin
MUPEN64PLUS
TURN YOUR ODROID
After closing pcmanfm, launch the INTO A NINTENDO 64
medit (installed by default in Lubuntu)
editor and open the default configura-
RETRO GAMING
tion file of PepperFlash by using the CONSOLE
command: by Rob Roy

$ sudo medit \
/etc/chromium-browser/default
Copy the PepperFlash directory
Modify the CHROMIUM_FLAGS
After pasting the copied directory configuration paramete as a single line:
into the system library directory at /usr/

M
CHROMIUM_FLAGS=” --ppapi-flash-
lib/, the directory /usr/lib/PepperFlash upen64Plus is a Nin-
path=/usr/lib/PepperFlash/ \
will be created. tendo 64 emulator for
libpepflashplayer.so --ppapi-flash-
If using the command line instead, the Android platform,
version=11.7.700.225”
copy the PepperFlash directory to the and it runs great on the ODROID!
system library directory by typing the To install Mupen64plus, visit the
following command: Save the configuration file and close Mupen64Plus Play Store page at http://
medit as well as Chrome. bit.ly/YzRD1H, connect your joysticks,
$ sudo cp PepperFlash /usr/lib/ and immerse yourself in the glory that
Validate the was the Nintendo 64!
installation
Paste the PepperFlash directory From top to bottom: F-Zero-X, Mario
Verify that the PepperFlash plugin has World 64, and Mario Tennis 64
been installed correctly by re-launching
the Chrome web browser and navigat-
ing to the URL chrome://plugins. Se-
lect the PepperFlash plugin and click on
the Details option at the right side of the
webpage.
Check the details ensuring the plugin
information matches what is listed in the
screenshot. Finally, enable the Always
allowed option by checking the check-
box and close all Chrome windows.
To make sure that the plugin is in-
stalled properly, reboot the ODROID,
then launch Chrome again. Navigate to
any page with Flash content, such as the
Adobe Flash Samples website at http://
adobe.ly/UmTzrV.
For additional information or ques-
tions, please visit the original informa-
tion sources at http://bit.ly/1lstuyP.

ODROID MAGAZINE 33
IO SHIELD

IO SHIELD
DEMYSTIFIED
HOW TO CREATE AN INTERMEDIARY
BETWEEN THE HARDWARE
AND THE HUMAN
By Bohdan Lechnowsky

I
was recently contracted to work on during the fourth step, I find it necessary
a project that would require a U3 to to fine-tune the design produced during
The U3 I/O Shield is a powerful tool in an
potentially control valves, actuators the third step.  Of course, the fourth step
ODROID wizard’s magic kit
and other devices and read inputs.  That also involves testing and refining of the
was exciting, because I knew I’d have a design based on the results of testing.
chance to work with the U3 IO Shield -- root@odroid:/sys/class/gpio# cd
something that I’ve wanted to do since it Steps 1 and 2 gpio304
was released, but haven’t had a chance to root@odroid:/sys/class/gpio/
do because of my busy work schedule. When I first attempted to use the IO gpio304# echo out > direction
My first step when working with any Shield on Ubuntu, I had trouble find- root@odroid:/sys/class/gpio/
new hardware is to see if I can get it to ing concise instructions for getting it to gpio304# echo 1 > value ;Turns on
work using the supplied examples, and work using the method that is easiest for the pin
my second step is usually to post ques- Rebol to interface with.  That took me to root@odroid:/sys/class/gpio/
tions to forum.odroid.com about setup the forums where I was eventually able gpio304# echo 0 > value ;Turns
issues I discover.  This continues until I to piece together this set of basic instruc- off the pin
succeed in getting it to work.  The third tions:
and fourth steps, however, are ones that Update the Ubuntu kernel by fol- This is what I needed to start devel-
I particularly enjoy. lowing instructions in the forum post at oping my IO-Shield dialect, which I de-
The challenge of the third step is http://bit.ly/1o3vMJx. cided to name gpio.
to boil down the functionality of the
new hardware to the most simple, Type the following into Terminal: Step 3
elegant, flexible and efficient form as
possible while throwing out any pre- odroid@odroid:/sys/class/gpio$ After quite a bit of thought and de-
conceived notions of how that hardware sudo su sign, here are some examples of what I
is currently designed to be accessed or root@odroid:/sys/class/gpio# mod- wanted my dialect to be able to do:
controlled.  This doesn’t involve any probe gpio-pca953x
coding, but rather is a process of design- root@odroid:/sys/class/gpio# gpio [
ing a dialect to act as an intermediary modprobe i2c-gpio-custom init out P17    ;initialize pin
between the user and the hardware bus0=4,200,199 P17 as an output
while achieving all the stated goals. root@odroid:/sys/class/gpio# echo on        ;turn on P17
The fourth step is to convert that tca6416 0x20 > /sys/devices/plat- wait .1        ;wait .1 seconds
dialect into code using Rebol’s power- form/i2c-gpio.4/i2c-4/new_device off        ;turn off P17
ful parse feature.  Amazingly, once the root@odroid:/sys/class/gpio# echo deinit P17    ;deinitialize pin
hard part of the third step is done, the 304 > export ;304 is equivalent P17
fourth part is quite simple.  Most often to P17 on the IO Shield ]

ODROID MAGAZINE 34
IO SHIELD

• Whenever gpio is called, de- of an easier way to write a dialect, the


gpio [ termine whether the IO Shield open-source developers of Rebol would
    init in [P00 P01]    ;Set subsystem had already been ini- love to hear about it.
pins P00 and P01 as inputs tialized.  If it hadn’t, initialize it.
    init out [P02 P03 P06];Set Testing
pins P02, P03 and P06 as outputs • Convert the disparate timing
    init pwm 1 .1 P04    ;Set pin systems to a standardized time During testing on the U3, I found
P04 as a pulse-width-modulated system (PWM uses microsec- that utilizing PWM sometimes leads
output with a onds, wait uses seconds).  Sec- to instability in the operating system.  I
                ; period of 1 onds are more easily handled think this might have something to do
second and a pulse of .1 seconds by most people, so decided to with the constant interrupts required to
    [P02 P06] on        ;Turn standardize on seconds. make PWM work at high speeds in a
pins P02 and P06 on software system.  I also found that some-
    init .1 .01 P05    ;Set pin • Provide a level of abstraction be- times even at slow period/pulse speeds,
P05 as a pwm output - the last tween the printed port numbers PWM was sometimes laggy and inaccu-
initialization on the IO Shield with the /sys/ rate.
                ; (P04) was a class/gpio port numbers. Also found during testing was that
pwm, so it was remembered for using Rebol’s write command would
this init. • Allow handling standard I/O sometimes not work, but other times
    init gpio in P07    ;To and PWM within the same it would work fine.  I haven’t yet been
change back to standard I/O, dialect without any need for able to determine the circumstances that
specify gpio. understanding the underlying lead to this undesirable behavior.  Rebol
    wait .01        ;Wait .01 mechanism. also has an echo command that would
seconds work sometimes even when write would
    P06 off        ;Turn pin P06 • Reduce the required wordiness not.  The most reliable (but by far the
off of the dialect by allowing single slowest) method was to initiate a bash-
    P03 on            ;Turn pin or multiple ports to be operated based echo command from within Re-
P03 on on simultaneously, and unneces- bol.  In my testing, this method was over
    read speed P00    ;Read the sary words to not be required, 25 times slower than the native write
value of pin P00 into system/ but allowed when the user uses and echo commands in Rebol.
gpio/val/speed them, and to remember the last
    read rpm P01        ;Read the pin initialization types and ports Results
value of pin P01 into system/ so the following commands
gpio/val/rpm don’t need to re-specify them You can download the dialect for
    wait 5            ;Wait 5 unnecessarily. your own use at http://respectech.com/
seconds odroid/gpio.r3, where you can leave
    deinit [P04 P05]    ];Deini- • Testing had to be performed feedback. The gpio.r3 dialect definition
tialize pins P04 & P05 (this is with different methods of read- script is editable, so feel free to make
the way to turn off ing/writing to/from the /sys/ changes and improvements!
; a PWM pin) class/gpio and writing to the
    wait 1            ;wait 1 sys/class/soft_pwm directories The I/O Shield is now yours to command!
second for reliability and performance
    reset            ;Deinitial- under different conditions.
ize all standard I/O and PWM pins
] Fortunately, incorporating this type
of functionality within Rebol’s parse is
Step 4 quite straightforward and easy once you
become familiar with it.
In order to get to this level of abstrac- Incidentally, parse uses a dialect to al-
tion, the following hurdles had to be low you to easily define the rules for your
overcome by the dialect: dialect!  Because of this, if you can think

ODROID MAGAZINE 35
ODROID-SHOW

DIGGING (INTO)
THE ODROID-SHOW
UNLOCK THE
ARDUINO
HARDWARE’S
FULL POTENTIAL
by Declan Malone

P
revious issues of ODROID Mag-
azine covered the basics of setting
up the ODROID-SHOW hard-
ware and using it as a display for vari-
ous data generated by your ODROID
or PC.  While this has many useful ap- The ODROID-SHOW can do much more than display simple text data
plications, it only scratches the surface of
what’s possible with the SHOW.  At the SHOW example software can be information.
heart of the device is an ATMega328p downloaded from Hardkernel’s official For this article, I’ll be concerned with
chip, which is the same kind of mi- GitHub repository: looking at contents of the “show_main/”
crocontroller that’s contained in many and “libraries/” directories, which are ex-
models of the popular Arduino plat- $ mkdir ~/src; cd ~/src plained in the block diagram shown on
form.  This means that almost anything $ git clone https://github.com\ this page.
that you could imagine using an Arduino hardkernel/ODROID-SHOW
for could just as easily be made to run on $ cd ODROID-SHOW Parts explained
the ODROID-SHOW.
This series of articles aims to dig You will find directories named “ex- Terminals (meaning some kind of
below the surface, so to speak, and to ample/”, where you will find programs keyboard and display combination) have
introduce you to using the ODROID- to run on the ODROID or PC host, been around for over a century, even be-
SHOW as a programming platform in its “show_main/”, where you will find the fore the first computers were built!  As
own right.  In this installment, I’ll cover main program to run on the SHOW, computers became more commonplace,
the software components that come pre- and “libraries/”, where the various Ar- many of the old terminal devices were
installed on the ODROID-SHOW, how duino support libraries live.  Depending put to use as dumb data entry and dis-
they work, and how you can modify on when you downloaded the sources play devices.  In the early days, instead
them and upload your changes to the de- from github, you may see other direc- of personal PCs, it was much more com-
vice.  I’ll use a simple example of a Man- tories, too, such as one for the weather mon to have a large and powerful com-
delbrot Set viewer to demonstrate this. module, which I won’t cover in these puter (such as a mainframe computer)
In the second article, I’ll deal with articles. connected to lots of different terminals.
some options for connecting the SHOW You may already have looked at Because of the wide variety of differ-
to some simple electronic components the programs in the “example/” direc- ent kinds of terminal devices, as well as
via the two GPIO headers.  Finally, the tory.  If not, now might be a good time the wide range of features that newer,
third article will look at building a com- to have a look, so that you can familiar- more sophisticated terminals offered
plete, self-contained game on the hard- ize yourself with some of the capabilities (such as coloured text, an audible bell,
ware itself. of the ODROID-SHOW.  You can also ability to position the cursor or clear the
The latest version of the ODROID- check out the previous articles for more screen, etc.), some sort of standardisa-

ODROID MAGAZINE 36
ODROID-SHOW

tion was needed.  The list of “ANSI es- Arduino the official software.  Let’s get started by
cape code” (such as “ESC[2J;” to clear Programming Basics installing the Arduino IDE.  On Debian/
the screen) was the result. Ubuntu systems this is done by typing:
While this might sound like quite an All the software components includ-
archaic system (after all, we all have PCs, ed in the official software for the SHOW $ sudo apt-get install arduino
laptops and tablets now, not terminals!), device are written in C++.  If you know
actually it’s still in common use today.  If C++ (or even C) already, you should have This will install a lot of other pro-
you use “xterm” or a more modern no problem starting out on program- grams besides the IDE, including a
equivalent (like “gnome-terminal”) you ming for this platform.  There are some cross-compiler (“avr-gcc”) and some sup-
can still use the ANSI escape codes for minor some differences in the way C++ porting tools (“avrdude” being the main
all the things that used to be done on is used on the Arduino, and you should one).  For the most part, you don’t need
dedicated terminals. be aware of them.  For example: to worry about all these extra tools, since
More importantly for our discussion the Arduino IDE will call them transpar-
here, this is exactly what the “show_ • Instead of using low-level com- ently for you when it needs to.  Later on,
main” program block in the diagram mands like “gcc” and “make”, all if you want to change over to using these
above is implementing by programming your editing, compilation and tools directly (with your favourite edi-
the Arduino to behave as if it was a ter- uploading of programs is done tor and Makefiles), you’ll be able to do
minal screen. in a graphical IDE (Integrated so.  For these articles, however, I’ll stick
You can check out the full list of Development Environment) with the simple IDE option.
“escape codes” that the software im- named, appropriately, Arduino.
plements by referring to http://bit. There are four other important setup
ly/1nkYKUt.  I’ll come back to this lat- • Programs written for the Ardu- steps:
er when I add an ANSI-like escape for ino are often called “sketches”,
drawing a single pixel on the screen. and generally have a “.ino” file 1. Tell the IDE where you will
The other box on the left is for the se- extension store your “sketches” (not where
rial connection to the PC (or ODROID) you downloaded the sources
host.  It’s used both for receiving data • Programs do not have a from github!)
from the PC and also for printing de- “main()” function, since this is 2. Tell it which serial port to use to
bug information, which can be very supplied by the Arduino com- communicate with ODROID-
handy when writing Arduino/SHOW pile system SHOW (this may change if you
programs. reboot or move USB devices
On the right-hand side, we have • All initialisation is done in the around)
two libraries that were also developed program’s “setup()” function 3. Tell it which version of the
by Adafruit.  The top one implements Arduino is being used
high-level graphical primitives, such as • Arduino programs also require a 4. Tell it where to find your librar-
printing a character, drawing points, “loop()” function.  As the name ies
lines and circles, and filling in rectangu- suggests, this function is called
lar areas with solid colours.  This can be in an infinite loop directly after All steps except Step 3 are covered
seen as the platform-independent part of the “setup()” function returns in the official ODROID wiki page at
the stack. http://bit.ly/1p8uitU, so I won’t repeat
Below that, we have the platform- These are all relatively minor differ- them here.  For Step 3, select “Tools >
specific part of the graphics code.  It ences to working on a “real” computer, Board > Arduino Uno”.  The ODROID-
knows about how the ATMega chip is so it’s actually quite easy to dive into de- SHOW is fully compatible with the pre-
wired up to the TFT module, as well as veloping programs for the Arduino (and built Arduino Uno configuration.
the protocols needed to communicate SHOW!) platform. If you are running an older version
with the actual hardware, as shown in of the Arduino program (for example,
the box below. Development my Debian Wheezy distribution only
We won’t be delving too deeply into Environment provides version 1.0.1 of the program),
how this side works, but you may be then in Step 4 there may not be an “Add
interested in examining the code if that For our first step with programming Library ...” option under the “Sketch >
interests you. the SHOW, we’ll just compile and reinstall Import Library” menu option.  If your

ODROID MAGAZINE 37
ODROID-SHOW

Diagram of the Finite State Machine for the ANSI parser


Adding a “plot”
command
version of Arduino is too old like mine, the green “right arrow” mark in the row
then you will have to add the “GFX” and of icons directly underneath the menu When I first used the ODROID-
“ILI9340” libraries manually by creating bar. SHOW (v1.1 of the software), it sup-
symbolic links from the “libraries” direc- ported lots of ANSI escape characters for
tory of your sketchbook directory (set If all goes well, you should get some drawing text on the screen, but it didn’t
up in Step 1) to the individual library sort of indication in the message panel include any other graphics primitives.  I
directories as contained in the code that at the bottom, and the SHOW will then decided to change that by adding a new
you downloaded from Github.  For ex- reboot.  After a successful flash and re- escape sequence to let it plot a single
ample, if you downloaded into the “~/ boot, you’ll need to remove the jumper point on the screen.  Here’s how I went
src/ODROID-SHOW” directory, you before running any tests, such as those about adding that feature.
can create the links with: in the “examples/” directory.  Jumpers The first thing that I did was to see if
tend to be small and fiddly, so try to re- there was an existing ANSI escape code
$ cd ~/sketchbook member where you put it after removing for plotting points. As it turns out, there
it!  Alternatively, leave it attached to just isn’t, so I chose this as the syntax for the
$ mkdir libraries; cd libraries one of the pins on the P2 header.  You new command:
$ for d in \ can also get different types of jumper
~/src/ODROID-SHOW/libraries/*; that have an extra tab on top.  They tend  ESC [ row ; col X
do ln -s $d .; \ to be a lot easier to attach and remove
and are a little bit harder to lose because By examining the code in “show_
$ done they’re bigger.  You don’t need to have main.ino”, You can see that the “par-
one of these, but I find that it helps. sechar()” function is called every time a
After these setup steps, we can load If things didn’t go well, then you can new character is read from the PC over
“show_main.ino” into the IDE.  Af- check the message panel to give some the serial port.  The parser uses what’s
ter that, there’s only one more thing to idea of what went wrong.  You’ll get dif- called a “Finite State Machine” (or
do before reprogramming the device, ferent messages depending on whether “FSM”).  This is quite commonly used
and that’s to attach the programming the compilation failed (eg, due to miss- in any application where you have to
jumper.  This is used to short-circuit ing libraries or syntax errors) or there build up complex commands one char-
a set of two pins labelled P2 on the was a problem with uploading (like if acter at a time.
board.  They’re located between the reset you forgot to reattach the jumper).  It’s A FSM-based parser is simply a list of
switch (marked ‘Reset’) and the power pretty user-friendly and you should be “states” (which track partially recognised
LED (marked ‘Alive’).  Once you’ve able to figure out what went wrong based commands) and “transitions” (which are
done that, all you have to do is click on on these messages. followed by seeing a new character from

ODROID MAGAZINE 38
ODROID-SHOW

the input).  Please refer to the diagram


to the right, which shows some of the
FSM for the ANSI parser.
This is not a 100% accurate or com-
plete depiction, but it should help to ex-
plain how the parser works in general.  I
have highlighted in green the path that
would be taken for the parser to recogn-
ise my new point-plotting command.  As
you can see, the code is simply “grafted”
onto the existing graph structure.  Once
I knew where the new code would go,
the code to implement the new com-
mand was very simple:

case ‘X’:
ODROID-SHOW displaying a Mandelbrot set
row = (row > right_edge0) ?
right_edge0  : row; software, so you can check for yourself Mandelbrot Set
where the code was added.
col = (tmpnum > bottom_edge0) ? If you can understand how the parser A common first step when checking
bottom_edge0 : tmpnum; is organised, then it should be possible out any new graphics hardware is to dis-
to add more features to it by following play the Mandlebrot Set on it.  In the
tft.drawPixel(row, col, the same method as above.  You could, unlikely event that you’ve never heard
foregroundColor); for example, add more escape sequences of this before, the Wikipedia page at
for drawing circles, lines or boxes, all of http://bit.ly/1mQ75y3 is a good place
break; which are available from the GFX li- to start.  That page also includes pseudo-
brary but not currently exposed to the code for generating the Set, so I won’t
This does bounds-checking on the PC side. need to cover that here.
supplied row and column values then It would be quite straightforward to You can download my code from a
calls the appropriate method from the implement a set of LOGO-style primi- fork I made of the official Hardkernel
GFX object (“tft.drawPixel()”) using the tives, for example, with commands for SHOW repository by typing the follow-
current foreground colour. moving forward or backward, rotating ing commands:
These changes were since incorpo- the “turtle”, putting the pen up or down,
rated into a later version of the official and so on. $ cd ~/src

$ git clone \
ODROID-SHOW displaying a Mandelbrot set
https://github.com/declanmalone/
ODROID-SHOW.git SHOW-fork

$ cd SHOW-fork

There are actually two versions


of the code included here.  The first,
in the “examples/” directory is called
“mandelbrot.c”, and it’s intended to be
run on the host (PC) side.  A “Makefile”
is included to compile it automatically
on an ODROID machine or another Li-
nux system. There are a few things to
note about this code:

ODROID MAGAZINE 39
ODROID-SHOW

1. It includes some code based on Native Generator data with two calls to “spi-
the official “port_open.c” pro- write()”.
gram.  This code opens the USB I also wrote a version of the Mandel-
serial port and sets the baud rate brot Set program as a sketch designed to It takes the ATMega chip just over
and other important param- run independently on the ODROID- two minutes to render the full im-
eters.  This means that the code SHOW, without needing any host age with a maximum iteration value of
does not need to have a separate PC.  The sketch can be found in the 1000.  Considering that the chip has
“port_open” program running. “duino_fractal/” directory.  Compiling no floating point capability and it only
and installing is done in the same way as runs at 16MHz, this isn’t too bad.  The
2. The “plot_point()” function you did for the official terminal emula- native code also has one advantage over
sends the appropriate “ESC [ tor software, as described earlier. the PC code: since it doesn’t receive any
x ; y X” string over the serial The native code is broadly similar to data over the serial connection, it doesn’t
port.  It also sends a separate the version for the PC, with some dif- need to delay after writing each pixel.
“ESC 3 ? m” string to set the ferences: When I wrote the code, I had initially
colour of the point. intended to use a potentiometer and two
• It’s written in Arduino-style push buttons to allow the user to zoom
3. That function also includes C++, with a “setup()” and (an in and out on a particular screen area (in
appropriate error-checking empty) “loop()” function a similar way to the video at http://bit.
to make sure that the full ly/1yZ0UgB), but I never completed
string was actually written to • It makes use of the GFX and that part.  As a result, only some of the
the device.  If the send buffer ILI9340 libraries directly code to support this, such as definition
overflows, then “write()” will of hardware pins and ability to paint in-
fail and set the error value to • It sends back debug messages dividual “panels”, for easier scrolling, are
“EAGAIN”. over the serial connection with actually implemented.
The code correctly handles this “Serial.print()” calls
case by advancing the write Summary
buffer and trying the “write()” • It also uses the Arduino’s inter-
again until the full string has nal timer function “getmillis()” We’ve had a lot of ground to cover
been sent. to time how long it takes to in this article.  I hope that it has served
render the screen as a good introduction to the basics of
4. There is a call to “usleep()” af- programming the ODROID-SHOW
ter every write.  This is needed • It writes to the TFT screen’s and has helped to explain some of the
because the ATMega is only a memory directly rather than things that the platform is capable of.  I
single-threaded computer and calling “drawPixel()”.  This think you’ll agree that it’s actually not
if the PC side sends data too means that it calls “setAddrWin- that difficult to get started with writing
quickly, it is possible that some dow()” once for each “panel”, code for it.  In the next article, I’ll get
of the data will be lost. Adding then write each pixel’s colour to grips with hooking up the SHOW to
a short, user-adjustable delay other components via the GPIO pins.
after every write is a simple
way of working around this.

Although I wrote this version of the


program to use the “X” escape code, it
would also be possible to send the data
across by first sending an “ESC [ x1 ; y1 ,
x2 ; y2 i” escape sequence and then send-
ing the colour data for each pixel as if
you were sending an image.
Please refer to the “images.sh” exam-
ple program from the official sources to
see how that can be accomplished.

ODROID MAGAZINE 40
OS SPOTLIGHT

OS SPOTLIGHT:
POCKET ROCKET AND Pocket Rocket and

COUCH POTATO Couch Potato for the


U, X and XU series may
be downloaded from
ANDROID 4.X PREBUILT IMAGES http://bit.ly/1zYsZFt.
FOR THE ULTIMATE SET-TOP BOX
NOW AVAILABLE IN KITKAT
by Rob Roy, Editor-In-Chief

T
he ODROID family of comput-
ers was originally marketed as an
Open Android system, offering
application programmers an alterna-
tive to purchasing an expensive Android
phone and rooting it.  ODROIDs runs
Android extremely well, while including
many useful features such as hardware
video decoding and joystick drivers,
which would need to be installed sepa-
rately on a comparable Linux X11-based
system.
When I began using ODROIDs, I
set up a set-top box using an Ubuntu
desktop environment called LXDE,
which let me stream and download me-
dia files, then play them using Xine or The list of pre-installed apps for Pocket Rocket and Couch Potato
XBMC.  It could render 720p videos
well, but only some 1080p videos, with U, and XU) is flawless when using MX Before purchasing my first
lots of dropped frames, and was watch- Player, and plays videos of any resolution ODROID, I had never before consid-
able but choppy.  After trying several and encoding. ered using Android as my main operat-
tweaks to achieve smooth video, includ- At the time, I had also purchased an ing system, but after putting together
ing overclocking and setting kernel op- Apple TV, which has a friendly interface, the Pocket Rocket image, I learned the
tions, I reformatted my SD card and in- but I couldn’t install new applications, advantages of it. Android is an extremely
stalled Android Jelly Bean 4.1.2 on my since the iTunes store isn’t available for stable OS, and even when an app crashes
U2 instead. the Apple TV.  However, an ODROID or starts to slow down, Android makes
The Jelly Bean 1080p video experi- Android system allows unrestricted in- it easy to shutdown the application.  It
ence was incredible, and exactly what stallation and removal of applications also has a shallow learning curve, with
I was looking for!  Using both XBMC just like an Android phone, with thou- large, friendly icons, as well as shortcut
and MX player, the ODROID could sands of applications and games available buttons that are intentionally similar to
smoothly play even the densest videos from the Google Play Store.  Android is other operating systems.
on the XBMC website (such as Big Buck already rooted, so the operating system In order to use Android efficiently,
Bunny) that are known to bring other can be customized, self-writte apps can I use the built-in keyboard shortcuts,
systems to a stuttering halt.  The video be installed, and administrative func- which are similar to other desktops such
decoding on every Android build (X, tions can be performed as the root user. as Windows, Ubuntu and OSX.

ODROID MAGAZINE 41
OS SPOTLIGHT

Keyboard Shortcuts
Ctrl-C
Copy
Ctrl-V
Paste
Ctrl-A
Select all
Ctrl-W
Close Window
Ctrl-Right Arrow
Move right one word
Ctrl-Left Arrow
Move left one word
XBMC is the go-to program for all of your media center needs. It supports
Ctrl-Shift-Right Arrow
video, music, addons, and even can launch other applications.
Select word to the right
Ctrl-Shift-Left Arrow
basically any task that a desktop PC can stead by depressing the left mouse but-
Select word to the left
perform, but in a different way. ton for several seconds.  For example,
Alt-Tab
Switch program As an example, most desktop PCs of- in ES File Explorer, to select multiple
Alt-Esc fer a word processor, and save its files folders, long click the first folder, which
Desktop to the local hard drive.  In Android, the will then bring up a checkbox interface,
Control-L software used for editing documents is where other folders can be selected with
Go to address bar called Google Drive, which stores the a single click.
information on the cloud.  With Google
Drive, you can pick up any mobile de-
Android Experience vice, laptop, tablet, or desktop PC, log eMMC vs SD card
into Google Drive, and have access to all
Android is especially suitable for be-
of your documents without needing to Android is designed to run from an
ginners, or anyone that has experience
carry a USB thumb drive with you. eMMC module, and a distinct advan-
with a mobile phone interface.  How-
One notable difference with Android tage of ODROID computers is that this
ever, even as an expert computer user,
is that the right mouse button is actu- module can be removed and replaced
sometimes I just want to change some-
ally used as the “Back” button.  To bring easily.  Although an SD card will tech-
thing without having to adjust settings,
up menus that would normally be done nically run Android, the slow speed of
navigate menus or move windows.  An-
with a right click, use a “long click” in- the SD card hinders the experience be-
droid is perfect for this, and can perform
cause of the disk I/O.  I stopped releas-
ing Pocket Rocket images on SD card
XBMC Gotham 13 starting up for the first time. This is the final release of because of the amount of time spent
XBMC, since they are changing the name to Kodi for version 14. clicking the Android “not responding”
popups while customizing the image.
However, I discovered that the Ice
Cream Sandwich (ICS) version of An-
droid runs smoother than Jelly Bean,
when comparing them both using an
SD card.  As a result, I created a special
SD card version of Pocket Rocket called
Couch Potato that has all of the same
applications as Pocket Rocket, but uses
ICS for better disk performance.
If you don’t have the eMMC mod-
ule, then you can install Couch Po-
tato instead, and enjoy all of the same
features as Pocket Rocket.  Occasion-

ODROID MAGAZINE 42
OS SPOTLIGHT

MX Player is the best media player available for Android on the


ODROID, and offers smooth hardware video decoding in 1080p.
ally, Couch Potato will interrupt with a
“not responding” popup, such as when
Firefox and Chromium being the most XBMC and MX Player offer top-notch
downloading multiple applications from
popular.  Chromium has several fea- 1080p viewing experiences, with ad-
the Play Store, but they are less frequent
tures that aren’t available in Firefox, vanced features such as multi-language
than when running Jelly Bean from SD
such as touchpad swiping and key- subtitles, audio visualizations, net-
card. Both images offer the exact same
board shortcuts.  Either browser can be work streaming and Samba file shar-
applications, and only differ in the ver-
synchronized with other devices to au- ing.  XBMC also supports add-ons that
sion of Android 4.0 vs. 4.1.
tomatically download any bookmarks offer TV channels and other media ser-
that were made on the same Google ac- vices.
Google Play Store count.  Youtube videos should be played MX Player is arguably the best audio
using the native Youtube app in order to and video player available for Android,
The Google Play Store is accessed by
leverage the video decoding hardware. and is able to play nearly any kind of
pressing the Apps icon made of 6 small
media file.  It also has a full screen op-
squares on the upper right of the An-
Gmail and tion that hides the Android buttons at
droid desktop, then pressing the Shop
Google Drive the bottom of the screen automatically,
button on the upper right corner of the
which remain visible while watching
Apps menu.  After logging into the Play
More than one Google account may videos in XBMC.  Make sure to turn on
Store using a Google or Gmail account,
be added in the Settings app, and both all of the HW+ decoding options in the
an enormous library of applications and
Gmail and Google Drive offer an ac- Settings menu.
games becomes available, with many
count dropdown as a way to easily switch
of them offering free versions.  This is
between multiple accounts.   Google tTorrent
also how applications are updated, and
Drive includes word processing, spread-
notifications will periodically appear re-
sheet, presentation, forms, and draw- Torrents are automatically associated
questing permission to update them.
ing applications which are intended as by Chromium with the tTorrent app,
If you already have an Android
a lightweight alternative to Microsoft which is a peer-to-peer network down-
phone, you can quickly install your fa-
Office.  The advantage of using these loader suitable for large media files.
vorite applications by selecting the “My
cloud-based applications is that if there is Completed files are, by default, saved to
Apps” section from the upper left of the
an issue with the storage device, and the the /mnt/sdcard/Downloads directory,
Play Store, then pressing the “All” tab
operating system needs to be restored, with the option to choose an alternate
which keeps track of any applications
no documents will be lost, since they are location.  Keep in mind that tTorrent is
that you’ve used on any other Android
stored on the cloud rather than a local extremely resource-intensive, and high
device.
hard drive, as previously mentioned. disk activity may slow down the An-
droid interface.  It’s usually best to move
Chromium and XBMC and any torrents or download activities to a
Firefox MX Player second ODROID running Linux ser-
vices, and access the completed files us-
There are only a few browsers avail-
What set-top box would be complete ing the Samba sharing built into ES File
able for the Android platform, with
without a killer media player?  Both Explorer.

ODROID MAGAZINE 43
OS SPOTLIGHT

the ODROID!  The developers adapted


the game for use with a keyboard and
mouse.  Holding down the left mouse
button is the identical to dragging on a
touchscreen.  Free versions of Star Wars,
Star Wars II, and Space are already in-
stalled, and other versions, including
more recent releases, can be downloaded
from the Google Play Store.

Mupen64 Plus and


Retroarch

Pocket Rocket can turn an ODROID


Netflix is an essential part of any set-top box! into a family gaming super-console with
these emulator apps.  Both Mupen64
Plus and Retroarch support up to 4 si-
Netflix videos at full screen resolution without multaneous controllers, and support
playback glitches.  The TED Talks app tens of thousands of console games.  The
Netflix is what every entertainment provides hours of educational and in- Google Play Store includes many free
system needs, and the ODROID can spirational videos on a huge variety of emulators, and I tested a few of them for
run it in full 1080p on your giant living topics, presented by a non-profit organi- both game and controller compatibility
room screen.  This subscription-based zation.  For more information on TED before deciding to include Mupen64
service not only offers a massive catalog Talks, visit http://www.ted.com. Plus and Retroarch.
of movies, there are many original shows Retroarch is a multi-system emula-
that can only be seen on Netflix.  The Hangouts tor, and comes with many console cores
Netflix Android app is easy to use, with a that range from Atari 2600 to SNES
similar interface to the desktop version, The ODROID, when paired with to Sega Genesis to PlayStation Portable
and movies can be searched using an ac- an external camera such as the Logitech and PlayStation 1.  It’s an open-source
tual keyboard instead of picking letters C920, supports 1080p video in Hang- app that combines many generations of
with a tiny remote from an alphabetic outs, just like a desktop PC.  Either the retro and modern console video gaming
list like a 1980s arcade game. internal camera microphone or an exter- consoles into a single system, and allows
nal microphone headset may be used. continuous hopping from console to
Youtube and TED console without having to reconfigure
Talks Angry Birds the controllers.  Please refer to the July
issue of ODROID Magazine for instruc-
The Youtube app runs extraordinari- One of the most popular mobile tions on connecting Xbox 360 wireless
ly well, and can play 1080p streaming games of all time is even more fun on controllers to Retroarch, which I have

Who doesn’t like Angry Birds? Pocket Rocket and Couch Potato come with
3 versions of this highly addictive game.

ODROID MAGAZINE 44
OS SPOTLIGHT

found to be the most compatible con-


trollers for use with Android.
Mupen64 Plus is an excellent Nin-
tendo 64 emulator, and was the least
buggy of all those that I tried.  It has a
great interface for setting up controllers
quickly, and comes with several pre-built
controller profiles, including Xbox 360
wireless.  Both Retroarch and Mupen64
Plus allow use of the keyboard as a con-
troller, as well as an alternative touch-
screen controller interface, which is ideal
for use with an ODROID-VU external
touchscreen. ES File Explorer can be used to connect Samba drives for network media
streaming.
Pandora and
PC Radio automatically mounts them. mouse, which can be shared between
many computers.  JuiceSSH provides
Pandora is a subscription-based bVNCFree and the same functions as the Linux version
app that chooses music for you based JuiceSSH of SSH, with a nice graphical interface
on your past preferences and personal to organize the recently used list.
taste.  If you want to have a continuous I use Android as my main operat-
non-stop music mix for a party or din- ing system primarily because of bVNC- Terminal Emulator
ner, put on a Pandora station and press Free.  With this excellent VNC appli- and BusyBox Free
the power button on the top of the U3 cation, I can login to any of my Linux
(or keyboard power button) to turn off computers and use the remote Ubuntu Terminal Emulator is an Android
the screen.  PC Radio is an Internet Ra- desktop as if it were a native Android version of BASH terminal, and can be
dio app that includes broadcasts from all app.  By setting up a VNC server on the used in conjunction with BusyBox Free
over the world. second ODROID using Vino, I need to perform all of the Linux administra-
only a single monitor, keyboard and tive tasks that are not included with
ES File Explorer and Android, such as mount, grep, ping
Ultra Explorer bVNCFree can connect to any Windows, and uname.  For more information on
Linux, Android or OSX machine. the BusyBox commands, please refer to
These file explorers are more full- the official Wikipedia page at http://bit.
featured than some desktop explorers, ly/1zwVNEP.
offering Samba sharing, built-in zip ex-
traction, application file associations, Jota+
and multiple copy/paste blocks.  Ultra
Explorer is available as an open-source Jota+ is a standard text editor, with
project where developers are encouraged nearly all of the formatting and editing
to contribute their own modifications at features that would normally be includ-
http://bit.ly/1AzAeVG. ed in a desktop text editor such as Text-
I used ES File Explorer’s LAN tab to Pad.  Jota+ can be also used for web de-
connect with my media server, so that velopment by using the ES File Explorer
when I click on media files, they au- to associate .html and .php files with
tomatically launch in MX Player, and Jota+.  I created a Samba share on my
MX Player streams them over the net- ODROID web server to allow remote
work.  Additional local hard drives may editing of the website files, and often use
be hot-plugged into the USB ports and Jota+ to make quick changes to files via
accessed using ES File Explorer’s Local the Samba share without the overhead of
tab, which lists each USB drive after it starting up a full IDE.

ODROID MAGAZINE 45
OS SPOTLIGHT

Screen Orientation with third-party features, it can also serve


and full!screen as a general-purpose Android test envi-
ronment for your own applications, by
These two applications enable total using the Android Debug Bridge (ADB)
control of the Android desktop.  Screen software.  Install the ADB client on any
Orientation will lock the screen in either host Linux machine by selecting it from
Landscape or Portrait mode, depending the Synaptic Package Manager, plug the
on the orientation of the monitor.  The ODROID’s micro-USB port to the host The Pocket Rocket desktop with a swirl-
full!screen application temporarily hides machine with a USB cable, and open an ing Milky Way galaxy animation
the bottom Android menu until one of ADB connection by typing the follow-
the bottom corner hotspots is clicked. ing in Terminal on the host machine:

Bluez IME Settings $ su


and Joysticks # adb remount
# adb shell
Bluetooth controllers, such as the
Wiimote, can be configured as input de- This will open an SSH-like session on
vices using Bluez IME Settings, so that the Android machine, permitting access
they can be used to mimic keyboard to the command line on the remote ma- The Games menu is where I spend most
presses.  Xbox 360 controllers will im- chine.  Files can be transferred via ADB of my time
mediately connect upon being plugged to Pocket Rocket using the command:
in to Pocket Rocket, and can be used to
navigate the desktop menu, launch ap- # adb push <local directory> \
plications, and type using the on-screen <remote directory>
keyboard.
For more information on using ADB
ODROID Updater and other ways of connecting to the
and ODROID Utility ODROID from a host machine, please
refer to http://bit.ly/1xC42wk. Chill out with Pandora or the worldwide
Internet Radio using PCRadio
The official Hardkernel version of
KitKat Pocket Rocket is still in Beta
as of August 2014, but the ODROID
Updater can be used to import the lat-
est improvements and bug fixes from
Hardkernel as KitKat moves toward its
final release.  Follow the sequence of
on-screen buttons to automatically in-
stall the system updates, which typically
require a reboot.  The ODROID Util- Chrome and Firefox are the most popular The System menu lets you access pro-
ity program is designed to adjust boot browsers available teted files and other network computers
variables such as 720p and 1080p screen
resolution, initial screen orientation,
and CPU governor settings.  Additional
boot options, such as whether to blink
the alive led, can be tweaked by editing
the file /mnt/sdcard/boot.ini.

Installing Custom
Applications
The Video menu also contains Google ES File Explorer and Ultra Explorer are
Although Pocket Rocket is loaded
Hangouts and TED Talks two full-featured Android file explorers

ODROID MAGAZINE 46
MEET AN ODROIDIAN

MEET
AN ODROIDIAN Bo Lechnowsky, one of the Editors of
BO LECHNOWSKY: the ODROID Magazine, playing his
woodwind instrument
EXPERT MAKER AND outdoors

INSPIRATIONAL INVENTOR
by Bohdan Lechnowsky
edited by Rob Roy

Please tell us a little about yourself. vage what I could. I


spent some time in
I was born in Omaha, Nebraska USA to the public library
Ukrainian and German immigrant par- reading books on
ents. I moved to Ukiah, California USA electronic circuits to
after I had been married for 7 years and learn more about it.
had one son and a daughter on the way. I When I was 12, my
now have two additional daughters for a school purchased a few
total of 4 children, and have been married Apple II computers. I had
for 23 years. In 1994, I started an Amiga to stay after school to use them
Computer store. In 2001, I started a tech- My favorite
which meant that I missed the bus
nology consultancy and we now employ ODROID is
and had a 2.5 mile walk home. Again,
about a dozen people, mostly technicians. the U3 as it is a very
I had to teach myself programming from
powerful and capable computer with a
library books, and a fair amount that I
How did you get started with computers? low price point, and there are a lot of
taught myself. I got my own Commo-
U3-sized accessories like the Show, I/O
dore 64 at age 15. In school and in the
Prior to computers, I had an interest in Board and UPS Board, all of which I
university, I worked on all types of com-
electronics. I received my first solder- have been working with a lot lately.
puters, mostly programming.
ing iron at age 7. My parents lived very
frugally, so I couldn’t afford to buy new You’re an expert in the Rebol language,
What would you consider to be your
electronic components. Therefore, I had and often write articles that showcase the
favorite ODROID?
to take apart discarded electronics to sal- simplicity of the language. What software
have you produced with Rebol?

My entire company runs on Rebol soft-


This is where all of the mad computer science experiments happen!

ODROID MAGAZINE 47
MEET AN ODROIDIAN

ware I developed starting in 2003. Ev-


erything from inventory and time log- Currently, I have been contracted to
ging to invoicing, accounts payable and provide a solution to help improve food
receivable, and graphical real-time track- production by real-time processing and
ing of our progress toward our goals. In automation. In this project, we are using
addition, I’ve developed super-efficient a U3 with Show and IO Shield boards
surveillance cameras that capture and coupled with sensors including GPS and
process video on-camera at 1920x1080 lasers, and Rebol handles all the logic.
resolution @ 30fps, and I’ve written Another project I just completed was
the monitoring software that can be setting up a video surveillance server us-
used to keep an eye on what’s going on, ing a U3 and an external storage device.
and review what’s already happened. I’m currently trying to find the time to
For another project, I converted a cli- upgrade my 1978 Ford F150 4x4 pick-
ent’s medical recruiting database from a up truck to have an ODROID-powered
PICK mainframe to a Rebol/SQL solu- brain allowing me to do things such
tion that has now been in constant use as replacing the entire dashboard with
since 2001. I could go on, but I’d seri- digital touchscreens and Show boards,
ously have to write a book to list all my starting and stopping the engine with
projects written in Rebol. my smartphone, recording and check-
ing fuel levels and performance data,
What hobbies and interests do you have integrating GPS navigation, and many
apart from computers? automation features. Unfortunately,
my contract projects have to take prior-
I like to say that if you need a hobby, ity over my personal ones, like upgrad- Hiking Smith Rock State Park in
I’d be happy to give you one of mine. It ing my truck. If I have a chance to get Oregon with the family
would be easier to list the hobbies I don’t around to it, I’ll be writing an article
have. Some of the hobbies that I’ve been on my truck project for a future issue. ODROID with PoE (Power over Eth-
spending more time on lately have been ernet). Of course, lots of USB ports are
raising a family, playing keyboards with What type of hardware innovations would always a big plus (I know some boards
my church’s band, developing new tech- you like to see for future Hardkernel already have quite a few). Maybe built-in
nology products and business, working boards? bluetooth? With this said, my opinion is
on the mechanics and body of my truck, that Hardkernel does a great job of bal-
traditional blacksmithing, participating I haven’t looked into the technical re- ancing power and features with price.
in outdoor activities (mountain biking, quirements of any of these, but as long
camping, barbeque cooking, World Hu- as I’m allowed to make a wishlist I would What advice do you have for someone
man-Powered Speed Championships), love to see a future Hardkernel board wanting to get started with ODROID
traveling (including three mission trips with the newest Samsung SoC (looks programming?
to Ukraine for a total of almost half a like I’ll get my wish with the XU3). It One of the big hurdles I think many
year), linguistics, and editing. would also be amazing to have even a
single laptop-style memory socket for Bo’s computer science laboratory is so
Are you involved with any projects? expansion purposes, and running the big, it needed a second page to show
everything!

ODROID MAGAZINE 48
MEET AN ODROIDIAN

Part of my business, Respectech, with the floating expanded metal


people face is setting up a development
floor and LED lighting underneath.
environment. With this in mind, you
can’t beat C programming as gcc (a C
compiler) is already in almost every dis- favorite, of course, is Rebol. It runs on your project. For me, Rebol has the flex-
tro, and nearly every platform uses C nearly every platform without any code ibility and capabilities to handle almost
(including embedded devices like Ardu- changes, it is a single file download of every project I throw at it, and allows
ino). One would think that bash would less than 1MB, and simple things are me to develop solutions in a fraction of
also be a good option as it is also in- simple to do, while complex things are the time it would take with other lan-
cluded in nearly every distro. However, still possible. Not only that, but efficient guages.  And now that Red is maturing,
my opinion is that bash goes overboard dialects are easy to develop to allow for it is going to be a great alternative option
syntactically and is usually cumbersome building complex systems easily, which that will have nearly no learning curve
with which to develop solutions. My reduces future development and debug- for developers familiar with Rebol.
ging efforts. The You can visit Bo’s website at http://
language you use www.respectech.com.
Some of the “heavy lifting” we’re doing to get my 1978 Ford
should be based
F150 4x4 ready to have ODROIDs installed and controlling the
on the end goals of
electronics. My father-in-law helped with this step.
I can't tell you exactly what this project
does (it's still top secret), but I can tell
you that it involves a U3, a SHOW and
an I/O Shield, among other things.

ODROID MAGAZINE 49

Вам также может понравиться