E85 / E86 BMW Z4 – Android tablet integration

Post Reply
User avatar
danmiddle2
Member
Member
Posts: 834
Joined: Mon Apr 01, 2013 10:01 am

E85 / E86 BMW Z4 – Android tablet integration

Post by danmiddle2 » Tue Sep 17, 2013 11:31 am

E85 / E86 BMW Z4 – Android tablet integration

This 'how to' is going to be quite loosely done as I am sure not everyone will want their install set up in the exact same way as I did mine. As a result I am going to break it into modules. A lot of it can be done without having to integrate the tablet completely; you could just mount one somewhere on your dash :-) I will also add a list of components including indicative pricing (based on my experience), and a list of required tools.

As much as is possible, I have tried to put the modules in a logical order. For example, it makes sense to get the tablet set up how you want it before integrating it into the car. It is, of course, not impossible to make changes post installation; it’s just easier to ‘fiddle’ beforehand. The modules are:
Module 1 – (COMPLETE) – Tablet connectivity requirements
Module 2 – (COMPLETE) – Making the tablet car friendly
Module 3 – (COMPLETE) - Fitting a tablet into the original navigation screen housing
Module 4 – (WORK IN PROGRESS) - Restoring motorisation
Module 5 – (INCOMPLETE) – Charging and power
Module 6 – (COMPLETE) - Installing the screen
Module 7 – (WORK IN PROGRESS) Additional features
Module 8 - (COMPLETE) - Cooling - please refer to this first, as I made a few changes that contradict some other directions.

The most important thing to know is that these are guidelines designed to help you along the way with your project. I accept no responsibility for any damage or problems that may occur. One particular caution I will offer is around the stepper motor itself. I could not find any specifications for the original motor, so reverse engineered the pins and required voltage. Reverse engineering is just a fancy term for GUESSING, so I accept no liability for issues this may cause. Do this at your own risk.

It is also worth noting that some of the modules are still a work in progress. Please read the full how to before deciding whether or not you want to begin. I will continue to update this how to when I make further progress, but this will be done to my timelines – not yours ;-)

Now that the formalities are out of the way, this is what we are trying to achieve:




Module 1 – (BASIC) – Tablet connectivity requirements
Pt. 1.1 – Audio
Required:
1x A2DP Bluetooth interface (~£180)
1x Android tablet (for the purposes of this tutorial, I will assume Huawei Ascend Mate) (~£270)
1x A way of mounting the tablet (~£10-£50)


This bit is pretty straightforward; you need a way of playing your media via the car stereo and somewhere to position the tablet device. Of course you could use a 3.5mm audio jack, but the quality isn’t great and this can be prone to electrical ‘noise’ in the background when charging the device. For these reasons streaming music over Bluetooth A2DP is preferable. It also has the added benefit of allowing you to skip track via the steering wheel controls without having to depend on iBus integration (which I haven’t even started on yet – but is on my todo list).

For my setup I installed a Dice Mediabridge MB1500, although there is a wide array of choice for this, so be sure to review the options and choose the one that is right for you. Rather than cover ground that has been done before, here is a great tutorial I found for installing the Dice Mediabridge in a Z4:




One thing that I would say about the Dice Mediabridge is that it ably handles multiple concurrent Bluetooth device connections. I can still use my normal / everyday phone for calls, whilst streaming music from the tablet. It automatically switches between the two when needed.

In terms of mounting the tablet, prior to embarking on my full integration project, I put this together for my Nexus 7… but again there is a wide choice of mounts. I do like the Brodit range and can’t recommend them highly enough, but I’ll assume you have this covered.
Image
Image

Pt. 1.2 - OBD telemetry
Required:
1x ELM327 Bluetooth OBD Interface (~£10-£150)


This is the device that sends the telemetry data from your cars diagnostic port to the tablet. This will allow you to display and log a great deal of information (RPM, Speed, Coolant Temp, etc). There is quite a spectrum of price range on these devices, from something like this for about £10:
Image
To something like this for about £150:
Image
Either works, but the usual rule of you get what you pay for does apply. I started with the former, and then purchased a middle ground device for £30 before finally investing in the latter. The latter being an OBDLink MX. The benefits of the OBDLink MX are that it is faster (it claims to be the fastest OBD Bluetooth reader) which is really important, especially for things like RPM. With the slower device it’s almost ‘laggy’. If telemetry is important, then having it quick and accurate must be important (otherwise, why bother?). In addition, the MX supports more protocols (sadly none of them relevant to BMW), but most importantly for me, it has a power saving feature so you can leave it plugged in without draining your battery.

