Team-BHP > In-Car Entertainment
Register New Topics New Posts Top Thanked Team-BHP FAQ


Reply
  Search this Thread
69,321 views
Old 29th February 2016, 14:32   #31
BHPian
 
Join Date: Oct 2015
Location: Mumbai
Posts: 28
Thanked: 38 Times
Re: Using an Android Smartphone as a Head-Unit

Wonderfully Done and a great DIY. HUs have become a very basic necessity in today's tech oriented world. I bet there might be numerous people following this thread for doing it in their old cars.

Kudos to you mate !!!
J_Man is offline  
Old 2nd March 2016, 00:40   #32
BHPian
 
Join Date: Oct 2013
Location: miryalguda
Posts: 106
Thanked: 64 Times
Re: Using an Android Smartphone as a Head-Unit

Amazing project.
I just cant wait any more to try this in my car.
The hardware switches really makes life easier at least for me. Cause most of today's touchscreen head units are not accessible to the blind. Unless it has a remote control.
Since this setup is based on android. the builtin talkback screen reader lets anyone use the touchscreen without seeing the screen. Great work. Loved your idea.
sumanbhokray is offline  
Old 6th March 2016, 09:52   #33
BHPian
 
datvichrox2's Avatar
 
Join Date: Dec 2009
Location: Bangalore
Posts: 110
Thanked: 294 Times
Controlling the android phone/head-unit using hardware knobs/buttons

Controlling the android phone/head-unit using hardware knobs/buttons

The primary interface to this android device is through its touchscreen, through which any required user-input can be provided.
This is actually very adequate for most people. Almost all nexus7 in-car installations only use the touchscreen.

In an environment of a car, it is very important to have specialised buttons. You wouldn't want to turn on the headlamps, by browsing through menus right?! Things that are important to the driver should be quick and simple, so as to prevent distraction.

With respect to the audio system, the important things for me are as follows:
1. Volume control and mute
2. Track control (next/prev)
3. Navigation commands

Finally, here is the video which shows the knobs in action
I have also added an external mic to give voice commands (Google voice). I will move the mic to a different location later.



Initially I intended to have the 2 knobs, and 4 more buttons. In the end, I decided against it, since adding the buttons was becoming cumbersome from a space point of view. Also the homescreen with the large text buttons (Music, Maps, CarData etc) served the purpose I was looking for.

Anyway, in this post I will focus on how I managed to add these external knobs/buttons and what is required for anyone else to do so.

Arduino Uno

This is a simple hardware prototyping board. There are different variants, Uno is just one of them.

It has a bunch of general purpuse Input/Output pins, which means these pins can be configured as either input or output, it depends on the code that you write. It also has some ground pins, 5v power supply pin and serial communication pins.

The beauty of this is that you don't need to know anything about writing assembly language code (or whatever it is) that chip level programming requires. You write code in C language, first to configure the pins as Input or Output and then respond to the inputs or generate some outputs on those pins. It cannot get easier than this if you know some kind of programming and a bit of electronics.

For example, you can create an LED blinker by doing the following:

I am taking this example from the arduino website - https://www.arduino.cc/en/Tutorial/Blink

The connections:
Name:  ExampleCircuit_bb.png
Views: 3001
Size:  30.3 KB

The code:
// the setup function runs once when you press reset or power the board
void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
}

This is the arduino from my setup.

Using an Android Smartphone as a Head-Unit-arduino-hc05.jpg
The vertical chip is the bluetooth module.
The long red wire is connected to the Remote-input of the blaupunkt head unit. (Pin 11)

Also, the arduino receives 12v power from the blaupunkt head-unit itself.

This blaupunkt model, like many others, has 12v power ouptuts which is activated when the unit is turned ON, which is perfect for my use case. See diagram below.
Using an Android Smartphone as a Head-Unit-blaupunkt-wiring-diagram.jpg

Pin 10 provides power to the remotes like RC-10 and pin 16 provides power to cd-changers. The current on these lines would not be much, but we need very less current to operate the arduino. So I have taken power from Pin 10.

So the arduino powers UP whenever the blaupunkt head-unit powers up. In Palio, this happens only when car Ignition is ON.

Using an Android Smartphone as a Head-Unit-arduino-installed-behind-dash-panel.jpg
Installed behind the dash using mounting holes provided for the stock clock.

Using an Android Smartphone as a Head-Unit-arduino-extensions-rotary-encoders.jpg

You can take a look at my code here to understand what I am doing in this project:
https://github.com/Vimal-Krishna/Ard...oth_rotary.ino

There are also a plethora of arduino software libraries available to support various sensors and hardware. For example, you do not need to know how to send a message over serial communcation, you just call serialWrite("message"). The underlying library will take care of whatever hardware level configuration is needed.

