Android Auto: Take Your ODROID On The Road

Android Auto

Android Auto is a Google application that allows an ODROID-C2/C1+ to function as an in-dash car computer to support navigation, audio, and hands-free operation. Video instructions are available on the YouTube video, “[ODROID/Android Auto]chip car head unit“. The application runs inside Linux using the OpenAuto application.

Figure 1
Figure 1

Figure 2
Figure 2

Materials

Figure 3 - We prepared two buttons for use as a shut-down switch. For this project, we used the bigger button
Figure 3 – We prepared two buttons for use as a shut-down switch. For this project, we used the bigger button

Figure 4 - We prepared two buttons for use as a shut-down switch. For this project, we used the bigger button
Figure 4 – We prepared two buttons for use as a shut-down switch. For this project, we used the bigger button

Figure 5 - We used a cigarette lighter power adapter as power supply
Figure 5 – We used a cigarette lighter power adapter as power supply

Figure 6 - To connect the power adapter to SmartPower2, we changed the connector to a 5.5mm L type cable
Figure 6 – To connect the power adapter to SmartPower2, we changed the connector to a 5.5mm L type cable

Software

This project is based on ubuntu64-16.04.3-mate, version 2.2. Android Auto works well on both the ODROID-C2 and the 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
The following script will automatically log into the Android account after each boot:
$ sudo vi /usr/share/lightdm/lightdm.conf.d/60-lightdm-gtk-greeter.conf
 [Seat:*]
 greeter-session=lightdm-gtk-greeter
 autologin-user=odroid

Installation

To use Android Auto, you will need to install OpenAuto, which requires both aasdk and protocol-buffers to be installed. Before updating the compiler, please check the version of the GCC compiler. The GCC version should be 6 or higher:

$ 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)
Add the repository via add-apt-repository commands, then install gcc-6:
$ 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 installation, you should see that the updated GCC is available:
$ 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)
Next, download the protobuf-compiler source code:
$ wget https://github.com/google/protobuf/archive/v3.0.0.zip
$ unzip v3.0.0.zip
$ cd protobuf-3.0.0
In the autogen.sh file, 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
 .
 .
 .
If you are using an ODROID-C2 for your build, you can add the “-j4” option to the “make” command but on the ODROID-C1+, you should avoid this option due to the 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
$ 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]
Finally, build and install 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]
$ echo "./openauto/bin/autoapp &" >> .bashrc

Add account to group

To solve the account permission problem, set the user group as shown below:

$ 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
You should see the Android auto ready screen upon booting.

Figure 7
Figure 7

Figure 8
Figure 8

Attaching and setting the materials

To use the ODROID-VU7 display, edit the boot.ini files as shown below. You should edit resolution and vout_mode options. The 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"
Figure 9
Figure 9

Mount SmartPower2

This is an optional device, and you can use any other 5V/3A PSU for this. The SmartPower2 has an auto-run function, and you can communicate with it via WiFi.

Figure 10 - Output power ON/OFF automatically when you power on the SmartPower2
Figure 10 – Output power ON/OFF automatically when you power on the SmartPower2

Check the Auto Run option and connect SmartPower2 using the cigarette lighter power adapter as the input and the ODROID-C1+ as the output.

Figure 11
Figure 11

Figure 12
Figure 12

Mount Stereo Boom Bonnet

If you have to load the driver every time your ODROID-C1+/C2 starts up, simply register 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:~$
Select “output to ODROID-DAC Analog stereo” via System » Preferences » Hardware » Sound » Output.

Figure 13 - Select Output: ODROID-DAC Analog Stereo
Figure 13 – Select Output: ODROID-DAC Analog Stereo

Figure 14 - Make sure to check the connector!
Figure 14 – Make sure to check the connector!

Set Up your power button

Using the keypads on the TFT LCD, the Android Auto system can be shut down by powering off the car system, but we wanted to include a separate power button for convenience. To make this work, change “KEY_UP” to “KEY_POWER” in the source code for the tftlcd_key service:

{ PORT_KEY1, HIGH, KEY_UP, KEY_RELEASE },
Next, update rc.local to automatically load the tftlcd_key service on boot:
$ sudo vi /etc/rc.local

# 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.

Figure 15
Figure 15

Figure 16
Figure 16

To map a shutdown action, go to System » Preferences » Hardware » Power Management » General.

Figure 17 - When power button is pressed: Shutdown
Figure 17 – When power button is pressed: Shutdown

Figure 18
Figure 18

Mount USB Microphones

To use Google Assistant, you will also need a USB microphone. Set the input to USB device using System » Preferences » Hardware » Sound » Input.

Figure 19
Figure 19

Figure 20 - Select input : USB PnP Sound Device Analog Mono
Figure 20 – Select input : USB PnP Sound Device Analog Mono

Figure 21
Figure 21

Install Android Auto in a car

We’ve now installed the Android Auto device in my personal car, which works great. After start up, Android Auto is automatically ready to connect your Android device. After connecting your Android device to Android Auto, the Android Auto will detect your device so that you can use it.

Figure 22
Figure 22

Figure 23
Figure 23

Figure 24
Figure 24

Be the first to comment

Leave a Reply