>

E85 / E86 BMW Z4 – Android tablet integration

ok.. found a difference between what Dan had posted, and what I had encountered!

On this pic
z195.jpg

Dan says the grommet can just be prised free
However, mine was not as his!

To get mine out, I had to first open the back casing from the screen and remove a small blue plastic clip.
As pictured here:

9x7FsWd.jpg


just an interesting difference :)
 
Sorry folks - haven't updated this in a while and hadn't checked back (feel free to PM me for a quicker response next time!) Sorry. :oops:

The power supply is quite simple you need one of these:
http://www.ebay.co.uk/itm/DC-DC-PWR-SUPPLY-12V-to-9V-15W-3A-Suit-ARDUINO-RASPBERRY-Pi-UK-Based-/131147707381?pt=UK_BOI_Electrical_Test_Measurement_Equipment_ET&hash=item1e890333f5

I originally used 7.5vDC and that just caused some issues with consistency of the movement of the motor. 9vDC works much better. As I stated somewhere in the howto, this is glorified guess-work, but is still working ok for me.

Also you need one of these:
http://www.ebay.co.uk/itm/2-Add-A-Circuit-Fuse-Tap-Piggy-Back-Standard-Blade-Fuse-Holder-ATO-ATC-12v-24v-/170709632237?pt=UK_Cars_Parts_Vehicles_Terminals_Cabling_ET&hash=item27bf1644ed

This picture shows where I mounted the DC/DC voltage regulator and how I wired it to the arduino. The croc clips, you just need to replace with a +ive from the piggy back fuse connected and earth the other end somewhere else. Make sense?

v73m.jpg


I'll tidy this up and add it to the howto when I get a min, but in the meantime please PM me.

All the best,

Dan
 
For the Phablet power supply I used one of these http://www.ebay.co.uk/itm/1X-DC-12V-to-5V-3A-15W-USB-Car-output-power-adapter-Converter-Step-down-Supply-/261313026987?pt=LH_DefaultDomain_0&hash=item3cd7785bab
 
Hi Danmiddle2,
I found the pair of wires for my motor and they are in the same orientation, where opposite poles are tied together. Is there any specific position these wires need to be put into the motor shield? Your tutorial just says the pairs need to be put together but does it matter which wire goes into which of the two slots?

Thanks
 
here's my working sketch for detecting +ACC (ignition live)
Code:
#define OPEN_BUTTON 6
#define CLOSE_BUTTON 7
#define STEP_OPEN 2
#define STEP_CLOSE 4
#define ACC_DETECT 10

int accState = 0;

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 +ACC detection pin
  pinMode(ACC_DETECT,INPUT_PULLUP);
  
  //read the state of the +ACC detection pin
  accState = digitalRead(ACC_DETECT);
  if (accState==LOW)
  {
    //initial power state is on
    sk93_screenUp();
  }
  else
  {
    //initial power state is off
    sk93_screenDown();
  }
  
   //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(ACC_DETECT);
  if (switchValue != accState)
  {
    if (switchValue==LOW)
    {
      //power has been turned on
      sk93_screenUp();
    }
    else
    {
      //power has been turned off
      sk93_screenDown();
    }
    accState = switchValue;
  }

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


void sk93_screenUp(void)
{
  for (int i=0; i < 14; i++)
  {
    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(25);
  
    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(25);
  
    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(25);
    
    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(25);
  }
  
  //set all pins off after operation
  digitalWrite(8, LOW); //DISABLE CH B
  digitalWrite(12, LOW); //DISABLE CH B
  digitalWrite(9, LOW); //DISABLE CH B
  digitalWrite(13, LOW); //DISABLE CH B
  analogWrite(3,0);
  analogWrite(11,0);
}

void sk93_screenDown(void)
{
  for (int i=0; i < 14; i++)
  {
    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(25);
  
    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(25);
  
    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(25);
    
    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(25);
  } 
  
  //set all pins off after operation
  digitalWrite(8, LOW); //DISABLE CH B
  digitalWrite(12, LOW); //DISABLE CH B
  digitalWrite(9, LOW); //DISABLE CH B
  digitalWrite(13, LOW); //DISABLE CH B
  analogWrite(3,0);
  analogWrite(11,0);
  
}


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);
}

it requires pin ten to connect to the ground pin on the arduino, via the switched side of a 12v relay.
the other side of the relay connects between the headunit's +12v antenna out pin and its respective cable.


what this will do is:

1: when the arduino is powered on, it'll read the current state of the ignition power, and either attempt to raise or lower the screen accordingly.
2: once on, it will continue to monitor. if the ignition is turned off, it will lower the screen. if it is turned on, it will raise the screen.



:thumbsup:
 
When you say +12v antenna and its respective cable, do you mean its okay to connect it in series? Or do you mean tap into it and run the other side of the relay coil to any ground point?

Why not use one of these for the relay?
DC 12V relay module delay switch NE555
If the input and output here are electronically isolated, this might be a good idea and have a second or two delay so that if you turn off the radio and back on real quick it won't close and open with the radio right away. I think the original screen closed after the car was turned off for about 2 seconds or so. Could always just program that delay into the arduino and have it more precise than turning a pot but if you need a relay anyway, might as well.. these are usually cheaper than regular 12v relays too.
 
Just got the Arduino board and uploaded some test sketches with no issues, and uploaded the script. Waiting on the motor shield but once that arrives I should be good for testing. Thanks for doing all the hard work :)

For this setup as its written it would be best to close the screen if you have it open, before you turn on the radio, so that it doesn't try to open it again.
Same thing as if it was closed after the radio was turned on, it would be best to open it back up before turning off the radio.

I'll look more into it, perhaps we can use a magnetic reed switch to sense the position of the screen. I wonder if this is what the circuit board inside the motor housing was responsible for, since it has 11 wires instead of the 4.
 
When connecting the motor wires, pairs have to go together, but do they have to be in a particular order? If the coils were put on in opposite directions, wouldn't it fight itself? Or does the arduino know which is which?
 
In your setup, don't you always have the screen juttering in the beginning?

For example, if the screen is down, when you turn the car on, and the radio isn't on, it'll jutter trying to close itself.
But if you have the radio on it'll open, and stay open, but nothing's going to close the screen when the car is turned off along with the radio since the arduino will lose power the same time the radio does. Am I making sense here? Or does the radio turn off before the switched power supply is cut?
 
Back
Top Bottom