Whichever you choose, this unit needs to be plugged into the diagnostic port. This is located in the driver side foot well – sort of under the right hand side of the steering wheel. It’s pretty easy to find, under a little fold down rectangular cover.

Once you have both a Bluetooth stereo interface and the OBD adaptor fitted, you obviously need to get these paired with your tablet. This is pretty straightforward, but you can always refer to the manual for help.


Module 2 – (BASIC) – Making the tablet car friendly
Pt. 2.1 – Interface
Apex - https://play.google.com/store/apps/deta ... r&hl=en_GB
Car Dashdroid - https://play.google.com/store/apps/deta ... d&hl=en_GB
Tasker - https://play.google.com/store/apps/deta ... m&hl=en_GB
Secure settings - https://play.google.com/store/apps/deta ... n&hl=en_GB

The objective here is to make the tablet easily usable whilst in the car. Whilst the tablet is not the focus when underway - we may wish to switch applications whilst driving - and this needs to be done as easily and safely as possible.

The first problem with the Huawei Ascend Mate is that the home screen interface doesn’t support rotation’ out-of-the-box’. Given that we will be using the device exclusively in landscape whilst in the car, this is a problem. One that is simple to resolve, however. To do this all you need to do is install an alternative home screen user interface and make that the default. For this purpose I have selected Apex.

Once you install Apex and hit the tablet home button, you will be presented with a choice of which application should respond to the home button press. From here simply select the Apex launcher and make it default. Apex will also allow you to clear the default launcher from memory so that it’s not hogging resources.

In Apex rotation on the home screen is not enabled by default. You can find the setting to amend it here:

Apex Settings > Behaviour Settings > Screen Orientation > Auto Rotate

Apex is highly customisable – you can change icon size on the home screen and in the app drawer. You can choose the number of icons horizontally / vertically etc. Please feel free to fiddle with these options yourself to find a setup which works for you.

Even with that sorted, Apex is still not ideal for use whilst driving, so as the main driving interface I have decided to go with an application called Car Dashdroid. It’s fairly straightforward – install it and launch it. When you launch the application you have a nice big screen dialler, 1 or 2 pages for links to applications you may wish to use and a main page with links to contacts, navigation, music etc. Simply press and hold the music and navigation buttons and you can configure which application they launch.

This application also solves another issue on the Huawei Ascend Mate. Whilst we have replaced the default interface with Apex to fix the issue of rotation, the native dialler still doesn’t support rotation. The Dashdroid dialler neatly solves this issue.

The last thing we have to do is determine some triggers for certain behaviours we want from the tablet. This is really only relevant if you want to go with a permanent or integrated install, otherwise this will just be a pain.

To achieve this, I used a combination of Tasker and Secure Settings (a Tasker plugin). In my car, I have it set up to switch the device on when the Bluetooth of the MediaBridge connects to the tablet and turn off when it disconnects. Additionally I have it configured to switch the device off when the screen housing rotates down; again this is only relevant if you’re integrating the tablet into a standard housing.

I am not going to give exhaustive details, but here are a couple of examples to get you started:

To turn the tablet on when a particular Bluetooth device is connected:
• From tasker main page, click on “+” to add a profile
• From the list select “state”
• In the search box type Bluetooth and select “Bluetooth Connected”
• Click the search icon next to “Address” and select the relevant Bluetooth device that you want the tablet to respond to
• Now click on the tasker logo in the top left to go back a page
• From here select “New Task”. You can give it a name if you like, but this is optional
• At the bottom, click “+” to add an action
• Click “Plugin”
• Then “Secure Settings”
• Click “Edit”
• Select “Wake Device” and save.

To turn the tablet off when a particular Bluetooth device is disconnected:
• From tasker main page, click on “+” to add a profile
• From the list select “state”
• In the search box type Bluetooth and select “Bluetooth Connected”
• Click the search icon next to “Address”, and select the relevant Bluetooth device that you want the tablet to respond to
• Now tick the “Invert” check box at the bottom
• Now click on the tasker logo in the top left to go back a page
• From here select “New Task”. Again, you can give it a name if you like
• At the bottom, click “+” to add an action
• search for “Lock” and select “System Lock”

I am sure you can figure out the rest from there and add whatever profiles suit your needs.

Pt. 2.2 – Applications
I am not going to give a full tutorial on all of the applications here, but these are some of the car friendly / car specific applications that I have found and use. For me, choice and variety is one of the main benefits of doing this. I use four navigation systems all of which I have installed. Each has pro’s and con’s, I’ll let you decide on this for yourself :-)
Navigation Apps
Waze - https://play.google.com/store/apps/deta ... e&hl=en_GB
Maps - https://play.google.com/store/apps/deta ... s&hl=en_GB
Navigon - https://play.google.com/store/apps/deta ... k&hl=en_GB
Tomtom - https://play.google.com/store/apps/deta ... d&hl=en_GB

