Odroid-XU4 ZoneMinder Client




Welcome to another adventure with ZoneMinder on small computing devices. Today I will walk you through configuring an Odroid-XU4 as an unattended ZoneMinder client. The goal is to have the XU4 boot Android, auto-start zmNinja, and then proceed straight into full screen montage mode with no user intervention. Maximum Wife Acceptance Factor (WAF) can be achieved!

I briefly described the XU4 hardware in a previous blog. Check it out if you are not yet familiar with this particular single board arm computer.

Requirements

  • Odroid-XU4 from ameriDroid
  • 5v Power supply from ameriDroid
  • A good quality sd card or eMMC module
  • Your monitor of choice and an hdmi cable
  • USB keyboard and mouse for initial programming
  • A known good USB sd card reader like the Transcend RDF5
  • Etcher image writer
  • XU4 Android 7.1 image courtesy of Odroid forum user Voodik
  • A spare Windows or Linux PC to download and write the Android image
  • zmNinja and Auto Start apps from the Google Play Store
  • A working ZoneMinder surveillance system, running on some other PC


Install Android

The first thing you must do is install Android onto an sd card. Head over to this thread in the Odroid forum for instructions. Read all the instructions in the first post. As of this writing, the current url to download the most recent Android 7 image is as follows:
https://oph.mdrjr.net/voodik/5422/ODROID-XU3/Android/lineage-14.1/Alpha-1.8_15.04.18/
Open this URL in your browser and note there are a few choices to choose from. Since I am doing a fresh install onto an sd card, rather than an emmc module, I downloaded the following files to my PC:
android-lineage-14.1-alpha-1.8-sd_installer-odroidxu3-2018-04-15.img.zip
android-lineage-14.1-alpha-1.8-sd_installer-odroidxu3-2018-04-15.img.zip.md5sum
Once both files are downloaded, verify its checksum:
md5sum -c android-lineage-14.1-alpha-1.8-sd_installer-odroidxu3-2018-04-15.img.zip.md5sum
If the check fails then try the download again.

Now write the image to the sd card using the Etcher application and your USB card reader.

Alternatively, you can write the image from a Linux command line like so:
sudo umount /dev/sdX*
unzip -p android-lineage-14.1-alpha-1.8-sd_installer-odroidxu3-2018-04-15.img.zip | sudo dd of=/dev/sdX bs=4M
sudo sync

The value X represents the device name as it appears on your system.

First Boot

After the Android image has been written to the sd card, remove it from the USB card reader and insert it into the XU4. Power up the XU4 then wait. Per the instructions in the Odroid forum thread, the monitor will not power on until the initial boot process has finished, which can take up to 20 minutes. Wait patiently.

When the initial boot up has finished, you should be looking at a LineageOS initial setup wizard. Go through each step, following the instructions. You should end up at an Android desktop. Link the Google Play store to your gmail account.

Configure Android

Here are some tweaks to the operating system, which I found to be helpful.

The default resolution is 720p. Use the pre-installed Odroid Utility app to bump up the resolution to the highest supported by your monitor:
Odroid Utility → Screen → Select an appropriate resolution from the drop-down
CAUTION: The Odroid utility does not verify the selection you make. Make double sure the resolution and refresh rate you choose are compatible with your monitor! Otherwise, you will boot into a blank screen.
Before closing the Odroid Utility, disable the Power Menu when the XU4 power button is pressed:
Odroid Utility → Misc → Toggle Force Shutdown without Dialog
→ Reboot (button)
Turn off the virtual keyboard:
Settings → Languages & Input → Current Keyboard
→ Untoggle Show Virtual Keyboard
Set the Android navigation bar to auto-hide:
Settings → Display → Expanded Desktop → Expanded desktop style → Hide Both
NOTE: This change is global. If desired, there appears to be a way to hide the navigation bar on a per-app basis by toggling off the Expanded Desktop. 

Install the zmNinja app

From the Google Play Store, install the zmNinja app.
REMINDER: This blog assumes you already have a working ZoneMinder system and can successfully view all your cameras from a traditional web client. Do not proceed further until this is the case.
Start zmNinja and follow the configuration wizard. It will step you through pointing your client to your existing ZoneMinder server. Do not proceed further until you can successfully view your cameras from zmNinja. If you do run into problems, a good place to start is to read the zmNinja FAQ.