The main libraries in my code are:
#include <rotary.h>
this processes the outputs of the rotary encoder knobs, and just tells me in which direction it was turned
#include <blaupunktremote.h>
this is an emulator for a blaupunkt remote controller, which I wrote myself. This is used to control the volume of the head unit
Basically it sends HIGH signal for a certain no of seconds followed by a LOW signal, which the blaupunkt head-unit understands and responds to. This is exactly what a Blaupunkt RC-10 remote would be doing.

Rotary encoder:
It is like a volume control knob, but it is a digital device, meaning it sends out digital bits to represent in which direction it was turned. Also, it rotates endlessly, so the previous state is not known. For ex, this will be telling the android phone " whatever was your last state, change it by one", instead of say, "change the value from x to y".

It also has a center push button. You can find such knobs on microwave ovens etc, which rotate endlessly. Recently, I have seen it used in many cars for volume control.

So now if you read my code, you will follow, that when the rotary encoder 1 is turned, I send R1R (right) or R1L (left). If the button was pressed, I send R1B. Similarly, I send R2R, R2L, R2B over bluetooth.

One exception is that R2L and R2R are meant for controlling the volume of the Blaupunkt head-unit and does not have to be sent over bluetooth. So for this, I am directly calling rc10.volumeUp() and rc10.volumeDown(). Other messages are sent over bluetooth and the android program listening to this device, will respond accordingly.

For ex, android program (running in background) will do the following:

if (data.compareTo("R2B") == 0)
{
raiseMediaKeyevent(KeyEvent.KEYCODE_MEDIA_PLAY_PAU SE);
}
else if (data.compareTo("R1R") == 0)
{
raiseMediaKeyevent(KeyEvent.KEYCODE_MEDIA_NEXT);
}
else if (data.compareTo("R1L") == 0)
{
raiseMediaKeyevent(KeyEvent.KEYCODE_MEDIA_PREVIOUS );
}
else if (data.compareTo("R1B") == 0)
{
raiseMediaKeyevent(KeyEvent.KEYCODE_MEDIA_FAST_FOR WARD);
}

The events in capital letters are standard media control events, which are usually invoked when you use the buttons which come with earphones.

Android programming is a bit more elaborate and time consuming to understand, here is the code if you can follow
https://github.com/Vimal-Krishna/And...erService.java

If you need help in modifying any of the code to suit your projects, feel free to ask, I'll do what I can. I want to be able to generalise the above code so that anyone can install it on their phone and configure it - like if 'x', then do 'y'

Some work that still needs to be done:
Currently, I am starting the bluetooth program on the phone each time I turn on the car. This needs to be changed, so that the tasker app can control it when it receives power.
Turning the volume knob too quick results in no change in volume, it has to be done a bit slowly. Arduino code that handles this needs to be improved.


Thanks,
Vimal
datvichrox2 is offline   (7) Thanks
Old 6th March 2016, 10:31   #34
BHPian
 
datvichrox2's Avatar
 
Join Date: Dec 2009
Location: Bangalore
Posts: 110
Thanked: 294 Times
Re: Using an Android Smartphone as a Head-Unit

Quote:
Originally Posted by KAN View Post
Excellent stuff!! You should market this!!
Quote:
Originally Posted by petrolhead_neel View Post
Brilliant concept! I loved the idea. Thanks for sharing. This is one of the best DIY projects that I have ever seen on Team-BHP. Kudos! Fit and finish look really good, almost matches factory grade. I can imagine how much thought has gone into making this project a success. In other news, my Raspberry Pi is *almost* here and I will surely take your help if I get stuck somewhere.

Got that ol' smartphone lying around, time to put it to some real use!!

Please post more projects like these Sir. They are extremely beneficial.

Regards,
Neel
Thanks!

Quote:
Originally Posted by good.car-ma View Post
Fantastic. You have done what some OEMs are struggling to do!!
Thanks! I am sure OEMs have these solutions, but are not releasing it in the mainstream market.

Quote:
Originally Posted by Engine_Roars View Post
This is awesome. You should have started the post with a warning though - Do NOT do it yourself. This thing definitely requires a pro like you.
Thanks! Nah, anyone can do this. If you are a PRO in anything, then you already know how to become a PRO. Anyone can become excellent in any field, it only takes practice/research/dedication. Internet can teach us so much, who's stopping us from learning ? :-)

Quote:
Originally Posted by aaren View Post
Absolutely brilliant and you really rock, datvichrox !! Hats off to your innovative and ingenious thoughts alongwith perseverence. A silly question: What is arduino ??
Thanks! See my last post for details.