Track / Telemetry Apps
Harry’s Lap Timer - https://play.google.com/store/apps/deta ... r&hl=en_GB
Race Chrono - https://play.google.com/store/apps/deta ... p&hl=en_GB
aLapRecorder HD - https://play.google.com/store/apps/deta ... d&hl=en_GB
iOnRoad - https://play.google.com/store/apps/deta ... o&hl=en_GB
Dashcommand - https://play.google.com/store/apps/deta ... d&hl=en_GB
Torque - https://play.google.com/store/apps/deta ... e&hl=en_GB

Media Apps
Poweramp - https://play.google.com/store/apps/deta ... r&hl=en_GB
DoggCatcher - https://play.google.com/store/apps/deta ... 0&hl=en_GB
TuneIn Radio - https://play.google.com/store/apps/deta ... r&hl=en_GB

Module 3 – (MEDIUM) - Fitting a tablet into the original navigation screen housing
Required:
1x Navigation screen of an E85/E86 generation Z4 (~£150 for a working one)
1x ‘Huawei Ascend Mate’ Android tablet (~£270 on PAYG from Vodafone)
1x 3ft USB 2.0 A male to micro-B male left-angle cable (~£8.00)
1x New demister pad - don't buy a rubbish one (~£3.50)

Tools:
1x Drill and small drill-bit (~3mm)
1x Stanley knife
1x Torx T10
3x Strong black coffee


This part is probably not as hard as you think it is going to be (or at least I hope not). The only thing to consider is that once finished, it probably isn’t going to be easy or even possible to put your navigation screen back to how it was. Some of it is irreversible.

If I already had the professional navigation in my car, I would be inclined towards sourcing a spare screen unit – that way you can always put it back to standard if required. We are not going to mess with any of the car’s wiring, so you could easily swap back to an unmolested screen in the future, if required.

Either way, we are starting with one of these:
Image

Begin by undoing the 2x rear torx screws:
Image

Then remove the screw on the right hand side of the unit:
Image

Then the three highlighted screws from the left hand side of the unit (the fourth screw can stay in place for now):
Image

Then gently prise back the motor and mounting plate to reveal another screw, neatly hidden:
Image

So now you should be able to unclip the four clips at the bottom and separate the housing into two parts (sorry, I failed to take a pic of this step, but it’s pretty straightforward).

Now we want to extract the screen itself. On the right hand side, there is a solid grommet like thing, which you need to gently prise out. There is a little tab covering this which needs to be moved from one side to achieve this:
Image

Image

On the other side, the final piece of the gear element itself is connected to the same grommet like thing. Again, this gently prises free:
Image

Now make sure you unplug both switches:
Image

Image

Now you should be able to free the screen. This will require a little wriggling as the cables will get a little in the way:
Image

The screen housing itself then comes apart by pushing the three tabs at the bottom and gently teasing apart:
Image

Next we need to undo the four screws shown to remove the top board. Ensure you disconnect all the cables first:
Image

Image

Image

Image

Do what you want with this board, we don’t need it anymore. My car didn’t have the pro-nav wired in, but it’s possible you could simply re-use this board to motorise your screen without the LCD. I’ve not tried or tested this in my setup:
Image

Now you’ll see the LCD held in place by these two green mounting brackets. We will be re-using the mounting brackets to help secure the tablet. Remove the four screws as shown and everything else (except the light sensor) should now come out:
Image

Leaving you with this:
Image

I also removed the light sensor, but you may wish to leave this in as removing it leaves a very small hole in the front.

The inside of this housing will need a little trimming to make room for the Huawei Ascend Mate. I have highlighted a couple of things I trimmed to make room, but this is a little trial and error:
Image

Once you’re done, line up the tablet inside and drill a small hole to correspond with the power button. This will be useful should you ever need to power the device on / off / reboot in the event of an error.
Image

As you can see, I then re-used the original brackets with the remaining screw holes to fit the tablet. This will not get to a tight fit (we’ll fix that in a bit), but does help to line it up etc:
Image

Image

Image

Here you will see how a neat left-angle USB cable provides the perfect solution to the lack of space to get a full micro-USB in place, so that we can leave it permanently charging:
Image

Lastly, take your demister pad and cut it open. The foam in the demister pad is the perfect width that when compressed into the case holds the tablet perfectly in place. You can see mine here, with a cut out for the Arduino (which we’ll cover later).

