Cluster User and File Management • Remote desktop for ODROID U3

Year One Issue #7 Jul 2014

ODROIDMagazine

WEATHER ENGINEERING HARDKERNEL’S NEW WEATHER BOARD DEVICE LETS YOU MONITOR WEATHER CONDITIONS WITH YOUR ODROID CONFIGURE YOUR OS SPOTLIGHT: UNMANNED GROUND GAMESTATION TURBO VEHICLE INTERFACE

• PORTABLE SOLAR COMPUTING WITH AN ODROID U3 CONSOLE EMULATION • MAKE AN ODROID X/X2 HARDWARE DUAL BOOT SWITCH AND MEDIA PLAYBACK • BUILD NATIVE ANDROID APPLICATIONS WITH RED FOR YOUR ODROID 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 : [email protected]

Our ODROID products can be found at: http://www.pollin.de/shop/suchergebnis.html?S_ TEXT=odroid&log=internal EDITORIAL

ur Robotics columnist, Chris, has released the next install- ment of his Unmanned Ground Vehicle article, and shows Ous in this issue how to interface with the motors and sen- sors. We’re almost ready to start building our own version of this awesome robot! We also take an inside look at GameStation Tur- bo, the popular gaming and console emulation OS image for the ODROID X and U series. Our HPC columnists Cooper and Anthony outline meth- ods of keeping a High Performance clus- ter of ODROIDs working smoothly with an in-depth article about best practices for HPC user and file management, and we share a great home project where an ODROID- U3 is powered using only solar energy, which stays running even when the weather doesn’t cooperate. Speaking of weather, the new ODROID Weather Board is Hardkernel’s latest ODROID-SHOW peripheral, and bundles 6 sensitive environmental sensors at an affordable price: UV index, barometric pressure, altitude, relative humidity, illumination and temperature, and is fully compatible with the Arduino program- ming system. Purchase your own Weather Board from the online Hardkernel Store at http://bit.ly/1wtPdgP. Hardkernel will be exhibiting at ARM Techcon on October 1-3, 2014 in Santa Clara, California, USA. If you live in the Silicon Valley or Bay Area, register before August 8th and receive a FREE pass to the Expo ($59 at the door) so that you can come hang out at the Hardkernel boot for an opportunity to chat with Justin, Lisa, Robroy and Mauro! More information about ARM Techcon can be found at http://www.armtechcon.com, and visit http://ubm.io/1qPo8Ci to get your compli- mentary early bird pass. We’d love to see you there! Recently joining the ODROID Magazine team is our new Assistant Art Editor, Nicole Scott, who lives in the San Francisco Bay area and has experience in video, audio, music, web, and multimedia production. Welcome aboard, Nicole! Would you like to write for ODROID Magazine? We are currently looking for several columnists to write on a variety of topics such as basics, Kali hacking, ARM world news, Bash scripting and any other subject that you wish to share. Gift packages are awarded for published articles, and regular columnists can earn top-end hardware! Email your article in Google Docs or Office format odroidmagazine(at)gmail.com . Look for more exciting announcements in the next issue, including the newest generation of the ODROID-XU family, as well as an affordable 9” Touchscreen USB LCD monitor, both of which are available for purchase at the Hardkernel store.

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.

ODROID MAGAZINE 3 STAFF

ODROIDMagazine

Rob Roy, Bo Bruno Doiche, Chief Editor Lechnowsky, Art Editor Editor I’m a computer Is counting the days programmer liv- I am President of to his long earned ing and working in Respectech, Inc., a vacations! While that San Francisco, CA, de- technology consultancy in doesn’t happen, he is working hard to signing and building web applica- Ukiah, CA, USA that I founded in 2001. keep things going on smoothly at work tions for local clients on my network From my background in electronics and and play. And loony as always. cluster of ODROIDs. My primary computer programming, I manage a team languages are jQuery, Angular JS of technologists, plus develop custom and HTML5/CSS3. I also develop solutions for companies ranging from pre-built operating systems, custom small businesses to worldwide corpora- kernels and optimized applications tions. ODROIDs are one of the weap- for the ODROID platform based ons in my arsenal for tackling these proj- on Hardkernel’s official releases, for ects. My favorite development languages which I have won several Monthly are Rebol and Red, both of which run Forum Awards. I use my ODROIDs fabulously on ARM-based systems like for a variety of purposes, including the ODROID-U3. Regarding hobbies, media center, web server, applica- if you need some, I’d be happy to give tion development, workstation, and you some of mine as I have too many. gaming console. You can check out That would help me to have more time my 100GB collection of ODROID to spend with my wonderful wife of 23 , prebuilt kernels and OS years and my four beautiful children. images at http://bit.ly/1fsaXQs.

Manuel Nicole Scott, Adamuz, Assistant Spanish Art Editor Editor I am currently a I am 31 years old and Digital Strategist and live in Seville, Spain, and Transmedia Producer was born in Granada. I have recently who specializes in online optimization become a father, and my son is now 5 and inbound marketing strategies, so- months old. It is an incredible experi- cial media directing and team coordi- ence! A few years ago I worked as a nation, as well as media production for computer technician and programmer, print, TV, film, and web. I also have but my current job is related to quality experience in graphic and website de- management and information technol- sign, social networking management ogy: ISO 9001, ISO 27001, and ISO and advertising, video editing and 20000. I am passionate about computer DVD authoring. I own an ODROID- science, especially micro computers such U3 which I use to run a sandbox web as the ODROID, , etc. My server, live in the California Bay Area, other great hobby is mountain biking, and enjoy hiking, camping and play- and I occasionally participate in semi- ing music. Check out my web page at professional competitions. http://www.nicolecscott.com.

ODROID MAGAZINE 4 INDEX HIGH PERFORMANCE COMPUTING AT HOME - 6

BASH BANG! - 9

FIND WHAT YOU NEED WITH GREP - 9

USING XBOX360 CONTROLLERS ON ODROID - 11

CONVERT A X OR U LINUX IMAGE TO XU - 12

CONTROL YOUR BANDWITH - 13

CONTROL USER ACCESS - 13

OS SPOTLIGHT: GAMESTATION TURBO - 14

FRACTAL GENERATORS FOR LINUX - 18

PORTABLE SOLAR COMPUTING - 19

BUILD ANDROID APPLICATION WITH RED - 20

BUILD A DUAL BOOT SWITCH FOR ODROID X2 - 21

LIQUID COOLED ODROID-XU- 22

REMOTE DESKTOP FOR ODROID U3 - 23

ODROID OFFROAD UGV PART 2 - 27

CHANGE YOUR U3 HEARTBEAT - 29

ODROID WEATHERBOARD - 30

MEET AN ODROIDIAN - 32

ODROID MAGAZINE 5 HPC IN THE HOME (MEDIUM) HIGH PERFORMANCE COMPUTING AT HOME CLUSTER USER AND FILE MANAGEMENT by Cooper Filby and Anthony Skjellum - Runtime Computing Solutions LLC http://www.runtimecomputing.com

n the February and March 2014 Ar- ticles of ODROID Magazine, we out- Ilined how to configure the networking for a cost-effective and efficient ODROID cluster managed by a central head node. In this article, we continue to expand the ro- bustness of our cluster by incorporating services such as LDAP and NFS/AutoFS into our head node and compute nodes in order to accommodate a wider range of uses and users. With LDAP configured, we will be able to have users log into any node of the cluster with the same creden- tials and permissions which, when com- bined with NFS/AutoFS, will permit us to configure network-mounted home direc- tories and shares, creating a uniform user Cool looking cluster huh? Well, after reading this article, you’ll know how to build one too! experience when connecting to any node in our cluster. To try out this HPC project, you’ll need: 5. A machine with a display with Protocol (LDAP) service for managing a GUI, network connectivity and users that are a part of our cluster. 1. 2x ODROIDs - in our exam- Apache Directory studio Of course, if you already have an ples, we will be using XU+Es run- LDAP service running on your net- ning 13.09 server. More Configuring SLDAP work, you could go ahead and skip this Up until this point in previous ar- ODROIDs can easily be included as step and configure your nodes to use ticles, we have been operating under well to create a bigger cluster that for user authentication instead. the assumption that anyone using our However, before installing and configur- ODROID cluster would rely on the 2. 1x Ethernet Switch (preferably ing LDAP, we will need to decide how default odroid user account that comes Gigabit Ethernet, also called 1000-BaseT) we wish to organize our user accounts. with precompiled Ubuntu Server imag- While LDAP configurations will vary es. While using a single login is sufficient 3. 3x Ethernet Cables (plus 1 by organization, it’s a common practice for one (or maybe two) users, this single cable for each additional ODROID) to use the organization’s domain name login strategy is hardly a secure and scal- for as the LDAP search base, as we will able model for an expanding cluster. To 4. 1x USB Gigabit Ethernet Adapt- show below. To get started, we will begin address this need, we will install and con- er (ideally one for each ODROID) by installing the LDAP service on our figure a Lightweight Active Directory head node as follows: ODROID MAGAZINE 6 HPC IN THE HOME