Quote:
Originally Posted by Tanmay K View Post
Great work! I see that your interface has "Car Data". Have you connected the smartphone to a bluetooth OBD scanner?
Yes, I use an app called AlfaOBD which is the only app that works seamlessly with the Palio. I wanted to use TorquePro for this, to show the engine params etc, but that app does not work with my car. I want to see if it is possible to show data like 'distance to empty' etc. For this I have to write my own app, I have the protocol details for the palio.

Quote:
Originally Posted by rohitnp View Post
Awesome!

Just thinking, what if the orientation of the knobs were horizontal, just behind the gear lever ? iDrive alternative?
Cool. I just looked up iDrive. Looks interesting. If we can get hold of the switch assembly, this can be done easily!

Quote:
Originally Posted by iamback View Post
You can also add Follow me home headlamp feature as your are using arduino. Also if you have remote locking system you can program arduino such that they will close all the windows on double tapping the lock switch on remote. Keep it up dude. Nice work
Thanks! Yes, the possibilities for automation are huge with arduino. Rain-sensing wipers, auto-headlamps etc. So many sensors are readily available. Anyway, I stil don't have power windows on my car!

Quote:
Originally Posted by r.K View Post
Excellent! You have a lot of patience. Especially when you need to code an app for android and code the Arduino system as well. I can imagine how you felt when it worked and it all came together. Kudos! The unit looks thoroughly professional.
Thank you! There were many times when I wanted to take a hammer, and break everything and pretend this idea never happened !

Quote:
Originally Posted by J_Man View Post
Wonderfully Done and a great DIY. HUs have become a very basic necessity in today's tech oriented world. I bet there might be numerous people following this thread for doing it in their old cars.

Kudos to you mate !!!
Thanks
Quote:
Originally Posted by GTO View Post
Thanks for sharing this update! Moved it to the opening page, post #3 .
Thanks!

Quote:
Originally Posted by sumanbhokray View Post
Amazing project.
I just cant wait any more to try this in my car.
The hardware switches really makes life easier at least for me. Cause most of today's touchscreen head units are not accessible to the blind. Unless it has a remote control.
Since this setup is based on android. the builtin talkback screen reader lets anyone use the touchscreen without seeing the screen. Great work. Loved your idea.
Thanks!
datvichrox2 is offline   (2) Thanks
Old 10th July 2016, 09:56   #35
Senior - BHPian
 
samaspire's Avatar
 
Join Date: Sep 2015
Location: Manipal / Udupi
Posts: 1,629
Thanked: 4,859 Times
Re: Using an Android Smartphone as a Head-Unit

Quote:
Originally Posted by datvichrox2 View Post
Answering calls would be awesome! But there is a major blocker in how Android implemented the bluetooth profiles. One phone cannot receive bluetooth audio from another phone. I am looking at ways to work around this limitation.
Have you found a way around this limitation? I'm planning to install an Android tab as the HU and want to be able to receive calls from my android phone on it. Any ideas?
samaspire is offline  
Old 13th July 2016, 00:42   #36
Senior - BHPian
 
samaspire's Avatar
 
Join Date: Sep 2015
Location: Manipal / Udupi
Posts: 1,629
Thanked: 4,859 Times
Re: Using an Android Smartphone as a Head-Unit

In continuation of my above query - I wouldn't even mind a wired connection.
samaspire is offline  
Old 13th July 2016, 18:51   #37
BHPian
 
datvichrox2's Avatar
 
Join Date: Dec 2009
Location: Bangalore
Posts: 110
Thanked: 294 Times
Re: Using an Android Smartphone as a Head-Unit

Quote:
Originally Posted by samaspire View Post
Have you found a way around this limitation? I'm planning to install an Android tab as the HU and want to be able to receive calls from my android phone on it. Any ideas?
Kinda found a workaround, and it is tested and working fine.

Solution involves adding another device. I got myself a Tantra Fluke bluetooth unit, which will be responsible for routing all audio from personal phone to the car system. It is USB powered and has a 3.5mm male audio output.

The challenge: you need to build a small two-input mixer (another diy)
Without this, mixing two audio signals directly is possible, but not recommended and also this could damage one of the audio sources.
This is a passive unit (no external power), and there will be a very slight drop in overall volume when both sources are outputting audio.

The inputs to this mixer unit are the car-phone aux-out, and the aux-out from the Tantra Fluke bluetooth unit.

You also need a way to tell the car-phone to pause the audio when you get an incoming call and unpause when the call has ended. This is taken care of by a paid Android App - TabletTalk. It is no longer supported by the developer though, but it works for me.