The foam allows for good, tight fitment without having to glue the tablet in place. It also allows for very fine positioning adjustments to be made once the back of the screen housing is back on. This way you can get it perfectly lined up. I initially did this to test the tablet in the housing, but it’s such a perfect solution that I have decided to stick with it as the permanent solution.
Image

Image

Once you have all that in place, you can clip the rear back onto the screen housing… and then re-assemble the rest of it around the device. This is pretty straightforward. To quote Haynes manuals; “to refit, reverse the removal procedure”.

At this stage, if you have come this far… you have a neatly fitted tablet, but no way of opening and closing the screen without manually lifting and shutting it. The next module will cover how to re-introduce the motorisation functions.

Module 4 – (SKILLED) - Restoring motorisation
WARNING - THIS BIT IS NOT FINISHED. ALTHOUGH IT LOOKS GOOD IN MY VIDEO, THERE IS CURRENTLY NOTHING TO STOP YOU PRESSING THE OPEN BUTTON WHEN IT IS ALREADY OPEN AND STRIPPING THE GEARS!



As with everything else, do this at your own risk. I will be updating this section, when I make progress.


Required:
1x Arduino Uno R3 (~£20)
1x Arduino Motorshield R3 (~£20)
1x A to B USB Cable
4x Short lengths of wire

Tools:
1x Computer with Arduino IDE installed
1x Small flat screwdriver
1x Wirecutters
1x Soldering iron



Pt. 4.1 – Understanding the motor
As I mentioned at the beginning, I could not find any specifications for the DC stepper motor originally fitted to the unit – so I have reverse engineered the motor and accept absolutely no liability for any issues / problems that occur. I will do my best to explain my logic so that you can make an informed decision about whether or not you wish to proceed.

If you already have the professional navigation system fitted and are going to attempt this, then you may wish to take some voltage readings with a multimeter before you start and confirm some of my guess-work. I didn’t have a working system to do this from.

That out of the way, let us begin. We are starting with this (dismantling is covered in the previous module and should get you to this stage):
Image
There are several different types of DC motor. From a conventional two wire motor where you can apply voltage to rotate one way, and reverse the voltage to rotate the other. These types of motor are less than ideal for this purpose as they are not precise enough without additional hardware.

What we have here is a DC stepper motor. Which tend to come in either unipolar or bipolar form. Stepper motors allow you to programmatically move the motor in individual steps, making them good for this purpose. To the best of my knowledge unipolar stepper motors tend to have five cables, and bipolar have four.

First we need to undo that final screw on the motor assembly:
Image

Then the last thing holding the motor to the bracket is a clip, which you can reach from the inside. It helps to understand which bit to prise, so here it is:
Image

Now we have something which looks roughly like a motor:
Image

But for the observant amongst you, this motor seems to have eleven yellow wires… not four or five:
Image

Short answer, I have no idea what they are. But I took apart my motor, and there is a further control board in the back. This control board is soldered onto four points (bingo!). As I said, I dismantled my motor housing to remove the cable from the back. But the four contact points are accessible from the front so you could simply cut the yellow cables off and keep it out of the way. There is no easy way to remove the control board from the back. Whilst removing the cable is tidier… getting the motor housing to fit tightly back on is difficult.

So what we have here appears to be a bipolar stepper motor. The four connectors are here:
Image

We now need to figure out the ‘pairs’. This is quite simple. Connect a piece of wire bridging two of the connectors at a time. Then manually try to turn the motor by hand. If you have connected a pair then the physical resistance will increase greatly. If they are not a pair, it won’t. Once you have identified one pair, chances are the other two are a pair also – but check.

My pairs were in opposing corners, but I don’t have enough info to say if they are in the same configuration on all motors. Next you need to add some wire to play with:
Image

Pt. 4.2 – Arduino, motorshield, wiring and the buttons

Ok, so now we need a way of controlling the stepper motor and we need to connect up the buttons on the housing. I have chosen to use Arduino for this. For those of you unfamiliar with it, here is a brief explanation taken from the Arduino Website:

Arduino is a tool for making computers that can sense and control more of the physical world than your desktop computer. It's an open-source physical computing platform based on a simple microcontroller board, and a development environment for writing software for the board.

There is a good tutorial and intro to controlling stepper motors with Arduino, here:
http://www.instructables.com/id/Arduino ... -Tutorial/

But for this specific purpose.

First – connect the motorshield to the Arduino. I actually snipped each of the pins so that the two boards mate slightly closer together. Not strictly necessary, but it gives you a little more room to manoeuvre things when you’re done:
Image
Image