1. In the bottom left corner of case, either People or Groups) and sudo apt-get install slapd ldap- ApacheDS, select the LDAP icon to hit ‘Next >’. utils create a new Connection. 4. Review the Attributes and se- 2. Input a name for the connec- lect ‘Finish’ when you are satisfied During the installation, you will be tion, then the hostname or IP for with the entry. given a chance to select your administrator your head node, and select ‘Check 5. Repeat steps 1-4, entering the password for the LDAP service. Once the Network Parameter’ to verify that other organizational unit name on install completes, our LDAP server will be ApacheDS can communicate with step 3. a blank slate for our further setup. To get your server, and hit ‘Next’. If started with our configuration, we run: ApacheDS is unable to connect, If steps 1-5 went well, you should check that your machine can ping now see an LDAP Browser view that sudo dpkg-reconfigure slapd your head node and that slapd is looks something like this: running. While the options may look confus- 3. On the Authentication screen, ing at first, for our purposes we can enter the admin login credentials choose the default options for every- using the Domain Component (dc) thing except the DNS Domain name, information that you entered during Organization name, and Administrator the setup of slapd. Using the slapd password fields. What you select for the configuration listed above, we en- DNS Domain name and Organization tered ‘cn=admin,dc=ocluster,dc=r name are up to you, in this case we used tcomputingsolutions,dc=com’ and ‘ocluster.rtcomputingsolutions.com’ the corresponding password we en- LDAP Browser in action for both entries (you will use your own tered when we ran dpkg-reconfigure domain, and prefix it with the name of slapd (the series of dc= sections will your cluster, which might be odroid or differ depending on what you input With these two organizational units another name you prefer). during setup). After verifying that in place, we can go ahead and start Success! You now have a running ‘Check Authentication’ is successful, creating our users and groups for our LDAP server! Unfortunately, we don’t hit ‘Finish’. cluster. In this example, we are going to have any real information stored in the create one cluster admin user and two LDAP service just yet, such as Users or Again, your specific LDAP setup will cluster groups using ApacheDS, and Group information. While there are a vary, but in this instance we will create then provide a sample python script number of ways that you could go about two Organizational Units (OU’s), called that can be used to create new accounts creating containers for users and groups, People and Groups using ApacheDS. from the command line. like using command line tools, we per- To add a new entry, right click on our First, we will create two groups, one sonally prefer using Apache Directory Domain Component (dc, ex:’dc=oclust called ‘ouser’ and one called ‘osudo’, Studio (http://directory.apache.org/ er,dc=rtcomputingsolutions,dc=com’) giving us some control on who has ad- studio) to take care of our initial setup. entry in the LDAP Browser and select: ministrative access throughout our clus- Afterwards, it will be much more con- New -> New Entry. ter through the eventual use of sudoers venient to utilize command line scripts, We can then create our People and files. We can create these groups follow- such as the one included in the Appen- Groups OU’s using the following steps: ing the steps below: dix of this article. 1. Select ‘Create Entry from 1. Right click ‘ou=Groups’ and Users and Groups scratch’ and select ‘Next >’ select ‘New -> New Entry’ A good next networking question 2. Find and select ‘organization- 2. Select ‘Create entry from toNow that we have our service started, alUnit’ from the ‘Available object scratch’ and ‘Next >’ we need to start adding user accounts classes’ list, select ‘Add’ and then 3. From the ‘Available object (authorization) to allow people to sign in ‘Next >’. classes’ list, select ‘posixGroup’, using those credentials (authentication). 3. On the row containing ‘RDN’, ‘Add’ and then ‘Next >’. To get started with using Apache Di- enter ‘ou’ into the first field, and the 4. On the RDN row, enter ‘cn’ = rectory Studio, we need to create a new name of the OU you are creating in ‘osudo’, and select ‘Next >’. connection to our LDAP server, which the second field after the ‘=’ (in this 5. Next, you will be prompted for we can do using the following steps: ODROID MAGAZINE 7 HPC IN THE HOME

a gid number for this group, what you rectory ‘/nethome/oadmin’, where sudo apt-get install nfs-kernel- pick is up to you, although we highly /nethome is the folder that will we server recommend you use a number at least configure with AutoFS and NFS. above 1000 to avoid potential conflicts. The last field is for the Surname It’s worth noting that in the past, we In this case, we will use ‘2001’. After en- (sn) field, where we used ‘Admin’. have encountered issues attempting to tering your chosen value, hit ‘OK’. 7. Finally, we need to add the install nfs-kernel-server using apt. If 6. Confirm your attributes and ‘userPassword’ and ‘loginShell’ attri- this is the case for you, try building and hit ‘Finish’ to create the group. butes to our oadmin account. We can installing unfsd from source, which is 7. Repeat steps 1-6 to create the add these attributes by right clicking available online. Next, we need to create second group, using ‘ouser’ and on the window and selecting ‘New two folders that we can export from the ‘2002’ for the common name and Attribute’, typing in the desired at- head node and mount on the compute gid respectively. tribute name and hitting ‘Finish’. In nodes, nethome and opt: the case of the userPassword attri-

With these created, let’s go ahead and bute, you will be prompted to enter sudo mkdir -p /srv/nfs4/nethome create an LDAP administrator account, in your password and your Hashing sudo mkdir -p /srv/nfs4/opt ‘oadmin’: Method (what you pick is up to you, sudo chmod 777 /srv/nfs4/nethome but we strongly recommend against 1. Right click ‘ou=People’ and using Plaintext). You can then add In this case, we’re going to replace select ‘New -> Entry’ the loginShell attribute by repeating the existing /opt directory with our NFS 2. Select ‘Create entry from the above step, using ‘/bin/bash’ as directory, and nethome will be used to scratch’ and ‘Next >’ the corresponding value. store our home directories. With these 3. From the ‘Available object 8. After you confirm that every- directories created, we now need to edit classes’ list, select and ‘Add’ both the thing looks correct, hit ‘Finish’ to /etc/exports using our favorite text edi- ‘posixAccount’ and ‘inetOrgPerson’ create your new user. tor (as root) and add the following lines: fields, and then ‘Next >’.

4. On the RDN row, enter ‘uid’ If everything checks out, the ‘oad- /srv/nfs4/nethome = ‘oadmin’ (where the uid corre- min’ account should appear under the 192.168.128.0/24(rw,sync,no_root_ sponds to the username) and select People ou in the LDAP Browser. You squash,no_subtree_check) ‘Next >’. can then go ahead and create a few /srv/nfs4/opt 5. The next window will prompt more accounts as you see fit, or you can 192.168.128.0/24(rw,sync,no_root_ you to enter the uidNumber. Again, check out the appendix for a simple Py- squash,no_subtree_check) we recommend you pick a num- thon script that you can use to create ber at least above 1000 to avoid users outside of Apache Directory Stu- In essence, the first segment denotes conflicts. In this instance, we use dio. Before we can get to using these ac- the folder to share, while the second ‘2200’. After entering your chosen counts, however, we need to set up our segment denotes the hosts to export to value, hit ‘Ok’. NFS server and configure our nodes to (our internal network) and the options 6. On the Attributes menu, you use both LDAP and AutoFS. for exporting. With all these settings in will notice several fields highlighted place, we can now go ahead and restart red that we will need to populate Configuring the nfs service: before creating the account. First, NFS we can populate the Common The Network File System (NFS) sudo /etc/init.d/nfs-kernel-serv- Name (cn) field with a name for our service is essential to any well rounded er restart user, in this case ‘Ocluster Admin’. cluster. With NFS properly configured The gidNumber field is the primary we can make use of network mounted Finally, we can ‘mount’ these direc- group for this user, which in this home directories, meaning users’ files tories on the head node with the fol- case will be ‘2001’ for the osudo follow them around the different nodes lowing commands: group. Next, we need to fill out the in the cluster. Furthermore, we can use

homeDirectory field, which will tell NFS to setup general purpose shared sudo ln -s /srv/nfs4/nethome/ / the LDAP account which directory folders for compiled binaries or cluster nethome to use to access user specific files. configuration settings. To get started sudo rm -rf /opt In this instance, we will use the di- with setting up our NFS server, run: sudo ln -s /srv/nfs4/opt/ /opt

ODROID MAGAZINE 8 HPC IN THE HOME TIPS AND TRICKS

With this configuration in place, we If all went well, you should be able can now go ahead and configure our to log in using the credentials for the BASH BANG! nodes to use AutoFS and LDAP. oadmin account, or any new accounts BECAUSE COMMAND we configure. Of course, we still don’t Configuring Client have any home directories created for LINE NEVER GETS OUT LDAP Authentication our users; fortunately, LDAP provides OF FASHION Fortunately, configuring LDAP us a way to automatically create home on all of our cluster nodes is a good directories. Create the file /usr/share/ by Bruno Doiche deal simpler than setting up the LDAP pam-configs/my_mkhomedir as root, fter getting used to running service on the head node; we can get and add the following contents: your own commands via ter- started by installing the nscd and the minal, nothing could be better ldap client meta package: Default: yes A than having some extra tricks up your Priority: 900 sleeve, right? Take notes on this pair of sudo apt-get install ldap-auth- Session-Type: Additional time savers and make it look like you client nscd Session: required pam_mkhomedir. learned Linux years ago! so umask=0077 skel=/etc/skel The ldap-auth-client configuration 1. Use !! to refer to the previous command: installation will prompt you to fill in Run sudo pam-auth-update to enable information about your LDAP server, the settings. Upon logging in as oadmin, $ apt-get install package $ sudo !! we’ve shown our answers below: your home directory will be created for you automatically under /nethome/oad- 2. Look for a certain command but don’t LDAP Server URI: ldap://odroid1. min. Note that we can get away with only execute it: ocluster.rtcomputingsolutions. having this enabled on the head node, as !:p comSearch Base: dc=ocluster,dc=rt external users have to connect to the rest computingsolutions,dc=com of the cluster through the head node (al- LDAP Version: 3 though having this enabled on all cluster Local root Database admin: No nodes won’t create any problems). LDAP database require login?: No FIND WHAT YOU Configuring Client NEED WITH We actually encountered some diffi- AutoFS culties configuring LDAP on the head AutoFS is often used in conjunction GREP node when using the fully qualified do- with NFS services, as it allows us to auto- main name. To get around this, we just matically mount remote resources upon THE QUICK WAY TO put localhost, although your mileage rebooting. To get our NFS shares mount- LOOK FOR CONTENT may vary. You may have also noticed ed on our compute nodes (we’ve already that we changed up the hostnames and ‘mounted’ them on our head node), by Bruno Doiche domain names of our cluster, where we need to start by installing autofs: eed to edit that system file for odroid1 is now our head node instead a certain string, but don’t re- of odroid-server0, and are compute sudo apt-get install autofs member which file was that? nodes are named odroid2 and up. N Grep your way out of this simply by After the install finishes, we will Next, we need to create the neth- typing: need to run the following commands to ome directory that will be one of our finalize configuration of our cluster: NFS mount points: grep ‘string’

You can even expand your search sudo ln -s /lib/arm-linux-gnue- sudo mkdir /nethome with the -i and -R arguments, -i to abihf/nss_ldap.so /lib/libnss_ sudo chmod 777 /nethome ignore case, -R to find recursively on ldap.so.2 directories. Just remember that grep Lastly, we need to modify our sudo auth-client-config -t nss -p doesn’t distinguish which type of file lac_ldap autofs configuration files to mount it is looking at, so exclude your mul- sudo pam-auth-update the opt and nethome directories. The timedia file systems to save time. sudo reboot files we’ve modified (or created) and

ODROID MAGAZINE 9 HPC IN THE HOME HPC IN THE HOME

their contents have been shown below: more compute nodes, we now have def addUser(): an ARM infrastructure we can rightly “””””” /etc/auto.master call a cluster. In future articles, we will try: +dir:/etc/auto.master.d demonstrate various ways to make use ldapCon = ldap. +auto.master of our newly commissioned cluster, initialize(HOST) /nethome /etc/auto.nethome such as utilizing MPI, and further ways ldapCon.simple_ --timeout=60 to improve it, such as using Puppet. bind_s(ADMIN_CN, ADMIN_PASS) /- /etc/auto.direct --timeout=60 Acknowledgements attrs = getUserAttrib- We would like to give special utes() /etc/auto.nethome thanks to Dr. Kenneth Sloan, Direc- ldif = modlist. * odroid1.ocluster.rtcomput- tor of the University of Alabama at addModlist(attrs) ingsolutions.com:/srv/nfs4/neth- Birmingham’s 3D Print Lab (http:// ldapCon.add_s(“uid=” ome/& bit.ly/1j2AOjI) in the Department of + attrs[‘uid’] + “,” + PEOPLE_ Compuer and Information Sciences. BASE,ldif) /etc/auto.direct With their support, we were able to ldapCon.unbind_s() /opt odroid1.ocluster. 3D-print the cluster stand shown in print “Account created.” rtcomputingsolutions.com:/srv/ the picture on page 2. except ldap.LDAPError, e: nfs4/opt print e Sample Code sys.exit() With this information in place, we Note this is just an example that we print “Done.” can apply these autofs settings with used previously. Feel free to expand the following command: upon it to create new users. This also requires the ‘python-ldap’ package.

sudo service autofs restart def getUserAttributes(): addUser.py “””””” If everything is configured correct- #!/usr/bin/python attrs = {} ly, you should be able to add files into import base64 attrs[‘objectClass’] = [‘in- /opt and /nethome (pending permis- import getpass etOrgPerson’, ‘organizationalP- sions) and see them on other nodes in import hashlib erson’, the cluster that are mounting the same import ldap ‘person’, ‘posixAccount’, autofs share. If AutoFS doesn’t seem import ldap.modlist as modlist ‘shadowAccount’, ‘top’] to start up when you restart the ma- import os attrs[‘cn’] = raw_input(“User chine, you can add ‘/usr/sbin/service import random Full Name: “) autofs restart’ to /etc/rc.local. import string attrs[‘uid’] = raw_ import sys input(“User uid: “) Conclusions attrs[‘uidNumber’] = raw_ Some work is required up front to # LDAP Vars input(“User uidNumber: “) make our cluster significantly more HOST=”ldap://localhost:389” attrs[‘gidNumber’] = OUSER_ scalable in the long run (and low effort LDAP_BASE = “dc=ocluster,dc=rtcom GID to maintain in particular), and unlike putingsolutions,dc=com” attrs[‘sn’] = attrs[‘cn’]. the steps and configurations shown in ADMIN_CN = “cn=admin,” + LDAP_ split(‘ ‘)[-1] our previous articles, there is a wider BASE attrs[‘userPassword’] = margin for error and a potential need PEOPLE_BASE = “ou=People,” + generateLdapPassword(getpass. for debugging. Even if you aren’t LDAP_BASE getpass(“User Password: “)) building a massive cluster, experience ADMIN_PASS = getpass. attrs[‘homeDirectory’] = ‘/ with LDAP, NFS, and AutoFS are getpass(“LDAP Admin Password:”) nethome/’ + attrs[‘uid’] often part of a Linux administrator’s attrs[‘loginShell’] = ‘/bin/ toolbelt, making this a worthwhile ef- # Group Vars bash’ fort in its own right. With these ser- OUSER_GID = “2002” attrs[‘mail’] = attrs[‘uid’] vices in place and the addition of three + “@rtcomputingsolutions.com”

ODROID MAGAZINE 10 HPC IN THE HOME ANDROID GAMING

return attrs USING CONTROLLERS def printUserAttributes(attrs): “””””” WITH ANDROID for key in attrs.keys(): CONFIGURE THEM WITH RETROARCH if key == “objectClass”: AND PLAY THOUSANDS OF GAMES print attrs[key] else: by Rob Roy print key + “= “ + attrs[key] he Xbox 360 controller works naturally with the Android and can be used to navigate menus, launch applications, and most impor- tantly, play games. I evaluated several controllers and game with def T Android running on the ODROID, including a PS3 bluetooth controller, Wiimote, generateLdapPassword(password): and an Xbox 360 Wired and Wireless controller. Out of all of the models that I “””””” tested, the Xbox 360 wireless model was the most convenient and widely compat- salt = generateSalt(6) ible gamepad available for the Android platform. m = hashlib.sha1(password) If you already have some 360 wireless controllers from an Xbox, add an Xbox m.update(salt) 360 USB receiver to connect them with the ODROID (http://amzn.to/1bJZv6q). return “{SSHA}” + base64. The wireless interface supports up to 4 controllers per receiver. b64encode(m.digest() + salt) To connect the controllers, first press the “connect” button on the USB wire- less receiver until the green light flashes. Then, press the “connect” button on the def generateSalt(size=10, controller, which is located between the left and right trigger buttons next to the chars=string.ascii_letters + charging port, directly in front of the “back” button. The 1-2-3-4 indicator will string.digits): flash its lights in a circle, and eventually flash a single light slowly to indicate that “””Generate random temporary a connection has been made. Although the controller normally stays solid when password for web user””” connected when connected to an Xbox, the 1-2-3-4 indicator light will continue return ‘’.join(random. to flash even when the controller is connected. Repeat the whole process until all controllers have been registered with the receiver. choice(chars) for x in To test whether the controllers are working, go to the Android desktop and range(size)) use the top left joystick to navigate the main menu icons, the X button to launch applications, and the B button to go back to the previous screen. The controller if __name__ == “__main__”: also works in XBMC without any additional configuration. Once the controller is addUser() responding well, you’re ready to play some games! The most versatile and full-featured console for Android is Retroarch, Things got a little out of hand when we built our which is very easy to connect with the Xbox 360 controllers. It’s one of the best own ODROID cluster in the offices. gaming emulators available on the Play Store, and includes these consoles: Atari 2600, PlayStation 1, Super Nintendo, Nintendo Entertainment System, GameBoy, GameBoy Color, GameBoy Advance, Arcade, Neo Geo Pocket, Virtual Boy, Sega Genesis/Mega Drive, Sega Master System, Quake, Doom, Sega Game Gear and more. Retroarch also allows playing up to 4 controllers, which makes for some very fun games of multi-player Mario Kart! To configure Retroarch for the Xbox 360 controllers, select “Input Options” from the Retroarch main menu, turn off the “Touchscreen Overlay”, then scroll down to “Player 1 Custom Binds”. Select each on-screen button and press the corresponding button on the 360 controller that you wish to use to control Player 1. Repeat the process for all other controllers (to a maximum of 4). After the but- tons are mapped, you can play any game system that Retroarch supports without reconfiguring the joysticks.

ODROID MAGAZINE 11 CONVERT IMAGE TO XU (MEDIUM) CONVERT AN OS IMAGE TO RUN ON AN ODROID-XU UPGRADE YOUR LINUX SOFTWARE TO MATCH YOUR SHINY NEW HARDWARE by Mauro Ribeiro

his article describes how to take a working X or U series OS Li- Tnux image, such as Ubuntu or , and convert it to run on the XU. This can be useful when upgrad- ing your own hardware to the XU, or for taking an image that is only avail- able for the previous generation of ODROID hardware and upgrading it to work with the latest ODROID models such as the XU, XU-Lite, and XU+E.

1. Download, copy or create an Ubuntu image file from an SD card or eMMC that The ODROID-XU is the top of the line in Hardkernel’s family of SBC hardware. Most of the Linux soft- is designed to run on the X or U series of ware that runs on the X and U series hardware can be converted to run on the faster XU model. ODROID hardware, such as the U3 or X2.

2. Flash the image as you normally would, 6. Inside the bootloader package by copy- partition of the SD card. to an SD card ing the boot.ini and u-boot.bin files to the SD card’s FAT32 boot partition. 10. Remove the old boot.scr file from the FAT32 partition. dd if=XXXXX.img of=/dev/sdX bs=4M cp boot.ini /media/boot/ 11. Attempt a boot, which should probably && sync cp u-boot.bin /media/boot/ work just fine. 3. Download a new bootloader and sample boot.ini file. 7. Download a kernel package for the XU. 12. Enable the HDMI driver. You may need some dependencies here, depending on wget http://builder.mdrjr.net/ your environment. wget builder.mdrjr.net/tools/ kernel-3.4/00-[...]xu.tar.xz uboot-xu.tar git clone --depth 0 https:// 4. Unpack the uboot-xu.tar file. 8. Unpack the kernel package and copy .com/hardkernel/linux.git the files to the correct directories. -b odroidxu-3.4.y odroidxu-3.4.y cd odroidxu-3.4.y/tools/hardker- tar xf uboot-xu.tar tar -Jxf odroidxu.tar.xz nel/exynos5-hwcomposer 5. Fuse the sdcard with the newer boot- sh autogen.sh loaders. 9. Copy boot/zImage to the fat partition ./configure --prefix=/usr of the SD card, then copy the lib direc- make -j5 && make install tory over top of the /lib folder of the ext4 sh fusing.sh /dev/sdX

ODROID MAGAZINE 12 CONVERT IMAGE TO XU TIPS AND TRICKS

13. Create an autostart script for exynos5-hwcomposer by creating the file /etc/init/ exynos5-hwcomposer.conf with the following content: CONTROL YOUR

description “Exynos5 HW Composer” BANDWITH KNOW YOUR start on started lightdm INTERFACE I/O STATUS

# start on runlevel [2345] by Bruno Doiche exec /usr/bin/exynos5-hwcomposer nformation on your network 14. Enable the HDMI driver. You may need some dependencies here, depending on throughput is easy as looking on your environment. I your Gnome system monitor. But what about a headless ODROID that git clone --depth 0 https://github.com/hardkernel/linux.git -b odroidxu- only has access via terminal? Fear not, 3.4.y odroidxu-3.4.y install nload and keep your network in- cd odroidxu-3.4.y/tools/hardkernel/exynos5-hwcomposer terface load on track. sh autogen.sh sudo apt-get install nload ./configure --prefix=/usr make -j5 && make install

12. Create an autostart script for exynos5-hwcomposer by creating the file /etc/init/ exynos5-hwcomposer.conf with the following content:

description “Exynos5 HW Composer”

start on started lightdm

# start on runlevel [2345] SECURITY exec /usr/bin/exynos5-hwcomposer CONTROL YOUR

15. Fix Xorg.conf by making sure your /etc/X11/xorg.conf look like this: USER ACCESS by Bruno Doiche Section “Device” identifier “FBDEV” eep your server security tight Driver “fbdev” by configuring it properly. If Option “fbdev” “/dev/fb0” Kthere is no need for a cer- EndSection tain user to access your machine via SSH, be sure to edit your /etc/ssh/

Section “Screen” sshd_config file and add the following identifier “Default Screen” strategy: Device “FBDEV” AllowUsers EndSection DenyUsers 16. Reboot. Everything should be working now! Once the image is confirmed to be running properly on the XU, make sure Why deny user access instead of to create a disk image of the working OS. If the setup doesn’t run, try repeating just deleting the user? Sometimes a user the steps with a fresh copy of the original X or U series image. If you encounter only needs SMB or FTP acess to your problems and need assistance with troubleshooting, please post your question server. This best practice gives peace on the Hardkernel forums at http://forum.odroid.com. of mind when publishing your system.

ODROID MAGAZINE 13 OS SPOTLIGHT (BEGINNER) OS SPOTLIGHT:

GameStation Turbo for the GAMESTATION U2/U3/X/X2 may be down- loaded from http://bit.ly/ VolpVL. Watch the ODROID TURBO forums at http://forum.odroid. com for updated versions, AN INSIDE VIEW OF THE POPULAR GAMING including the latest release of the PPSSPP PSX emulator! AND MEDIA CENTER IMAGE by Tobias Schaaf

ne of the biggest projects Motivation available, including the ODROID. that I am working on for the The first ARM based device that I After seeing the ODROID-X2 in an O ODROID community is the considered was actually the Open Pan- article on a German IT News page, I got ODROID GameStation Turbo im- dora, but by the time I was ready to to really hooked up to it. By the time Ubun- age, which is a Linux frontend for buy one, it was not available. However, tu was announced for the ODROID, I both games and media playback. It’s even when it came available again, it bought myself an X2. intended as an total entertainment was so expensive that I couldn’t afford However, what I wanted the Pan- system which allows you to control it. Finally, when I had enough money, dora for was to play games, and the your ODROID just by using a game I was already skeptical and was looking ODROID didn’t have too many controller in your hand, without ever into other options. games at that time (2012). As my having to touch the keyboard in order The Pandora board is an ARM-based nephews got older, I figured that I to watch movies, listen to music, or single core device with just 1GHz and could make something really nice play your favorite games. only 512MB RAM for $700, so was it for them that would grow with them For a better understanding of the really worth it? Well, although the com- as they grew. First, the ODROID usefuleness of the image, I want to munity was and continues to be awe- could be a console for playing games, give you an inside view on how the some, and it’s a fully portable device (like and later, it would function as a PC image was created, what motivation I a Nintendo DS), it was way too expen- in order to do homework and learn had, and how you can adapt it to meet sive, in my opinion, for what it could do. Linux. That was my goal and mo- your own needs. By that time there were better devices tivation for creating the image.

Baldur’s Gate is one of the PSP games that is now supported by the latest Steps to Success version of GameStation Turbo, thanks to the new release of PPSSPP. The first step towards achieving that goal was to generate content, so lots of games and emulators had to be ported to the ODROID. If you read the ODROID Forum’s Ubuntu (All Linuxes) section, you will find many games and programs there that I ported myself. It was hard work, since I went from knowing basically nothing about games or compiling software on Linux to what I know now. ODROID was a great help in learning new skills and getting better at knowing that kind of Linux stuff. Now, I know how to optimize certain programs, how to set

ODROID MAGAZINE 14 OS SPOTLIGHT different optimization flags, and when those flags are needed. I learned more about how ARM CPUs work and, espe- cially the hardware differences between the Hardkernel boards. My first project was then to port lots of games, and compile some emulators as well. If you’ve read my columns from the previous issues of ODROID Magazine, you will find lots of informations on what games are actually running on the ODROID, and it keeps getting bigger. The next big step was to make it easy, even for children, to use and work with GameStation Turbo lets you choose from a variety of emulators as well as Linux and play games. I started build- play 1080p videos, all from within XBMC using just a gamepad controller. ing Gamestation Turbo from the Linaro Ubuntu 12.04 Image. I preferred that video collection. It’s even able to down- platform, video playback was not the over all other operating systems because load preview images and covers and gave most important feature, and you still of its Unity Desktop. a short description to the games, just like could play everything that was not HD Unity is easy to use and understand video services do for movies. smoothly as long as it was 720p or lower. even for people that never used Linux Knowing this, the idea came up to For children, it generally doesn’t matter before. It might not be the best desktop use XBMC as a frontend and set it up if their favorite anime or cartoon is in environment for all applications, but it’s in a way for children to play and have HD or just SD. colorful, and easy to handle. For some- fun with, or better to say to set it up in a Well, it was about that time that a one who has never used Linux before, way that even a child could play with it. working hardware accelerated XBMC it’s a very nice way to get started with it. During that time, hardware accelerated image was released, and I was able to re- My first approach was to get the pro- XBMC and video playback was out of build the image with the necessary joy- grams easy enough to run on all system. question since it development hadn’t yet stick support. Shortly before I released I gave all applications and games that I been completed. the first version of GameStation Turbo, created a .desktop icon file, so you can The XBMC version that came with I moved over to a fully working XBMC find it in Unity or just place a short- Ubuntu 12.04 was XBMC 11 (Eden), version. cut on the desktop. This worked fine which was working, but not very fast for games, but not for emulators, since due to software decoding. Although the Included Parts emulators normally use their own file Menu was working smoothly, video play- After I decided how the image should browser interface to load the ROMs. back was not smooth. Still, it was work- work, it was important to put all the tiny Although adults might be able to handle ing well enough that I could test out the pieces together into a nicely packaged starting all of the games manually, kids Rom Collection Browser, and experi- image, and for this, some different kinds will have no clue what certain words mented with how to set everything up. of programs were necessary. mean, and it’s hard to see which games When the first image of XBMC 12 (Fro- The first priority was the Operating are available, or what to search for on do) for ODROID came out, it still did System, which had to be very stable, Unity. It was immediately clear that I not support hardware-accelerated movie easy to maintain, and with an interface needed some kind of front end in which playback, but did come with OpenGL that many people are already familiar to start the games. ES 2 support. with. The only choice here was between I had already used XBMC on an old Things got a little difficult to man- Ubuntu 12.04 and Debian Wheezy. Ev- PC that functioned as a Home Theater age around that time, since compiling ery other image was either unstable (De- PC (HTPC), and subsequently discov- Hardkernel’s XBMC didn’t bian Jessie/Sid) or wouldn’t be support- ered a nice XBMC addon called Rom work for me, and the version provided ed for very long (Ubuntu 13.04 or newly Collection Browser (RCB). RCB allows has no joystick support, which I consid- released 13.10). you to organize the emulator ROMs in ered very crucial to my plans I decided Ubuntu 12.04 is an LTS version that the same way that you can organize your that, since it was planned as a gaming is supported until 2017, which is always

ODROID MAGAZINE 15 OS SPOTLIGHT good, however, Debian Wheezy outper- was Hardkernel’s build was over 300MB, it requires the full path of where the formed Ubuntu 12.04. I also found that but mine was only 16MB of my own emulator and ROMs are located, and while developing for Debian Wheezy, build, which was achieve just by strip- what file extension is used to search for the programs were most likely to run on ping the modules. My scripts also allows ROMs. This can be rather confusing for Ubuntu 12.04 and higher without any is- users to install or uninstall kernel pack- someone that has never worked with the sue, but not the other way around. So, ages, instead of just copying the kernel Rom Collection Browser. That’s why I decided to use Debian Wheezy and directly over the existing files. I pre-selected the emulator and games, LXDE, which uses less than 150 MB and created a folder structure where the RAM even with XBMC and a couple Complications ROMs should be placed, in order for of other programs running. After that, The biggest problem for me was how the Rom Collection Browser to find the it was a question of putting together to get all the parts to work with each games. the right kind of software to turn the other, and make it easy for people to Additional emulators can be added ODROID into a gaming machine. use the image, even if they do not have by pressing the key in the Rom Collec- knowledge on how to set it all up. The tion Browser and selecting “Add a new Rom Collection Rom Collection Browser was somewhat ROM collection”. There you have to Browser difficult to use for a beginner, since you give the path to the emulator, the path I used Rom Collection Browser as had to choose the emulator, starting pa- to the ROMs, the path where it should a base to install different kind of emu- rameters and give the ROM files stan- store information and pictures and the lators such as Retoarch, , dard extension to set it up and get it to extension of the ROMs it should look PPSSPP and ScummVM. Once the ba- run. So I had to come up with a system for. sic setup was done, it turned out that not that made it rather easy for a user to deal The configuration file for ROM Col- everything was working with a gamepad with that. lection Browser is stored in out of the box, so I added antimicro There was another issue. I wanted which is able to map certain keys to a to have full Joystick (GamePad) con- /home/odroid/.xbmc/userdata/ joystick button to fill the gaps where the trol, but some emulators required keys addon_data/script.game.rom. joystick drivers did not work. as well, such as Retroarch and Mednafen collection.browser/config.xml I also maintain my own kernel builds which required the ESC-key to end the and include the header files as well, since current game and go back to XBMC, By editing this file, you can alter some parts of the kernel provided by and also MAME games which required other options as well, such as if a .zip Hardkernel did not meet my needs, and to enter an “OK” to continue. file should be extracted into a temporary header files were not included. Besides folder, and whether to look for a ROM that, there was a huge space difference Configuration inside of a .zip file (which, for example, between hardkernel’s kernel modules One problem with preconfiguring has to be deactivated for MAME games). and the one that I produced. The size the Rom Collection Browser was that If you’re experienced enough, you can even add new collections directly in this DOOM 3 shows off the graphics of the ODROID by unleashing this creature file. inside your computer, then giving you only a crowbar to defend yourself. Starting an Emulator Although starting a ROM directly through the emulator will definitely work, it has a couple of disadvantages. First of all, XBMC will still be running in the background and will use some of the resources needed for a better gam- ing experience. Second, as mentioned before, some emulators need extra keys that are not mapped to a button. If us- ing a joystick that is not supported, you need need antimicro to map the but- tons for you. If so, you need to make sure that antimicro is started when you

ODROID MAGAZINE 16 OS SPOTLIGHT need it, which might not always be the case. Directly starting antimicro along with the emulator didn’t work either. To solve these and other issues, I let XBMC run a small scriptiInstead of directly starting the emulator. In that script, the emulator is started, which then runs the ROM file which is given to the script as a command-line parameter from XBMC. That way, I can define dif- ferent steps to make sure the emulator works the best. Example: This script enables run- ning an SNES game with Retroarch: Homeworld: The pinnacle of 3D RTS with futuristic spaceships! This game #!/bin/sh is very fun, and I spent hours playing it when it first came out. /usr/bin/killall -STOP xbmc.bin if [ `ps aux | grep antimicro | of ROM you want to play, such as GBA grep -v grep | wc -l` -lt 1 ]; I wrote quite some scripts to adapt and SNES. Please check the forum post then to different circumstances. For exam- at http://bit.ly/1nVvQqz for details on antimicro --tray --pro- ple, the ScummVM and Amiga script which file extensions are supported. file /home/odroid/joydev.xml & is a little bit more complicated; but all else in all it’s pretty much always the same. Is there a way to load ROMs from an ex- /usr/bin/killall -CONT ternal storage? antimicro 1. Suspend the processes you don’t need Copy the contents of /home/ fi (for example XBMC) odroid/ROMS to your external storage /usr/local/bin/ -L / 2. Setup your environment by prepar- device and then auto-mount the exter- usr/local/share/retroarch/cores/ ing the system with the stuff you need nal device to /home/odroid/ROMS working/snes9x_next_libretro.so (for example, loading antimicro with the by adding it to /etc/fstab, or using / “$1” right profile) etc/rc.local to make it permanent. /usr/bin/killall -CONT xbmc.bin 3. Call the emulator and give it the pa-

/usr/bin/killall -STOP antimi- rameters that you think you’ll need. The What joysticks/gamepads are supported? cro “$1” represents the ROM file that is get- ting passed by XBMC as a parameter. I built the image for use with an Reading through the above code, 4. Do some clean up work and resume Xbox 360 wireless controller and Xbox you can see that XBMC is set to sus- the processes that you suspended earlier 360 wireless USB receiver. So if you pend mode, which means it won’t use All the scripts that I used for launch- have that hardware, the image should any processing power while we run our ing emulators are located in /usr/local/ work out of the box with no modifica- emulator. After that, I make a check to bin/, where you can review, improve or tion necessary, unless I forgot something again. see whether antimicro is running, and add your own scripts. either load it with the required profile Besides that, every joystick/game- file, or resume it in case it’s still running. FAQ pad that is supported by Linux should Then, I call the actual emulator. Here I Every now and then, I receive some work as well, but you will have to adapt can pass command parameters which al- questions about my image which I would settings for your device. Therefore you lows me to configure the emulator. After like to address here as a FAQ. have to change the joystick settings on the emulator is terminated by exiting the the individual emulators. Running Mednafen, you can simply emulator, XBMC is resumed and anti- Where do I have to put the ROM files for press ALT+SHIFT+1 to setup controlls micro is suspended. Just after the script my games? is completely done, it switches control Navigate to /home/odroid/ for your device. The setup program is back to XBMC. This allows for some ROMS, where you will find a structure easy to understand. The second player, cleanup work that may be necessary. of folders already created for each type if supported by emulator can be setup

ODROID MAGAZINE 17 TIPS AND TRICKS OS SPOTLIGHT

with ALT+SHIFT+2, and so on. image since it was causing issues. How- FRACTAL For Retroarch, it’s a bit more compli- ever, you can install XBMC with CEC cated. Quit XBMC, open a terminal, and support if you want from my reposi- GENERATORS type retroarch-joyconfig, then follow tory at http://oph.mdrjr.net/meveric/. the instructions on the screen. At the FOR LINUX end, you will get a long list of configu- When I exit an emulator, the XBMC win- by Rob Roy ration parameters in the Terminal win- dow is really small, how can I fix that? dow. Copy this list, then open the file If you exit XBMC and restart it again, ast month, we featured some of /home/odroid/.config/retroarch/ it will go back to fullscreen. I would ad- the mathematical applications retroarch.cfg, where you will find the vise you to “maximize” the XBMC win- Lavailable for the ODROID plat- same parameters listed. Replace the al- dow anyway to make it easier for you to form through the Ubuntu Software ready existing parameters with the ones select options. Center. Since fractals have always you got from retroach-joyconfig, and been one of my favorite branches of your device should work in retroarch. Is there an environment besides XBMC on mathematics, I tried out some of the XBMC unfortunately does not the image? fractal generator packages available support a lot of devices for joystick Yes, running behind XBMC is a through the Synaptic Package Man- support. Although Xbox 360 con- full fledged Debian distribution with ager and apt-get. trollers are working fine, others do LXDE. This means that you can in- To get started, type the following in a nothing at all. Terminal window: stall everything you want on the im- With PPSSPP, you can change the age that is available from he Debian sudo apt-get install xaos \ controller configuration within the emu- repository, and more. You can do ev- mandelbulber xmountains xfractint lator by just going into the menu. How- erything that you can do on the Ubuntu ever, on PPSSPP, the way controllers are images as well, such as web browsing, Xaos implemented is rather sluggish so only a document editing, and graphics design. Generates classic two-dimensional few really work well. In worst case, you fractals, and has a nice “Load Ran- can’t even use the keyboard anymore. How’s the XBMC and 3D performance? dom Example” button in the file since the controller settings won’t allow ODROID GameStation Turbo uses menu. You can select different you to hit certain direction keys. If that the latest Mali drivers (r4p0) that are formula from the menu and tweak happens, delete the file provided by Hardkernel, together with them to see what effect it has on the overall design. the new armsoc framebuffer drivers Mandelbulber /home/odroid/.config/ppsspp/PSP/ and Xorg patches which give very good Creates beautiful 3D fractals, just by SYSTEM/controls.ini performance. The benchmark pro- pressing the “Render” button at the top gram es2gears runs with over 250fps, of the screen. Change the fractal type and start over. If all else fails, re- and glmark2-es2 runs with over 90fps. by selecting “Fractal Formula Type” move any mappings for the control- XBMC runs full speed with 60fps and from the Fractal tab. Click on any area ler and keep the settings for Keyboard supports 1080p playback of h.264 mov- of the fractal image to zoom in and re- only, which should always work. Then, ies. It even allows vsync on movie play- calculate the view at a higher resolution. use your best buddy, antimicro! If back and will change the frequency of Make sure that your ODROID has a you use a different joystick device and your TV to match the movies frame rate. cooling fan, because this one takes a lot really have trouble getting PPSSPP While doing so it uses very little CPU of processing power! or XBMC to work with it, antimicro and RAM and outperforms the original Xmountains will work. Using antimicro, you can Lubuntu 13.10 image that I previously Draws realistic mountain ranges, map keyboard commands to a button published. with snow. There’s nothing to do ex- cept enjoy the mathematical moun- on your gamepad/joystick in the same If you have further questions about tains as they scroll by. way that you could simply map the key- GameStation Turbo, or any other inqui- Xfractint board arrow keys to your gamepads. ries about the games available for the Is a keyboard-based fractal generator ODROID, please visit the ODROID that can produce all kinds of differ- Does the image support CEC? forums at http://forum.odroid.com. ent fractals. For more information on Not initially. The image has libcec You can also find lots of pre-compiled how to set up Xfractint, visit installed which is working on HDMI 1, games in my personal repository at http://bit.ly/1s00x1x. but I removed CEC from the XBMC http://oph.mdrjr.net/meveric.

ODROID MAGAZINE 18 PORTABLE SOLAR COMPUTING (BEGINNER) PORTABLE SOLAR COMPUTING POWER YOUR ODROID USING FREE ENERGY FROM THE SUN by Rob Roy

came up with an easy project for running a computer from only sunlight, which is an inexpensive and environ- I mentally friendly way to generate electricity. The power requirementsfor even the most power-efficient laptop and desktop models of a standard PC range between 50-150 watts or more. However, the ODROID U3’s 5-10W power footprint makes it an ideal candidate for solar computing. Here’s how I set up a wireless Apache web server for my web development business that doesn’t cost me anything to run, and can be charged anywhere that has sunlight, and run for around 6 hours without needing a charge. I already owned the U3, and bought the solar parts on Amazon for around $240. The 3-panel model has enough solar cells to collect energy for the ODROID to run for about 6 hours per day with 10 hours of sunlight collection. If you only use the computer for an hour a day, you can pur- chase a smaller solar panel kit, which can bring the total cost down to around $100. You will also need a standard Android tablet USB charging cable (http://amzn.to/1mOYRr4). I used several window suction cups to attach the Goal- Zero portable solar panel (http://amzn.to/1z0RUIV) to the charging input of an EasyAcc portable power bank (http:// amzn.to/1sQ17mM) via a USB to MicroUSB cable. When- Try to get a zero ever the sun is out, the charging indicator lights on the pow- carbon footprint er bank flash at an intensity corresponding to the amount of like this with an light being received. The on/off button of the power bank X86 computer also works as a convenient remote power switch. and you are going to have to buy a To expand the system, daisy-chain several of the power huge battery! banks to each other with USB to MicroUSB cables, con- nect the last power bank to the solar array, then plug the ODROID into the first power bank. It would take about 4 of these power banks to supply enough power for a 24/7 system. Or, you can upgrade to a 12V battery and use a converter to deliver the 5V 2A USB output. If you live in a sunny part of the world, it makes sense to use the free solar energy already available to you. Plus, in the event of a giant robot attack, you can take your ODROID camping and set up a web server in the wilderness!

ODROID MAGAZINE 19 ANDROID PROGRAMMING (INTERMEDIATE) BUILDING NATIVE ANDROID APPLICATIONS WITH RED PART 2 - COMPILING AN ANDROID APP By Gregory Pecheret

o build an Android application, you can download the com- Tpressed 480MB Android SDK from android.com, which requires more than 1GB of hard drive space. On the Red Command Line Console on Android other hand, you will soon be able to download an SDK of about 1MB for the Red language instead. Even if the Choose CPU target (ENTER = de- required disk space isn’t important to fault): you, the difference in the number of 1) ARM (default) lines required to code an application is 2) x86 really significant, since it directly impacts 3) both the time required to develop, debug and => 1 maintain a project. All comparisons have limits, but if we simply consider -=== Red Compiler 0.4.1 ===- source code size, the Apache server’s source code is about 10MB while the Compiling /home/odroid/red-mas- Cheyenne source code (a commercial- ter/bridges/android/samples/eval/ grade Apache alternative written in Re- eval.red ... bol) is less than 1MB. ing? Building a user interface with ...compilation time: 637 ms If you’re already convinced about the Red will be very close to how it’s done benefit of a high semantic level program- with REBOL’s Visual Interface Dialect Compiling to native code... ming language like REBOL or Red, then (VID). Because the dialect implemen- . you might wonder how to choose between tation in Red for Android is still a work . REBOL and Red to develop an Android in progress, we can only see (for now) Verification successful app. We already know that REBOL inter- a proof of concept in which widget in- ...all done! prets the language while Red compiles it. stantiation is not wrapped. Once the steps have completed suc- In terms of user interface, REBOL has a To get started, download the zip ar- cessfully, your very first Android appli- dialect to build widgets from scratch, while chive from https://github.com/red/red. cation, written and compiled in Red, is Red will reuse existing native widgets. Launch a REBOL console and run located at: The best solution to pick will de- build.r, located at bridges/android/ home/odroid/red-master/bridges/ pend on the project. Will the applica- eval/build.r: android/builds/eval.apk tion use standard widgets only or will it The APK can then be installed on mostly display custom graphics? Which == %/home/odroid/red-master/ any Android system and executed as a one will be faster or more power sav- bridges/android/ >> do %build.r native Android application.

ODROID MAGAZINE 20 TECHNICAL ARTICLE (MEDIUM) EASY ODROID-X/X2 DUAL BOOT SWITCH BOOT FROM ANDROID OR LINUX WITH A FLICK OF A BUTTON by Rob Roy and Venkat Bommakanti

he ODROID X and X2 devic- Prepare ble. Attach the 2 wires to 2 adjacent ter- es allow for dual booting from the jumper cable minals on the sliding switch by looping T SD card or eMMC module via Take the motherboard jumper cable, them around the switch. You can care- a jumper on the motherboard. While as shown in the first photo, measure fully solder the connections if desired. the jumper is fairly accessible on the about 5-6” from the end with the jump- Then, move the tubing to complete- bare board, it may not be so easily er, and snip the cable at that point. ly cover the terminal and the exposed reached when mounted in a case. This wire. Using a hair dryer on its highest article describes a quick s cheme to setting, move the shrink wrap across create a specially purposed cable for the hot air and hold for 1-2 seconds. setting the boot selection, even if the The rubber tubing will shrink and fit X/X2 is enclosed in a case. tightly around the connection.

Requirements 1. ODROID X/X2 board, with an appropriate power adapter. 2. MicroSD Card (with an SD- Card reader/writer), containing any Android or Linux image. 3. Motherboard jumper cable: http://www.amazon.com/gp/ product/B009CWY8PA Motherboard jumper cable 4. 3-way mini slide switch: http://www.amazon.com/gp/ Then, strip about ½” from the ends of Parts to attach to cable product/B009752DE0 the two wires, exposing the metal core. 5. Heat-shrink tubing: http://www.amazon.com/gp/ product/B005W42SW2 6. Wire stripper (or use the small notch in a wire cutter blade) 7. Handheld flameless heat source such as a hair dryer Stripped cable 8. Soldering iron and solder (optional) Create Assembled special cable 9. A protective case such as the the custom cable one here (optional) Select a small piece of heat shrink Attach http://bit.ly/1jIkp3Z tubing of about 1” length that snugly new cable to X/X2 10. Superglue gel (optional) slides onto the stripped wire. Insert one Attach the newly created jumper ca- tubing into each wire of the jumper ca- ble to the appropriate jumper on the de- ODROID MAGAZINE 21 TIPS AND TRICKS OS SPOTLIGHT

vice, as shown in figures 5 and 6. In this LIQUID COOLED example, the SD/eMMC jumper is being ODROID-XU toggled, but this could also be attached to the 720/1080p jumper as well. by Rob Roy

he ODROID-XU comes with a very quiet cooling fan, but Tseveral ODROID owners have taken cooling to a whole new level! Here are some pictures of the amaz- ing systems that have been posted.

Top view of switch location

Jumper location on board To complete the project, you can mark an “U” (for Ubuntu) and “A” (for Android) on the case, based on the appropriate switch position, for easy OS selection. If you intend to use a different case design, the access to the switch may vary from what is shown here. For additional informa- tion or questions, please visit the origi- nal information sources at: The H2ODROID, which uses water cooling http:// and an extremely intricate heat sink bit.ly/1iyfB69.

Jumper cable attached

The final two photos indicate a possible location for the newly add- ed switch when a case is used. If you don’t have a case, you can in- stead use a small drop of superglue gel to attach the switch to the top of the ethernet port, where it fits very neatly. You’ll never worry about Another view of the H2ODROID losing the cap to the jumper again! Moving the switch now chooses either Examples of custom cases for the U2 and X2 the eMMC or SD card for booting.

A passive cooling option using a Zalman ZM-NBF47 heat sink with an ODROID-XU Side view of switch location on a custom case

ODROID MAGAZINE 22 REMOTE DESKTOP (BEGINNER) REMOTE DESKTOP FOR ODROID U3 USING VNC & XRDP PROTOCOLS by Stangri, Edited by Venkat Bommakanti

or a variety of reasons, it may be necessary to access the $ sudo aptitude install x11vnc desktop of a U3 remotely from another computer. A Fcommon method for access is to use the VNC (Virtual It is very likely that x11vnc is not already packaged into Network Computing) protocol to allow remote control of any the image, by default. Validate the installation by checking the computer’s desktop. This article describes VNC-based access version like so: methods used to connect to a U3 from a variety of clients such as Windows 7+, OSX and Linux. $ x11vnc --version These steps apply to the x11vnc server on installations of x11vnc: 0.9.13 lastmod: 2011-08-10 Ubuntu 13.10 or 14.04, and does not apply to other VNC serv- ers on the U3, such as TightVNCserver. Set x11vnc password

Requirements To secure the VNC access to the U3, set up a password us- 1. An ODROID U3 board, with an appropriate power ing the following command: adapter. 2. Any MicroSD card or eMMC module with a boot- $ sudo x11vnc -storepasswd {your_password_here} /etc/ able Ubuntu, Debian or similar image that includes an X x11vnc.pass Windows (X11) desktop. 3. A network where the device has access to the In- Use a strong password in this command, excluding the curly ternet and the ODROID forums. brackets { }. Then, update the access privilege for this newly 4. ssh access to the U3 via utilities like PuTTY (MS setup password file, using the command: Windows 7+) or terminal (Mac, Linux) from the remote desktop. $ sudo chmod 744 /etc/x11vnc.pass 5. TightVNC viewer 2.7.1 for Windows 7+ 6. Remmina 0.0.99.1 for Ubuntu or Debian Without this privilege change, the behavior of a VNC ses- 7. Microsoft Remote Desktop Connection for Win- sion is unpredictable. One may see issues such as a blank/ dows 7+ gray screen in the VNC viewer, VNC server crashing with an incoming connection, or other issues. Install x11vnc First access the U3 via ssh, using any SSH tool compatible Configure x11vnc with your client machine. From a Terminal session in Linux, Prior to setting up the configuration, it’s helpful to deter- the command would be: mine the display resolutions supported by the U3. Check the available resolutions using the command: $ ssh root@odroid $ xrandr On a typical Hardkernel image, the hostname of the U3 wil Screen 0: minimum 320 x 200, current 1920 x 1080, be odroid. Connecting through SSH via PuTTY will present maximum 4096 x 4096 a second command prompt from the remote machine. Using HDMI-1 connected 1920x1080+0+0 1440mm x 810mm this prompt, install x11vnc using the commands: 1920x1080 60.0*+ 30.0 1920x1080i 60.1 $ sudo aptitude update 1280x1024 60.0

ODROID MAGAZINE 23 REMOTE DESKTOP

1280x960 60.0 script 1152x864 75.0 1280x720 60.0 /usr/bin/x11vnc -forever -bg -geometry 1920x1080 1024x768 60.0 -usepw -auth /var/run/lightdm/root/:0 -display :0 1440x480i 60.1 -rfbauth /etc/x11vnc.pass -shared -gui tray -nopri- 720x480 59.9 mary -noxdamage -zeroconf -avahi -env X11VNC_AVAHI_ 640x480 60.0 NAME=odroid -o /var/log/x11vnc.log

You may want to select a different resolution depending initctl emit vnc-server-start to the monitor that is attached to the remote desktop. The 1920x1080 resolution has been chosen for this article. end script The x11vnc installation can now be configured using a con- fig file, located at: The X11VNC_AVAHI_NAME option should reflect the hostname of your U3, in case it is modified from the default /etc/init/x11vnc.conf value of odroid. Any Screen Sharing application such as the built-in Screen Sharing application in OSX or the Remmina Create this file if it’s not already there, using an editor such VNC client application for Ubuntu 14.04 can be used to view as vi, medit, or nano. For typical VNC access, the content of the U3’s desktop. the config file needs to be similar to this: Some users may find boot up issues with the gui config option. If so, you can remove the following option from your start on login-session-start config file: stop on runlevel [016] -gui tray emits vnc-server-start Also, ensure there no other VNC server instances using script Display #0.

/usr/bin/x11vnc -forever -bg -geometry 1920x1080 Run x11vnc -usepw -auth /var/run/lightdm/root/:0 -display :0 To start the x11vnc server on boot, type the following -rfbauth /etc/x11vnc.pass -shared -noprimary -o /var/ command on a single line in a Terminal window, then reboot log/x11vnc.log the U3:

initctl emit vnc-server-start $ sudo /usr/bin/x11vnc -geometry 1920x1080 -usepw -auth /var/run/lightdm/root/:0 -display :0 -forever end script -bg -rfbauth /etc/x11vnc.pass -o /var/log/x11vnc.log

Use the editor (with root privileges) to update the config After rebooting, validate that the x11vnc server is up and file. Note that the x11vnc configuration line (starting with / running by examining the x11vnc log file at: usr/bin/x11vnc) needs to be a single line. If your remote desktop happens to run OSX or Linux (for /var/log/x11vnc.log example, Ubuntu 14.04 LTS), you can access it by enabling the avahi services on the U3. It allows for easy discovery by avahi- It should reflect the vnc display information like so: aware desktops of the VNC service offered by the U3 over the local network. The x11vnc.conf file in this case would look 18/06/2014 14:11:27 Avahi group odroid established. like this: The VNC desktop is: odroid:0

start on login-session-start Note that in this case, one will have to attach to display #0 stop on runlevel [016] on odroid (i.e., display:0).

emits vnc-server-start Install XRDP Service If you wish to access the U3 desktop from a Windows 7+

ODROID MAGAZINE 24 REMOTE DESKTOP remote system, using the Microsoft Remote Desktop Connec- tion application, you will need to also install the xrdp service on the U3. Install it using the following command:

$ sudo apt-get install xrdp --no-install-recommends

Update the newly created xrdp config file to now reflect the following options:

/etc/xrdp/xrdp.ini

[globals] bitmap_cache=yes bitmap_compression=yes port=3389 TightVNC viewer login crypt_level=high channel_code=1 Then click the connect button to attach to the display and max_bpp=24 view the U3’s desktop remotely. The U3’s desktop will appear similar to what is illustrated in the U3 Desktop via TightVNC [xrdp1] Server image. name=local-xvnc-console lib=libvnc.so username=odroid password=ask ip=127.0.0.1 port=5900

The username parameter needs to reflects the default odroid user created in a clean install. If you intend to use an- other username, ensure the new username has the same group associations as the odroid account. The following command provides that group info:

$ groups odroid odroid : odroid adm dialout fax cdrom floppy tape sudo audio dip video plugdev netdev nopasswdlogin lpadmin scanner fuse U3 desktop via TightVNC viewer

To enhance security, it is useful to force the display of cli- ent-side login dialog box. The password option value of ask Remote Desktop Connection enables this option. The real password will not have to used Launch the Remote Desktop Connection application. in this config file, increasing security and allowing for one to Enter the U3’s VNC server information and fill out the change the password at will, without altering this config file at form as shown in the Remote Desktop Connection login all. screen image. In the preliminary login dialog, click on The xrdp service is a server-side add-on service, that re- Show Options to select more options. Enter all the details quires a fully functional VNC server service on the U3. in the General tab, select the Display tab and select the largest (full) screen option. Select the 24bit true color op- TightVNC Viewer on Windows tion, if applicable. Launch TightVNC Viewer and enter the U3’s VNC server On successful connection, the xrdp login screen of fig- display information as shown in the TightVNC Viewer Login ure 4 is displayed. Enter the needed vnc server password image. and click OK to proceed. Please note that the module name

ODROID MAGAZINE 25 OS SPOTLIGHT

Remmina for Ubuntu 14.04 LTS Install Remmina from the Ubuntu Software Center. Launch the Remmina Remote Desktop Client. Select the entry for the U3 and connect to it. You can also scan for the available avahi-aware services by running the command:

$ avahi-browse -all

Remote Desktop Connection login screen local-xvnc-console used in the login dialog should match the configuration entry found in xrdp.ini, as mentioned earlier.

xrdp driven login screen for Remote Desktop Connection

A successful login results in the display of the U3 desktop, similar to the one shown in the U3 Desktop via Remote Desk- top Connection image.

U3’s desktop via Remmina

For additional information or questions regarding connecting to your ODROID via VNC and XRDP, please visit the original sources at:

http://bit.ly/1qS6AWc

http://www.tightvnc.com

http://avahi.org

http://remmina.sourceforge.net

http://bit.ly/1z93Bxd

U3’s desktop via Remote Desktop Connection http://bit.ly/1mVyfF2

ODROID MAGAZINE 26 ODROID OFF-GROUND UNMANNED VEHICLE (EXPERT) ODROID POWERED OFF-ROAD UNMANNED GROUND VEHICLE! PART 2: INTERFACING WITH MOTORS AND SENSORS by Christopher D. McMurrough

n this article, we continue our series droid device com- about building an Off-Road Un- municates via USB Imanned Ground Vehicle (UGV) us- tethering, which ing the ODROID-XU hardware. Part 2 will allow it to talk gives an overview of the communication with the ODROID between the ODROID and the platform as a network peer. motor controllers and sensors, which we Finally, we will will later use in Part 3 to autonomously demonstrate the navigate to GPS way-points. The con- use of Robotic troller application runs on the Ubuntu Operating System 12.04 Robotics Edition image for the (ROS) to send and This robot runs on an ODROID-XU, is made from readily available parts, and loves rough terrain. ODROID-XU, which can be found for receive data. This modular approach download from the Hardkernel forums. will make it easier for us to extend the capabilities of our platform in the fu- the LXDE desktop environment. From Introduction ture. Example code can downloaded there, open a command window and In Part 1, we focused mostly on the from http://bit.ly/1jfykOU. type “roscore”. Hit enter, and voila, mechanical and electrical aspects of our you are now running Robot Operating robot. Now that we have a stable plat- Operating System! We will be using it later in this form to work with, we will look at setting System Setup article. up the ODROID-XU to communicate We will first set up our ODROID- with our motor controllers and sensors. XU to run Ubuntu 12.04 Robotics UGV System Architecture The motor controllers we have chosen Edition [2]. This OS image has been to use for this project are the Parallax preloaded with Robot Operating Sys- HB-25, which will be controlled by a tem (ROS) and other robotics software Teensy USB microcontroller [1]. The such as OpenCV, Point Cloud Library, Teensy accepts serial command packets and OpenNI. No extensive setup is from the ODROID-XU, which will then needed, just acquire the image from the be used to generate the necessary servo ODROID forum and copy to your SD control pulses to set the motor speeds card or EMMC module. While this se- and direction. ries specifically uses the ODROID-XU, Additionally, we will communicate robotics images are available for the X2 with an Android device (in this case, and U2/U3 as well. a Nexus 7 tablet) to acquire GPS and Once the OS image has been loaded heading data. This will allow us to con- onto your ODROID, boot up the device trol the motor speeds in order to meet with a keyboard, mouse, and monitor our navigation goals in Part 3. The An- attached. You will be taken directly to

ODROID MAGAZINE 27 ODROID OFF-GROUND UNMANNED VEHICLE (EXPERT)

the motion of the The start byte is arbitrarily defined as platform. When the byte 0xAA. The packet length, for loaded, the Teensy this packet, is defined as 0x05 (3 framing firmware will al- bytes + 2 payload bytes). The checksum low the device to is computed individually for each packet be enumerated as a based on all of the other bytes. We de- virtual serial port. fine the checksum to be the value ob- We will then write tained by “exclusive OR’ing” all of the our control pack- other bytes together, so that: ets to this port us- ing our demo ROS Packet[4] = Packet[0] xOR node. Packet[1] xOR Packet[2] xOR Packet[3] Command This UGV is smart enough to have an ODROID- Packet When the Teensy collects all of XU as its brains, which uses only a few watts Structure the packet bytes, it computes what the Serial ports facilitate the transmission checksum should be and compares it to Motor Controller of serial data, which are just chains of Packet[4]. If these two values are not Interfacing bytes. For very simple applications, such equal, then either data has been corrupt- The Teensy microcontroller is used as continuously sending a single byte val- ed or there is a conflict with the received to interface the ODROID to the HB-25 ue, an application can simply read or write byte count. Either way, this feature al- motor controllers. The HB-25 expects only the most recent byte and ignore any lows the Teensy to gracefully detect servo PPM signals, which any Arduino alignment or data validation. Most robot- and recover from an error (or stop the device (such as our Teensy) can easily ics applications require transmission of motors if necessary). While we only generate. We will connect the signal pins several bytes of data (e.g., writing com- need to transmit 2 payload bytes to the of the HB-25 to pins 20 and 21 on the mands to multiple servos), so care must be Teensy for this particular project, the ap- Teensy, and set them up as servo control taken to ensure that the receiver knows the proach can be used to send any number pins. Using the Arduino Servo library, meaning of each byte. of bytes by adjusting the packet length the motors are controlled by sending an In our example, we will define a appropriately. In your own application, integer to the “write” command. packet with a start byte, length byte, you will want to adjust the packet length The value sent to this command spec- payload, and checksum. The start byte to match the length of the data that ifies a target servo angle between 0-180 signals to the receiver that a packet is you’re going to the Unmanned Ground degrees, with 90 degrees being neutral. being transmitted. The length specifies Vehicle in order to control the motors In the case of the HB-25, a value of 0 the total length of the packet, including and sensors that you’re using. will apply no power to the motor, while the framing data, in number of bytes (to a value of 0 or 180 will apply full power support packets of variable size). The Microcontroller to the motor in either direction. As the payload consists of 2 bytes for the mo- Firmware values deviate from 90 toward 0 or 180, tor commands, and the checksum pro- The Arduino microcontroller firm- the motor will be supplied with more vides a validation mechanism for the ware is included in the “ugv” folder of power and will begin to spin faster. Teensy. The resulting packet structure the example code mentioned earlier. To By writing an integer to either out- then looks like this: use the firmware, simply compile and put pin using the Servo library, we can Packet[0] flash the file “teensy_firmware.ino” us- independently control the speed and Packet[1] ing the Arduino IDE by following the direction of the motors. The next task Packet[2] instructions found on the Teensy web- will be to establish communication with Packet[3] site [1]. Once the firmware has been in- the ODROID using serial data packets. Packet[4] stalled, you will be ready to execute the The ODROID will transmit a single Start byte demo. Note that the appropriate udev packet of data to encapsulate our two Packet length rules must be installed on the ODROID control bytes. These packets will be sent Payload byte 1 in order for the application to be able to continuously at a rate of 20 Hz, so that Payload byte 2 open the serial connection to the Teensy the ODROID can smoothly control Checksum without using the “sudo” command.

ODROID MAGAZINE 28 ODROID OFF-GROUND UNMANNED VEHICLE (EXPERT) TIPS AND TRICKS

Motor Controller we can use for our navigation tasks. ROS Interface CHANGE YOUR Included in our example code is an Conclusion ROS node that will connect to the speci- We now have all of the key software HEARTBEAT fied serial port, and assemble properly components to access our motors and CONTROLLING THE formatted packets as specified. This sensors, and have linked everything into ALIVE LED ON THE U3 node subscribes to ROS “twist” mes- ROS, which will make it easier for us to sages, which are the standard method develop our application software. In by Mauro Ribeiro of specifying the desired velocity of a Part 3, we will input target GPS coordi- robot. In our case, we only care about nates into ROS, compute the necessary hanging the behavior of the the forward linear velocity and rotation. motion trajectory, and issue the appro- external blue alive LED on the The rotation allows us to compute the priate motor control commands to reach C ODROID-U3 is easily done relative amount of power to supply to the goal. We will then write additional with a single Linux BASH script com- mand. Type any of the following in the left/right motors, which the linear high-level ROS nodes for command and the Linux Terminal window: velocity sets the overall speed. Part 3 control, and finally, test the system in an will go into more details about calculat- outdoor setting. 1. Completely disable the alive led. ing appropriate motor speeds, but for $ echo none > \ now, we just want to run the ROS node References /sys/class/leds/led1/trigger and verify that the USB serial port opens properly. It may be necessary to change [1] P. Stroffregen, “Teensy USB De- 2. Stay solid (non-blinking): the /dev/ttyUSB port name to match velopment Board,” PJRC Electronics, $ echo default-on > \ your configuration. 2014. /sys/class/leds/led1/trigger http://www.pjrc.com/ teensy/ 3. Show the eMMC activity: [2] C. McMurrough, “Ubun- Navigation Data $ echo mmc1 > \ Our system uses navigation data tu 12.04 Robotics Edition v1 /sys/class/leds/led1/trigger from an Android tablet for motion plan- (ROS+OpenCV+OpenNI+PCL) ning. To do this, we must first establish XU,” ODROID Forum, 2014. 4. Show the SD activity: http://forum.odroid.com/view- $ a connection between the tablet and echo mmc0 > \ /sys/class/leds/led1/trigger ODROID, and link this data to ROS. topic.php?f=61&t=5216 [3] C. McMurrough, “Odroid Luckily, this is fairly easy to do using the Code Examples and Support Files,” 5. Make it blink a custom pattern: “ROS Android Sensors Driver” Android GitHub, 2013. $ echo timer > \ https://github. /sys/class/leds/led1/trigger app [4]. Once this app is installed on the com/cmcmurrough/odroid-devel- Android device, the GPS, accelerometer, $ echo 1000 > \ opment /sys/class/leds/led1/delay_on and compass data are then published to [4] C. Rockey, “Ros Android Sensors $ echo 1000 > \ a ROS master at the specified IP ad- /sys/class/leds/led1/delay_off Driver,” http://wiki.ros.org/ dress. By connecting the tablet to the android_sensors_driver/ The last example lets you specify how ODROID via USB and enabling teth- many milliseconds the light should ering, the Android and ODROID will stay in each state. You can also use the heartbeat LED to signal other then be placed on the same network and We followed the instructions, but our UGV looks much different than the one Chris built activity. For example, you can track can communicate via IP. It is important SSH activity by monitoring the IP to note that the android_sensors_driver tables by typing the following in a Linux terminal window as root: ROS package must also be installed in order to receive the app’s broadcast data. $ iptables -A INPUT -p tcp \ Once the tablet is tethered, run the --dport 22 -j LED \ --led-trigger-id ssh \ command line program roscore on the --led-delay 1000 ROS host, then start the android_sen- $ echo netfilter-ssh > \ sors_driver programs on the Android /sys/class/leds/led1/trigger tablet. Enter the IP address and port To make the change permanent, of roscore into the Android app, and hit add the line to the file/etc/rc.local, connect. The published GPS and iner- and the new blue LED pattern will tial data are shown as ROS topics, which take effect after the next reboot.

ODROID MAGAZINE 29 ODROID WEATHER BOARD ODROID WEATHER BOARD INTELLIGENT WEATHER MONITORING ON YOUR ODROID by Justin Lee

he Weather Board is an easy-to- use ODROID-SHOW addon T that gives you access to UV Index, barometric pressure, altitude, relative hu- midity, illumination and temperature mea- surements. Its dimensions are only 20 x 20mm, and comes with a 6-pin connector for the ODROID-SHOW. The board reports the Si7020 humidity, BMP180 barometric pressure, and Si1132 Ultraviolet (UV) Index with ambient light sensors, and relies on some sensor-orient- ed Arduino libraries. All the sensor data goes though I2C communication between sensor ICs and ATMEGA328P MCU on the ODROID-SHOW. The Weather Board is your personal tool for de- mental data, like a weather station does. termining whether it’s safe to go outside, or just stay inside and work on an ODROID project.

lar). You can also connect 3-4 Alkaline or NiMH/NiCD batteries if you want to build a portable device. Finally, launch a copy of Arduino IDE, which is available for installation from Synaptic Package Manager or Ubuntu Software Center.

Firmware setup The Internal architecture of each sensor Download the sketch file and libraries from http://bit.ly/1iuz4VK, then open Weatherboard block diagram the weather_board.ino sketch file using Hardware setup Arduino, which is located at Connect your Weather Board to the

With a few batteries, you can make a ODROID-SHOW, then connect a micro- ODROID-SHOW/firmware/ portable outdoor weather data capture USB cable to your host PC or ODROID weather_board/weather_board.ino system. You can also connect it to your Linux board. If the connection is estab- host PC or ODROID via the ODROID- lished, you will see a new device appear SHOW in order to log various environ- Select “Preferences” in the Arduino called /dev/ttyUSB0 (or something simi- IDE File menu and choose ODROID-

ODROID MAGAZINE 30 ODROID WEATHER BOARD

Another view of the Weather Board on a U3.

SHOW as the sketch folder. Add the li- braries by selecting Import library->Add 7. Add C:\qwt-6.1.0\lib to A -based GUI application program can mon- itor and show the weather data graphically. library and choosing ODROID-SHOW/ your systems path variable (qwtd. libraries. Before building and uploading dll is located here) the sketch file, the jumper cap, which is 8. Download the PC Applica- near the reset button, must be installed. tion source code at http://bit. A host PC or ODROID can log the ly/1pgo0yf. data as well as display it graphically in real- 9. Build the weather_board ap- time. For our example, we used the QT plication using qmake: programming language. The ODROID Weather Board may be # cd qt_weather purchased at http://bit.ly/1wtPdgP. # qmake # make –f MakeFile.Release Build the Qt # qmake Application # make –f MakeFile.Release for Windows Build the Qt 1. Download and install Qt Application 4.8.4(MinGW) version at http:// for Ubuntu Weather Board block diagram using bit.ly/1nAxheV (ODROID or x86) ODROID-SHOW 2. Add C:\Qt\4.8.4\bin to our systems path variable (qmake.exe is 1. Install packages located here) 3. Add C:\MinGW\bin to your # sudo apt-get install qt4-de- systems path variable (mingw32- fault qt4-designer libqwt-dev make.exe. is located here) 4. Download and extract qwt-6- 2. Build the weather_board app .1.0 at http://bit.ly/1quAoaY. 5. Copy the qwt-6.1.0 to C:\ # git clone https://github.com/ qwt-6.1.0 hardkernel/ODROID-SHOW/qt_weather 6. Open a command line (cmd) # cd qt_weather and navigate to “C:\qwt-6.1.0”: # qmake # make # cd C:\qwt-6.1.0 # uic weather_board.ui > ui_ # qmake weather_board.h # make # qmake # make install # make # qmake -set QMAKEFEATURES C:\ # cd linux Be a hero and save your village with a qwt-6.1.0\features # ./weather_board Weather Board and U3 portable station. ODROID MAGAZINE 31 MEET AN ODROIDIAN MEET AN ODROIDIAN DENIS ODINTSOV (@OVERSUN) BLACK BELT PROGRAMMER AND XBMC EXPERT by Rob Roy

Please tell us a little about yourself. My name is Denis Odintsov. I’m from Russia and living in Poland, work- ing for a US company called Cisco Sys- tems. As for my interests, I love com- puter games, books, quiet places, clean air and good food. Although it sounds a bit autistic, these are the things that in- terest me at the age of 34.

How did you get started with computers? To draw a little picture of how long I’ve been with computers, I can say that I remember an article that talked about Although Denis ended up with a XU case that no longer is able to close, in the purest ODROIDian spirit, the invention of a technology that should he managed to custom his own board using a fanless heatsink for total silent operation! change the world called the “world wide web”. Yes, I read it in a paper maga- “something faster” without any knowl- type of experiences have you had while porting zine! I didn’t have a computer at that edge about the ARM world and all the the popular media center to the ODROID? time, that was too long ago, but I was differences. Really, I just bought some- All the people who have been with interested for sure. I received my first thing as small, but with more Mhz. And, ODROID long enough can remember computer a short time afterwards which at that point, I must say ODROID was the Linux situation at that time: XBMC was a cutting edge 25Mhz Intel 286 from the only and natural choice. I think that 11 was a stable version but was obsolete, the early nineties. I can’t remember the the beauty of the U2 is unbeatable still, and XBMC 12 was showing only a black exact date right now, that’s how young I as inside as well for the outside design. screen. But the beauty of Linux is that was and what a long time ago. It’s the most perfect piece of hardware everything has sources. The hardware But enough with dusty stories, the that I have in my possession. supported 3D acceleration, and there more interesting thing would be: how I And then came the real truth, which were a few GL demos for that. What I started with ODROIDs. Basically I can is actually the most amazing part of the did was just connect the dots. I stream- tell that I already saw this kind of story story: I just found out that I cannot take lined the display initialization used in the before, since I had a Raspberry pi, and something that was compiled to run on GL demos to XBMC 12, and it started I loved it much. It was as a small me- the Raspberry Pi and install it on another right up and ran smooth! It took probably center that didn’t buzz, blinks or oc- ARM board (don’t laugh!). That was like a week of my time after work to port 500 cupy an entire drawer. That was actually a cold shower for a guy who only knew lines of code from one program to other so amazing, because I was into the PC the x86 world. Luckily, there was already program. Not a challenging job at all. world before 2012, and couldn’t even a Linux distro running, and that was my And then the second part of my imagine such a thing back then. The turf. If something can run Linux, I can XBMC experience began: the whole only problem for me was the speed of deal with it. new world of hardware that doesn’t the menus. The Pi was sluggish. even exist in the x86 architecture. It re- So, as a long time x86 user I just You’ve been one of the main community de- ally took days for me to understand that, went onto the great Internet and bought velopers for XBMC for over a year. What in the ARM world, it’s a whole different ODROID MAGAZINE 32 MEET AN ODROIDIAN story to be able to decode a video suc- cessfully. And so the challenge began. Looking back right now, I can see the funny thing is that probably, the code that would eventually work was ready in a couple of weeks. However, there was an annoying Mali bug on the 3.8 kernel that was making the GPU redraw the whole screen at 6-10 frames per second (FPS). And nobody really knew what was the problem. I spent literally days under- standing how things worked, inside and out, to understand why the video output was so slow, thinking it was somewhere in the hardware decoding. This activity probably contributed to my program- mer knowledge building more than at any other time during the previous few years. I’m not a real programmer, actually, since my area of knowledge is mostly Our man Denis enjoying a quiet moment at the troubleshooting and systems design. Pro- Beach. I like programming for Apple devices gramming is a hobby for me. And here is lately, it gives me some fun. iOS has its blacks and whites and doesn’t give you as the part I want to underline most: I don’t is open, it is amazingly documented, and much vast freedom as Linux can give, but think that most my biggest contribution gives you everything to control by your it is convenient and can be profitable. was the code that allowed XBMC to run fingertips. Just choose a task, open a on ODROIDs successfully. I honestly text editor and go ahead! At the very What type of hardware innovations would think that was the effect that my work first difficulty that you have, even if it you like to see for future ODROIDs? had on the ODROID community. is the very first line of your program, The last time that I went to the I remember how small and enthusi- just google it, and you will see hundreds ODROID site, I found some absolutely astic the forum was in the beginning of of pages of answers. Create small pro- amazing things - like the UPS board! 2013, and I can see how big and power- grams that can’t do anything except crash Way to go, Hardkernel, this is really awe- ful it has become now. And I’m proud badly, create small programs that do silly some! So, the only thing that I probably to think that, my humble efforts to run things, and at some point you find your- would be thinking of now is a GPS/ XBMC may have encouraged people self capable of programming anything GSM module, because I use my U2 as a to buy more hardware pieces, and also that you want for yourself. And shortly GSM gate. As for the chips themselves, attracted people who really know how after, you would find that some things anything supported well in Linux would to program. I can see that the code I that you create are wanted by thousands do. Hardkernel is making great boards - wrote, taken by people for whom pro- people around the world as well. It is small, solid and beautiful. gramming is more than a hobby, evolved really that simple. into amazing things from the plain and simple source. And from that point they What other hobbies and interests do you An ODROID’s job never ends! Using the U2 as a already went far beyond, where I’m not have? GSM gate is a THE way to do a personal cloud. even a mere help for those programmers Fitness, books, creating things… be- anymore. And that is the real achieve- ing happy is probably the most common ment for me here, and that thing I’m description of the only hobby I have. most proud of. Sometimes it is because of places where I am, sometimes it is because of people How did you become an expert in Linux that I meet, and sometimes it is because development? of things I do and the effect that it has. When can it be easier to become an expert in development than when you Are you involved with any other software or have the internet at your hands? Linux hardware projects? ODROID MAGAZINE 33