Android Auto

Install the ubuntu 16.04 Mate

Available with the ubuntu64-16.04.3-mate or higher.
The article is based on the ubuntu64-16.04.3-mate. (v2.2)
The Android Auto is works well on both ODROID-C2 and ODROID-C1+.

Install dependencies

Before installing the Audio Auto, you should install the dependency packages.

$ sudo apt-get update && sudo apt-get upgrade
$ sudo apt-get install -y git-core curl dh-autoreconf libboost-all-dev libusb-1.0.0-dev libssl-dev cmake libqt5multimedia5 libqt5multimedia5-plugins libqt5multimediawidgets5 qtmultimedia5-dev libqt5bluetooth5 libqt5bluetooth5-bin qtconnectivity5-dev pulseaudio gstreamer1.0-plugins-bad gst123 librtaudio-dev

Set auto login

the script make the odroid account automatic login after each booting.

$ sudo vi /usr/share/lightdm/lightdm.conf.d/60-lightdm-gtk-greeter.conf
[Seat:*]
greeter-session=lightdm-gtk-greeter
autologin-user=odroid

Install the android auto

To use the android auto, you has to install the OpenAuto. For OpenAuto, you should install the aasdk. the aasdk also need the protocol-buffers.

update compiler for the protocol buffers

Before update compiler please check the version of the GCC compiler.
The version of GCC should more then 6.

$ gcc -v                                                     
Using built-in specs.                                                         
COLLECT_GCC=gcc                                                               
COLLECT_LTO_WRAPPER=/usr/lib/gcc/aarch64-linux-gnu/5/lto-wrapper             
Target: aarch64-linux-gnu                                                     
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-arm64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-arm64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-arm64 --with-arch-directory=aarch64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-multiarch --enable-fix-cortex-a53-843419 --disable-werror --enable-checking=release --build=aarch64-linux-gnu --host=aarch64-linux-gnu --target=aarch64-linux-gnu               
Thread model: posix                                                           
gcc version 5.4.0 20160609 (Ubuntu/Linaro 5.4.0-6ubuntu1~16.04.9)   

Update gcc

Please Add repository via add-apt-repository commands. and install the gcc-6 and etc.

$ sudo apt update
$ sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
$ sudo apt update
$ sudo apt install gcc-snapshot -y
$ sudo apt update
$ sudo apt install gcc-6 g++-6 -y
$ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-6 60 --slave /usr/bin/g++ g++ /usr/bin/g++-6
$ sudo update-alternatives --config gcc

After install you can see the updated GCC.

$ gcc -v                                                     
Using built-in specs.                                                         
COLLECT_GCC=gcc                                                               
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabihf/6/lto-wrapper           
Target: arm-linux-gnueabihf                                                   
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 6.3.0-18ub
untu2~16.04' --with-bugurl=file:///usr/share/doc/gcc-6/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-6
 --program-prefix=arm-linux-gnueabihf- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-libitm --disable-libquadmath --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-6-armhf/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-6-armhf --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-6-armhf --with-arch-directory=arm --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --enable-multilib --disable-sjlj-exceptions --with-arch=armv7-a --with-fpu=vfpv3-d16 --with-float=hard --with-mode=thumb --disable-werror --enable-multilib --enable-checking=release --build=arm-linux-gnueabihf --host=arm-linux-gnueabihf --target=arm-linux-gnueabihf
Thread model: posix                                                           
gcc version 6.3.0 20170519 (Ubuntu/Linaro 6.3.0-18ubuntu2~16.04)             

build protobuf-compiler(3.0)

get protobuf-compiler source

$ wget https://github.com/google/protobuf/archive/v3.0.0.zip
$ unzip v3.0.0.zip
$ cd protobuf-3.0.0

fix autogen.sh

Change the Google Mock packages. to google test packages.

$ vi autogen.sh
.
.
. (:32)
if test ! -e gmock; then
 curl $curlopts -L -O https://github.com/google/googletest/archive/release-1.7.0.zip
 unzip -q release-1.7.0.zip
 rm release-1.7.0.zip
 mkdir -p gmock/gtest
 mv googletest-release-1.7.0 gmock/gtest
fi
.
.
.

build protocol-buffers

If you used ODROID-C2, you can add option “-j4”.
but on ODROID-C1+, you should avoid the option due to lower system memory size.

$ ./autogen.sh
$ ./configure --prefix=/usr/lib/arm-linux-gnueabihf/
$ make [-j4]
$ sudo make install
$ sudo ldconfig
$ export PATH=/usr/lib/arm-linux-gnueabihf/bin/:$PATH

build aasdk

About the make option like “-j” is same the above one.
Please follow behind.

$ cd
$ git clone -b master https://github.com/f1xpl/aasdk.git
$ mkdir aasdk_build
$ cd aasdk_build
$ cmake -DCMAKE_BUILD_TYPE=Release ../aasdk
$ make [-j4]