Then we need to wire up the motor. This is the configuration we are after:
http://www.instructables.com/id/Arduino ... per-Motor/
Which in the context of our project looks like this:
Image
The motorshield is clearly marked, but the first pair of motor wires (that we identified earlier) need to be connected to first two slots. Then the next pair need to be connected to the second two… and power needs to be connected to the third two.

Power and wiring is covered in more detail in another module, but for the purposes of this, I used a bench power supply to reverse engineer the required voltage for the motor. This was crude, but I connected it up, programmed the Arduino (covered below), and started with a low voltage and built up until it worked. Anything <5vDC does little to nothing. 5vDC moves the motor, but when it’s connected to the screen it strains and struggles to lift it. 7.5vDC works fine. It could be 9vDC, but as 7.5v works… that’s what I have gone with on mine.

So what about the buttons? We need to connect them in order to operate the screen. Leave the plugs / connectors which connect immediately to the bottom of the buttons intact. Cut the other connector off leaving as much wire as possible and expose the ends so that you can connect them to the corresponding pins, as below.

You can use a continuity tester to figure out the buttons for yourself, but this is what mine are:
BROWN – GND for the step buttons
BLACK – GND for the open/close buttons
RED – STEP towards closed button – Pin 4
GREEN – STEP towards open button – Pin 2
WHITE – CLOSE button – Pin 7
PURPLE – OPEN button – Pin 6
The pin assignments are not that important, but if you wire them up differently then you need to modify the code accordingly. This is what mine is like all wired up:
Image

That should be it in terms of connections. Just the programming and power left to do.

Pt. 4.3 – The sketch / programming the Arduino
To program the Arduino, connect it to your PC with an A to B USB cable. Arduino programs are referred to as sketches, so I may use the terms interchangeably.
Image
The USB is sufficient to power the Arduino, but not the motor – again, please refer to the charging / powering module.

This link has some sample code for controlling a stepper motor.
http://www.instructables.com/id/Arduino ... per-Motor/

Here is code to make the stepper spin in one direction:

Code: Select all

/*************************************************************
Motor Shield Stepper Demo
by Randy Sarafan

For more information see:
http://www.instructables.com/id/Arduino-Motor-Shield-Tutorial/

*************************************************************/

int delaylegnth = 30;

void setup() {
  
  //establish motor direction toggle pins
  pinMode(12, OUTPUT); //CH A -- HIGH = forwards and LOW = backwards???
  pinMode(13, OUTPUT); //CH B -- HIGH = forwards and LOW = backwards???
  
  //establish motor brake pins
  pinMode(9, OUTPUT); //brake (disable) CH A
  pinMode(8, OUTPUT); //brake (disable) CH B


  
  
}

void loop(){
 
  digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, HIGH);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
  
  delay(delaylegnth);
  
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, LOW);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(delaylegnth);
  
  digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, LOW);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
  
  delay(delaylegnth);
    
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, HIGH);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(delaylegnth);

}
And here is code to make the stepper spin in the opposite direction:

Code: Select all

/*************************************************************
Motor Shield Stepper Demo
by Randy Sarafan

For more information see:
http://www.instructables.com/id/Arduino-Motor-Shield-Tutorial/

*************************************************************/

int delaylegnth = 30;

void setup() {
  
  //establish motor direction toggle pins
  pinMode(12, OUTPUT); //CH A -- HIGH = forwards and LOW = backwards???
  pinMode(13, OUTPUT); //CH B -- HIGH = forwards and LOW = backwards???
  
  //establish motor brake pins
  pinMode(9, OUTPUT); //brake (disable) CH A
  pinMode(8, OUTPUT); //brake (disable) CH B


  
  
}

void loop(){
 
  digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, HIGH);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
  
  delay(delaylegnth);
  
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, HIGH);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(delaylegnth);
  
  digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, LOW);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
  
  delay(delaylegnth);
    
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, LOW);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(delaylegnth);

}
As I said at the beginning, this bit is very much a work in progress so I am not going to go through it until I am happy. But here is a sketch to get you started. This defines the pins for the buttons we just wired up and gets it moving. Watch this space for updates:

Code: Select all

#define OPEN_BUTTON 6
#define CLOSE_BUTTON 7
#define STEP_OPEN 2
#define STEP_CLOSE 4

