Go Down

Topic: Steering wheel control (Read 4561 times) previous topic - next topic

themlruts

Sep 07, 2012, 05:25 pm Last Edit: Sep 10, 2012, 10:05 pm by themlruts Reason: 1
This is my first ever project with the Arduino.  I have worked with basic stamp a bit.
So my project is this.  
I just bought a new truck.  I am putting a after market radio in my car.  I need to control the radio with the steering wheel control.
I know they make boxes out there to do this. This is the box I am using http://retailer.installernet.com/productfeatures.aspx?retailerid=1273&productid=23230&sid=20B26D55-DA04-4B5D-A62C-6767C92FBC25
My problem is this.  
I need to have 1 single button do two actions.  For example.  Phone button press will pick up a phone call.  Hold Phone button and it would start voice recognition.  
Since i dont know the protocol that the Pioneer unit uses I would need to use the ASWC box as well.
Steering controls------> Arduino -------->ASWC--------> Radio
Summarize
Arduino reads the resistance from the steering wheel control then sends a resistance valve to the ASWC box which then makes the radio function work.

Not sure where to start.  I did buy a nano should be here tues
Thanks
Mike


Grumpy_Mike

It is not at all clear why you want the arduino.
It is not at all clear what buttons you want to detect.
It is not clear what the arduino has to feed to the ASWC as this appeares to be a compleate solution.
It is not clear why the thread has this title.

sprao9

Use a PNP transistor to drive a constant current of about 10 mA, into the resistance which is to be measured.

Connect the output to the pwm pin of arduino and get a value corresponding to the resistance value. use that value with a digital pin to operate your radio or whatever.

hope this resolves some of the issues in your problem.

cjdelphi

Code: [Select]

int analogPin = 0;     // potentiometer wiper (middle terminal) connected to analog pin 3
                       // outside leads to ground and +5V
int raw = 0;           // variable to store the raw input value
int Vin = 5;           // variable to store the input voltage
float Vout = 0;        // variable to store the output voltage
float R1 = 10;         // variable to store the R1 value
float R2 = 0;          // variable to store the R2 value
float buffer = 0;      // buffer variable for calculation

void setup()
{
  Serial.begin(9600);             // Setup serial
  digitalWrite(13, HIGH);         // Indicates that the program has intialized
}

void loop()
{
  raw = analogRead(analogPin);    // Reads the Input PIN
  Vout = (5.0 / 1023.0) * raw;    // Calculates the Voltage on th Input PIN
  buffer = (Vin / Vout) - 1;
  R2 = R1 / buffer;
  Serial.print("Voltage: ");      //
  Serial.println(Vout);           // Outputs the information
  Serial.print("R2: ");           //
  Serial.println(R2);             //
  delay(1000);
}


I just copied and pasted this from the old forum... i want to try out this code now

themlruts

#5
Sep 10, 2012, 10:05 pm Last Edit: Sep 10, 2012, 10:07 pm by themlruts Reason: 1

It is not at all clear why you want the arduino.
It is not at all clear what buttons you want to detect.
It is not clear what the arduino has to feed to the ASWC as this appeares to be a compleate solution.
It is not clear why the thread has this title.


1.  The arduinio will give me the function to have 1 button do 2 actions. quick press or hold press
2.  Vol up, Vol down, trk up, trk down, Seek up, seek down, Phone pickup, phone hang up, Voice activate and Mode
3. The ASWC reads the Resistance there for I would need the arduino to create those Resistances and send them to the ASWC. The ASWC will only do one action per button.

I am not sure i can connect the arduino directly to the radio as i am not sure what the protocol is that the pioneer radio uses this is why the ASWC is in the picture




Grumpy_Mike

Quote
The ASWC reads the Resistance there for I would need the arduino to create those Resistances and send them to the ASWC.


In which case you need to use a digital pot to send the unit a resistance value.

http://arduino.cc/en/Tutorial/SPIDigitalPot

themlruts


Quote
The ASWC reads the Resistance there for I would need the arduino to create those Resistances and send them to the ASWC.


In which case you need to use a digital pot to send the unit a resistance value.

http://arduino.cc/en/Tutorial/SPIDigitalPot

Thanks I have ordered some samples already.


The good news is I dont need the AWSC.  The pioneer head unit just read resistance values. 
As I am new this is the code i am starting with.
Code: [Select]
int analogPin = 4;     // potentiometer wiper (middle terminal) connected to analog pin 3
                       // outside leads to ground and +5V
int raw = 0;           // variable to store the raw input value
int Vin = 5;           // variable to store the input voltage
float Vout = 0;        // variable to store the output voltage
float R1 = 15;         // variable to store the R1 value
float R2 = 0;          // variable to store the R2 value
float buffer = 0;      // buffer variable for calculation

void setup()
{
  Serial.begin(9600);             // Setup serial
           // Indicates that the program has intialized
}

void loop()
{
  raw = analogRead(analogPin);    // Reads the Input PIN
  Vout = (5.0 / 1023.0) * raw;    // Calculates the Voltage on th Input PIN
  buffer = (Vin / Vout) - 1;
  R2 = R1 / buffer;
  Serial.print("Voltage: ");      //
  Serial.println(Vout);           // Outputs the information
  Serial.print("R2: ");           //
  Serial.println(R2);             //
  delay(1000);
if(( R2 > 21 ) && ( R2 < 23) )
{
digitalWrite(13, HIGH);
}
else
{
digitalWrite(13, LOW);
}
}

Grumpy_Mike

As R2 is a float then you will be lucky to get it into such a range.
Vin is an int and so needs casting as a float before doing sums with it.

themlruts


As R2 is a float then you will be lucky to get it into such a range.
Vin is an int and so needs casting as a float before doing sums with it.


You completely lost me there.  Can you explain? Float?

Far-seeker



As R2 is a float then you will be lucky to get it into such a range.
Vin is an int and so needs casting as a float before doing sums with it.


You completely lost me there.  Can you explain? Float?


He means the variable is of the float data type.

themlruts

got it so i think i should covert the float to interger?

Far-seeker


got it so i think i should covert the float to interger?


An unsigned integer would give you a much larger absolute value.  Furthermore, negative ohm resistors are hard to come by. ;)

themlruts

Can anyone help write the case statements for this? 

Grumpy_Mike

For what? It dosn't look like a case statement is sutiable here.

Go Up