build openauto

Build & install the open auto.

$ cd
$ git clone -b master https://github.com/f1xpl/openauto.git
$ mkdir openauto_build
$ cd openauto_build
$ cmake -DCMAKE_BUILD_TYPE=Release -DRPI3_BUILD=FALSE -DAASDK_INCLUDE_DIRS="/home/odroid/aasdk/include" -DAASDK_LIBRARIES="/home/odroid/aasdk/lib/libaasdk.so" -DAASDK_PROTO_INCLUDE_DIRS="/home/odroid/aasdk_build" -DAASDK_PROTO_LIBRARIES="/home/odroid/aasdk/lib/libaasdk_proto.so" ../openauto
$ make [-j4]

Make autostart!

$ echo "./openauto/bin/autoapp &" >> .bashrc

Add account to group

To solve account permission problem, set the user group.

$ sudo usermod -a -G root odroid
$ sudo usermod -a -G tty odroid
$ sudo usermod -a -G voice odroid
$ sudo usermod -a -G input odroid
$ sudo usermod -a -G audio odroid
$ sudo usermod -a -G pulse odroid
$ sudo usermod -a -G pulse-access odroid

After reboot, you can see the Android auto ready screen at booting.


Edit boot.ini for ODROID-VU7

To use ODROID-VU7, edit the boot.ini files. you should edit resolution and vout_mode options.
ODROID-VU7 has 800×480 60hz, and DVI mode.

$ sudo vi /media/boot/boot.ini
# setenv m "576p"               # 720x576
setenv m "800x480p60hz"         # 800x480
# setenv m "800x600p60hz"       # 800x600
# setenv m "1024x600p60hz"      # 1024x600
# setenv m "1024x768p60hz"      # 1024x768
# setenv m "1360x768p60hz"      # 1360x768
# setenv m "1440x900p60hz"      # 1440x900
# setenv m "1600x900p60hz"      # 1600x900
# setenv m "1680x1050p60hz"     # 1680x1050
# setenv m "720p"               # 720p 1280x720
# setenv m "800p"               # 1280x800
# setenv m "sxga"               # 1280x1024
# setenv m "1080i50hz"          # 1080I@50Hz
# setenv m "1080p24hz"          # 1080P@24Hz
# setenv m "1080p50hz"          # 1080P@50Hz
# setenv m "1080p"                # 1080P@60Hz
# setenv m "1920x1200"          # 1920x1200

# HDMI DVI Mode Configuration
# setenv vout_mode "hdmi"
setenv vout_mode "dvi"
# setenv vout_mode "vga"

Mount Smart Power 2

This is an optional device. You can use other 5V/3A PSU.
SmartPower2

You can communicate with the smartpower2 via WiFi. and it has auto run function.

Auto Run - Output power ON/OFF automatically when you power on the SmartPower2.

We check the Auto Run option.
And connect smartpower2 from Cigarette Lighter Power Adapter as input power and to ODROID-C1+ as output.

Mount Stereo Boom Bonnet

Stereo Boom Bonnet
If you have to load the driver every time whenever your ODROID-C1+/C2 starts, simply you can by registering the driver into /etc/modules
more details

odroid@odroid64:~$ su
Password:  /* root password is "odroid" */
root@odroid64:/home/odroid# echo "snd-soc-pcm5102" >> /etc/modules
root@odroid64:/home/odroid# echo "snd-soc-odroid-dac" >> /etc/modules
root@odroid64:/home/odroid# exit
exit
odroid@odroid64:~$ 

And you have to select output to ODROID-DAC Analog stereo.
System » Preferences » Hardware » Sound » Output
Select Output : ODROID-DAC Analog Stereo


Please check connector!

Make Power button

Using the Keypads on the TFT LCD

The Android Auto system can be shutdown by power off the car system. but we hope another options.
So we add shutdown power button. TO make it work, change the key mapping.

Change from KEY_UP to KEY_POWER.

    {   PORT_KEY1, HIGH, KEY_UP, KEY_RELEASE },
$ sudo vi /etc/rc.logcal
 
# By default this script does nothing.
sudo /home/odroid/tftlcd_key &

if [ -f /aafirstboot ]; then /aafirstboot start ; fi

Now connect the power button to the GPIO Expansion Connectors J2.
We used Pin 6 and Pin 12.

And mapping a shutdown action.
System » Preferences » Hardware » Power Management » General
“When power button is pressed: Shutdown”

Mount USB Microphones

To use “Ok, Google”, you also need USB microphone.

And set the input to usb device.
System » Preferences » Hardware » Sound » Input

Select Input : USB PnP Sound Device Analog Mono

All attachment is mounted to the ODROID-VU7.
You can add another decoration or more good positioning.

We install the Android auto device to car.
It works fine. After start up, Android Auto automatically ready to connect your Android device.
After connect your android device to Android auto, the Android auto detect your device and you can use it.