void setup() 
{

  //establish switch pins
  pinMode(OPEN_BUTTON, INPUT_PULLUP);
  pinMode(CLOSE_BUTTON, INPUT_PULLUP);
  pinMode(STEP_OPEN, INPUT_PULLUP);
  pinMode(STEP_CLOSE, INPUT_PULLUP);
  
   //establish motor direction toggle pins
  pinMode(12, OUTPUT); 
  pinMode(13, OUTPUT);
  
  //establish motor brake pins
  pinMode(9, OUTPUT); 
  pinMode(8, OUTPUT); 

}

void loop(void)
{
  int switchValue;

  switchValue = digitalRead(OPEN_BUTTON);
  if (switchValue==LOW)
  {
    screenUp();
  }
  switchValue = digitalRead(CLOSE_BUTTON);
  if (switchValue==LOW)
  {
    screenDown();
  }
  switchValue = digitalRead(STEP_OPEN);
  if (switchValue==LOW)
  {
    stepOpen();
  }
  switchValue = digitalRead(STEP_CLOSE);
  if (switchValue==LOW)
  {
    stepClose();
  }
}


void screenUp(void)
{
  if (digitalRead(OPEN_BUTTON)==LOW)
  
  digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, HIGH);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
  
  delay(50);
  
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, LOW);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(50);
  
  digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, LOW);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
  
  delay(50);
    
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, HIGH);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(50);
  }



void screenDown(void)
{
  if (digitalRead(CLOSE_BUTTON)==LOW)
  
  digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, HIGH);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
  
  delay(50);
  
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, HIGH);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(50);
  
  digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, LOW);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
  
  delay(50);
    
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, LOW);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(50);
}


void stepOpen(void)
{
  if (digitalRead(STEP_OPEN)==LOW)
  
  digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, HIGH);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
  
  delay(1000);
  
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, LOW);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(1000);
  
  digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, LOW);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
  
  delay(1000);
    
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, HIGH);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(1000);
}


void stepClose(void)
{
  if (digitalRead(STEP_CLOSE)==LOW)
  
  digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, HIGH);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
  
  delay(1000);
  
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, HIGH);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(1000);
  
  digitalWrite(9, LOW);  //ENABLE CH A
  digitalWrite(8, HIGH); //DISABLE CH B

  digitalWrite(12, LOW);   //Sets direction of CH A
  analogWrite(3, 255);   //Moves CH A
  
  delay(1000);
    
  digitalWrite(9, HIGH);  //DISABLE CH A
  digitalWrite(8, LOW); //ENABLE CH B

  digitalWrite(13, LOW);   //Sets direction of CH B
  analogWrite(11, 255);   //Moves CH B
  
  delay(1000);
} 
What works:
Open the screen from the button
Close the screen from the button
Step in either direction from the button

Still to do:
Return to last position on ignition on
Close on ignition off
Disable open button when already open
Disable close button when already closed


Module 5 – (MEDIUM) – Charging and power
1x 12V To 5V 3A step down module with USB cable (~£5.00)
1x 12V To 7.5V 3A step down module (~£5.00)
2x Add-a-circuit fuse tap piggy back blade fuse holder (~£2.50)

I am planning on doing this this week and will document as I go.

Module 6 – (MEDIUM) - Installing the screen
This has already been covered here: http://www.z4-forum.com/forum/viewtopic.php?f=29&t=6067 I did consider mounting the screen slightly towards the driver, so that it would be easier to reach. DON’T DO THIS! There isn’t room underneath. Fortunately, I decided not to try this for aesthetic reasons before I committed.

Anyway, this is pretty much all there is to it: Make a template and cut your dash:

Image

Image


Module 7 – Additional features
Pt. 7.1 – Video camera
1x Liquid image 727 video camera
Action Connect - https://play.google.com/store/apps/deta ... y&hl=en_GB
This bit is nice and easy. If you enable the wireless access point on the camera, and connect to that AP then when you launch the Action Connect application, it will find the camera automatically. The only slight annoyance with this is that the application opening screen doesn’t rotate… but the video is correctly shown.

if[/] I can figure out how to remove the slight lag, then this set up could be used as a reversing camera (the application natively supports flipping the video!).

Pt. 7.2 – TV Freeview
Howto coming soon, but here is a teaser:

TBD

Pt. 7.3 – Gaming
Another teaser - please excuse my sniffing (allergies!) and the bad one handed gaming

TBD

Pt. 7.4 - H.U.D.
Heads up display

*EDIT* I have now decided not to fit the HUD to the Z4.... I played about with it, and it seemed a tad pointless. Given that it's a weekend car, the amount of time I will use nav in the car is small... and there isn't really enough distance between the dashtop / steering cowl bit (where I was planning to mount it) and the screen itself. It worked though, and I will fit the HUD to my everyday oilburner.