Once you can view all your cameras in zmNinja, click the Montage button to view all cameras simultaneously. With montage up, adjust each camera size and the overall layout to your liking, using the controls presented to you.

Refer to the screenshot to see a typical first-time run of Montage. All the cameras are there, but they likely won't quite line up the way you want. In the screenshot below, I numbered the buttons I used to organize Montage the way I wanted. See below for a general description of each numbered button.


Configure Montage
  1. Click the down pointing chevron to expand the menu.
  2. If the cameras are too small, click this button to enlarge them.
  3. If the cameras are too large, click this button to scale them down.
  4. Click this button to move the cameras around on the layout.
  5. Click this button to eliminate the gray areas between the cameras.
  6. Click this button to enter full screen.
  7. When finished, click this button to save the Montage profile

There are other tricks you can do to further organize montage. For example, clicking button 4 and then selecting a monitor allows you to shrink or enlarge a single monitor, rather than all of them. I'm sure there are other zmNinja secrets I have not yet discovered.

Fullscreen Montage After Organizing the Cameras

zmNinja automatically remembers the mode you had it in previously. Consequently, if you take care to always exit the app while in Montage, zmNinja will go back to Montage automatically the next time you start it. Remember this.

Install the Auto Start app

From the Google Play Store, install the Auto Start app.

Now start the Auto Start app. Configure it to auto start zmNinja on boot by clicking ADD and selecting zmNinja from the list. That is all there is to this app. Pretty simple, right?

Finish Up

Reboot the XU4 from the Android navigation bar. Verify it boots up and starts zmNinja all on it's own. You can remove the keyboard and/or mouse now. To completely shutdown the Odroid, just press and hold the power button for a couple seconds. That's it!

Alternate Operating Systems

During my proof-of-concept phase, I considered or tried different operating systems to achieve the same result just described. I will very briefly describe these alternate operating systems.

  • Armbian - I did in fact setup the desktop version of zmNinja on the XU4, running Armbian (a.k.a. Debian Jessie). It did work. However, removing the border around the zmNinja application and the desktop menubar took some research. It also took a little extra effort to force the app to start fullscreen. Additionally, the amount of cpu resources consumed was significantly higher (2-3 times). I didn't expect this, but there it was sucking up far more cpu than Android.
  • Android 4.4 - I also briefly tested this on Android 4.4. In order to auto-hide the Android navigation bar, I had to install another app since that function is not integrated into the operating system. If I recall correctly, everything else worked the same as Android 7.
  • Android 8 - You may have noticed that Voodik also has Android 8 images available for the XU4. After reading through the Android 7 and Android 8 threads, it became apparent that the Android 7 images have received more testing and appear to be more stable. Consequently, I chose to stay with Android 7.

In my opinion, the best experience at the time of this writing is the one described in this blog using the Android 7.1 image from Voodik. I only mention these alternate configurations to give you options. Perhaps you may want to explore these alternates further than I did.

Troubleshooting & Notes

Here are some additional notes that may be helpful.
  • If your sd card fails to boot the first time, try replacing either or both the sd card or USB card reader. Reading through the Android 7 forum thread, users have reported that not all are created equal. Sumsung EVO sd cards and the Trascend RDF5 reader mentioned earlier are a known good combination.
  • Don't use a power switch like this one. In my case, the switch created enough of a voltage drop to cause the XU4 to spontaneously reboot under load. Doh!
  • If the Odroid XU4 never appears to finish the initial boot up process, even after 20 minutes, then it may have gone into a boot loop. The only way to confirm that is to use this usb uart module. Also, see the previous bullet point about known good sd cards & USB readers. If you can collect your boot log using the uart module, posting it in the Odroid forum may get you some help.

Credit

Odroid forum user Voodik has put a lot of work into making it a relatively simple process to install a modern version of Android on an Odroid XU4. Who says Russian hackers are all up to no good, huh? I highly recommend you log into the Odroid forum and personally thank him for all the work he has done and continues to perform. This is the open source community at its finest.

Credit also goes to Asker a.k.a. Pliable Pixels for taking up the zmNinja torch. The core developers of ZoneMinder simply did not have the resources to develop a modern app from scratch. We are beyond thankful he stepped up and made such an awesome app.