The AWESOME part of this app, is that it displays the caller ID on the car-phone, and you can answer/reject the call from the car-phone touchscreen (this is the only part which is sometimes buggy - sometimes the call is not answered). Calls can also be answered by pressing the button on the Tantra Fluke.
It also has a dial pad on which you can type the phone number (or select a contact) on the car-phone and the call is placed on your personal-phone.

I will post some pics later.

-Vimal
datvichrox2 is offline   (1) Thanks
Old 14th July 2016, 00:32   #38
Senior - BHPian
 
samaspire's Avatar
 
Join Date: Sep 2015
Location: Manipal / Udupi
Posts: 1,629
Thanked: 4,859 Times
Re: Using an Android Smartphone as a Head-Unit

Very interesting. Not understood it fully yet, but pictures might make it clearer.

Details about making the input mixer too please.
samaspire is offline  
Old 6th August 2016, 02:16   #39
BHPian
 
datvichrox2's Avatar
 
Join Date: Dec 2009
Location: Bangalore
Posts: 110
Thanked: 294 Times
Re: Using an Android Smartphone as a Head-Unit

Quote:
Originally Posted by samaspire View Post
Very interesting. Not understood it fully yet, but pictures might make it clearer.

Details about making the input mixer too please.
In the following image, the white lines denote communication through bluetooth, and blue lines are through audio wires.

The round device at the top right corner is the Tantra Fluke car bluetooth kit (Link).

Using an Android Smartphone as a Head-Unit-carphonebluetoothmixer.jpg

The app that is installed on the car-phone and my personal-phone is TabletTalk (Link). Once configured, this app transfers caller information from my personal phone to the car-phone, and also provides an option to receive or reject the call.

Using an Android Smartphone as a Head-Unit-notificationonscreen.jpg

If the call is answered, the call AUDIO is transferred through the bluetooth-kit and is fed into the aux-input of the head-unit, through the mixer (and played through the speakers)

The bluetooth-kit is powered by usb and I've hidden the wires behind the A-pillar. It also has a mic, and the mic is very clear, and the place I've put it seems to be quite good.. Sometimes I try to speak a little loud thinking I am too far away from the mic, and the other person asks why I am yelling! I was worried there would be echo issues, but there were none.

Now a Tasker profile can be created on the car-phone to automatically pause the music when TabletTalk gets an incoming call notification, and then automatically unpause the music after the call ends. Ain't that nice!

To make an outgoing call, TabletTalk also provides a dialer, and then the call is initiated on the personal-phone, while audio is routed through the bluetooth car-kit.

Using an Android Smartphone as a Head-Unit-onscreendialer.jpg

The audio mixer:
This is the simple two input audio mixer that I built:

Using an Android Smartphone as a Head-Unit-mixer1.jpg

Using an Android Smartphone as a Head-Unit-mixer2.jpg

I followed this instructable to build the audio mixer
http://www.instructables.com/id/Alto...-Stereo-Mixer/

I later bought a better plastic enclosure to put the mixer, but I haven't found time and inclination to repackage it.

-Vimal
datvichrox2 is offline   (2) Thanks
Old 11th November 2016, 16:19   #40
BHPian
 
gypsyFreak's Avatar
 
Join Date: Dec 2007
Location: Bengaluru
Posts: 418
Thanked: 553 Times
Re: Using an Android Smartphone as a Head-Unit

Quote:
Originally Posted by datvichrox2 View Post
This was going to be a proof of concept of an idea that has been gnawing at me for a while. Its a hobby project that I did on my 2004 Palio 1.2 and I am happy with the way it has turned out.
How is the unit performing now?
I too am planning to use a android tablet as headunit.
gypsyFreak is offline  
Old 11th February 2017, 23:19   #41
BHPian
 
datvichrox2's Avatar
 
Join Date: Dec 2009
Location: Bangalore
Posts: 110
Thanked: 294 Times
Re: Using an Android Smartphone as a Head-Unit

Quote:
Originally Posted by gypsyFreak View Post
How is the unit performing now?
I too am planning to use a android tablet as headunit.
Hey! The unit is doing good. I've almost forgotten that it is non-stock.

I think its well over a year now since I installed it.

Only issue is sometimes GPS does not truly turn off (maybe because of maps running in background), and then that drains the phone battery.

If you are planning to add hardware buttons, currently there is an easier solution, instead of going the arduino route - Bluetooth Media buttons.

I am thinking about adding this into the project, if time permits.

Using an Android Smartphone as a Head-Unit-51marskjfcl._sx425_.jpg
datvichrox2 is offline   (1) Thanks
Reply

Most Viewed


Copyright ©2000 - 2024, Team-BHP.com
Proudly powered by E2E Networks