Module 8 – Cooling

The cooling issue is relatively straightforward to solve (I have now been on a few long journey's with the heat cranked up, and the problem hasn't re-materialised).

Firstly, I removed the foam from inside the back and mounted it differently. This was likely insulating the whole thing.
Image

Secondly, I covered the underside of the screen housing in foil tape to reflect the heat from the ducts.
Image

Thirdly, I covered the battery cover of the Android with the same reflective tape
And finally... I cut a hole in the back of the battery cover (it's actually the battery that was overheating)... and attached a small 4cmx4cm fan, powered by the Arduino. Once I have proved this works, I will make it thermal operated so it's not on all the time.
Image
Last edited by danmiddle2 on Mon Jun 01, 2015 10:14 pm, edited 9 times in total.
Image

User avatar
aquazi
Lifer
Lifer
Posts: 8168
Joined: Fri Oct 02, 2009 9:20 pm
Location: Derby + N. London

Re: E85 / E86 BMW Z4 – Android tablet integration - INCOMPLE

Post by aquazi » Tue Sep 17, 2013 11:49 am

wow.. thats impressive :thumbsup:

I'd never do this.. but i like to read about it!

User avatar
danmiddle2
Member
Member
Posts: 834
Joined: Mon Apr 01, 2013 10:01 am

Re: E85 / E86 BMW Z4 – Android tablet integration - INCOMPLE

Post by danmiddle2 » Tue Sep 17, 2013 12:41 pm

Thanks - a little light bedtime reading perhaps...if you are having difficulty sleeping :-)
Image

User avatar
srhutch
Moderator
Moderator
Posts: 25087
Joined: Tue Jun 19, 2007 1:22 pm
Location: East Sussex, UK
Contact:

Re: E85 / E86 BMW Z4 – Android tablet integration - INCOMPLE

Post by srhutch » Tue Sep 17, 2013 1:45 pm

Good write up, and nice link to the dash cutting post 8)
Image

User avatar
danmiddle2
Member
Member
Posts: 834
Joined: Mon Apr 01, 2013 10:01 am

Re: E85 / E86 BMW Z4 – Android tablet integration - INCOMPLE

Post by danmiddle2 » Tue Sep 17, 2013 2:10 pm

srhutch wrote:Good write up, and nice link to the dash cutting post 8)
Thanks - hope you don't mind (probably should have checked first), but it seemed easier to refer to things that have already been covered well elsewhere!
Image

Merrsh1
Member
Member
Posts: 419
Joined: Sat Jun 25, 2011 5:56 pm
Location: Teesside
Contact:

Re: E85 / E86 BMW Z4 – Android tablet integration - INCOMPLE

Post by Merrsh1 » Tue Sep 17, 2013 5:32 pm

You're either a genius or a madman. I've been looking at raspberry PI's along a similar line.

Impressive stuff. :thumbsup:

AlexB
Newbie
Newbie
Posts: 31
Joined: Mon Sep 16, 2013 4:06 pm

Re: E85 / E86 BMW Z4 – Android tablet integration - INCOMPLE

Post by AlexB » Wed Sep 18, 2013 8:54 pm

Hey Fella,

How are you streaming audio from the tablet to the mediabridge? Bluetooth, AUX or USB? my s4 running google i9505g firmware is reported as unsupported over USB and i've noticed the sound quality over bluetooth isn't that great, aux ofcourse works fine but i want to be able to control from steering wheel!

Cant find any info on what version of Android is supported over USB on this device! grrr!!

Cheers,
Alex.

User avatar
danmiddle2
Member
Member
Posts: 834
Joined: Mon Apr 01, 2013 10:01 am

Re: E85 / E86 BMW Z4 – Android tablet integration - INCOMPLE

Post by danmiddle2 » Wed Sep 18, 2013 9:35 pm

AlexB wrote:Hey Fella,

How are you streaming audio from the tablet to the mediabridge? Bluetooth, AUX or USB? my s4 running google i9505g firmware is reported as unsupported over USB and i've noticed the sound quality over bluetooth isn't that great, aux ofcourse works fine but i want to be able to control from steering wheel!

Cant find any info on what version of Android is supported over USB on this device! grrr!!

Cheers,
Alex.
I use BT - if you are getting poor audio quality, it could be using the wrong type of profile. Have you checked it's using A2DP instead of the BT-telephony?
Image

AlexB
Newbie
Newbie
Posts: 31
Joined: Mon Sep 16, 2013 4:06 pm

Re: E85 / E86 BMW Z4 – Android tablet integration - INCOMPLE

Post by AlexB » Wed Sep 18, 2013 11:16 pm

Humm good point, both profiles are selected as I also need to take calls, I might be going mad and the audio is actually fine!

https://www.dropbox.com/s/h9hwelux5jxkq ... -10-52.png?

if i deselect 'media audio' sound comes out of the phone rather than the car so presume its using the correct profile.

Jstic
Newbie
Newbie
Posts: 4
Joined: Wed Sep 25, 2013 3:42 pm

Re: E85 / E86 BMW Z4 – Android tablet integration - INCOMPLE

Post by Jstic » Wed Sep 25, 2013 3:45 pm

Any progress on completing the Arduino coding? This is awesome, very close to what I am trying to do and extremely informative.

User avatar
danmiddle2
Member
Member
Posts: 834
Joined: Mon Apr 01, 2013 10:01 am

Re: E85 / E86 BMW Z4 – Android tablet integration - INCOMPLE

Post by danmiddle2 » Wed Sep 25, 2013 7:07 pm

Jstic wrote:Any progress on completing the Arduino coding? This is awesome, very close to what I am trying to do and extremely informative.
No progress on the code, I am afraid, although the tablet is now permanently installed and hardwired into the car. I think if I spent all of my time on it I would be lonely and single, so I do have to make a little time for my best beloved, too!

The code as it stands can be used to open / close and step forwards / backwards from all of the buttons, so it should be fine for getting you started. The rest is going to take a little dev time, so I would expect progress to be slow (I am not a professional developer). I have a spare screen sat next to my chair at home, so I will fiddle with it when I get time here and there... but there are a bunch of things I need to get it to do, so like I say... it'll take a little time.

Best of luck with your project, I hope some of the write up is of use.... and hope you share your results here too!

All the best,

Dan
Image

Jstic
Newbie
Newbie
Posts: 4
Joined: Wed Sep 25, 2013 3:42 pm

Re: E85 / E86 BMW Z4 – Android tablet integration - INCOMPLE

Post by Jstic » Wed Sep 25, 2013 9:30 pm

Thanks Dan, appreciate the update. Quick question for you. You got the screen motor to operate on 7.5 volts, but the feed from the power source is 12 volt. Do you think the voltage was reduced along the way to the motor, or are you just playing it safe?

User avatar
danmiddle2
Member
Member
Posts: 834
Joined: Mon Apr 01, 2013 10:01 am

Re: E85 / E86 BMW Z4 – Android tablet integration - INCOMPLE

Post by danmiddle2 » Thu Sep 26, 2013 9:14 am

Hi Jstic - It's unlikely the motor was originally driven by 12vDC... although it is possible. When I ran it from 12vDC it worked but made an awful, juddery noise (and of course, when the car is running that would increase to ~14.5vDC). This is actually the source of the juddery noise in the first video.

It's certainly much smoother now that I am operating it from a regulated 7.5vDC supply. If I had to guess, I would imagine it is probably a 9vDC motor (lot's of BMW electronics seem to be 9vDC), but neither Siemens (who make the motor) nor BMW have been able to supply me with any technical specifications for it.

If you have a working set up to begin with, you could measure the voltage across the motor before you start... and see if I am right? :D

All the best,

Dan
Image

User avatar
CUREthe
Member
Member
Posts: 140
Joined: Thu Sep 12, 2013 9:45 am

Re: E85 / E86 BMW Z4 – Android tablet integration - INCOMPLE

Post by CUREthe » Thu Sep 26, 2013 11:48 am

Fantastic but hard work! :thumbsup: :thumbsup:

Congratulations!
Smart Pulse CDI 02' Bay Grey
BMW E30 316i 90' Delphin Metallic
BMW E85 2.2i Roadster 04' SterlingGrau Metallic

User avatar
danmiddle2
Member
Member
Posts: 834
Joined: Mon Apr 01, 2013 10:01 am

Re: E85 / E86 BMW Z4 – Android tablet integration - INCOMPLE

Post by danmiddle2 » Mon Nov 11, 2013 11:17 am

Sorry for the lack of progress, but I have been dealing with a few personal matters over the past few months so have had little time to spend on projects.

For info I have identified a new problem - heat. When driving around with the top down on colder days (as I did yesterday) and the heater cranked up to the max, the tablet brings up a warning, something along the lines of "Tablet is above operating temperature and will shut down".

Of course, you could simply turn the heat down a bit (this only manifested when it was on full blast and at the highest temp for over an hour), but that would be a pain in the arse... I am working on a fix. The Arduino should be able to drive a temperature controlled fan without too much of an issue.
Image

Post Reply