Current version of the OpenAuto Pro is 13
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Steering wheel control guidance
#31
Yeah, like I said on my Honda, I had the resistor values from the Service Manual.

Basically, I'd get to the steering wheel controls, and measure the DC voltage to ground from both the analog pins. Then I would press the mode button, and record the voltage that changed. The I would go to the other analog wire, press all the buttons, then record the voltage for each button press.

I would then disconnect the plug to the buttons. At that point you'll have to put the ground lead of your voltmeter on the pin that is ground for the steering wheel controls, as when you unplug it, you are also unplugging ground.

With the meter set to Ohms, record the Ohms reading for both wires with no buttons pressed, for the mode button press, and then the other wire's multitude of button presses.

With those voltages and ohm readings, we can determine the resistor values in the wheel, the supply voltage, and probably even the resistors in the radio between the supply and the plug going out to the wheel controls.

I know in my Honda, after taking those measurements, I confirmed the values in the steering wheel, and found that the supply was actually 5V. I also calculated the resistor that was inside the radio. It was a little more important in that case as I used digital outputs of the Arduino to trigger opto-isolators to simulate button presses on a twin to the resistor ladder that was in the wheel. That way the Arduino could do button presses as well, and the factory stereo could read them.
Reply
#32
(03-22-2021, 10:03 PM)interzen Wrote: I actually used the 3.3v version of one like this: https://www.amazon.com/ARCELI-Atmega32U4...ref=sr_1_6

The official Arduino Micro you ordered uses the same ATmega32U4 and should work fine with my steering control code.  The main difference is that it appears to be a 5v µc running at 16MHz vs the 3.3v µc at 8MHz I used.  The keypresses are sent over the USB cable to the Pi so it should not matter for that use.  I went with 3.3V because I am also connecting some IO pins directly to the Pi GPIO and that needs to be at the lower voltage.

The switch to 5v should not effect anything, just connect to the 5v pin on the micro instead of the 3.3v in my diagram.  The analog inputs on that board will convert 0v-5v inputs to values 0-1023.  If you get unexpected results you can uncomment the serial debugging lines and use the serial monitor in arduino IDE to see what the analog readings are when you press a button.  

You could debug this from a laptop in the car by temporarily substituting regular characters for the KEY_F7 and KEY_F8 and opening a text editor to see the key presses sent from the micro.  Alternatively you could measure the resistances between the ground and the two signal pins when no buttons are pressed and when each one is pressed and simulate them on the bread board.  That's what I did with one push button for the signal that seemed to change the same no matter what button was pressed and a jumper wire to select the specific resistance on the other line for the particular button to be simulated.

Here is my messy test circuit using various resistors from my parts bin in parallel and series to approximate my measurements from the truck:
[Image: 51064083361_5a1bc02c1c_b.jpg]

The button switches signal-1 between two resistances indicating key pressed/un-pressed and the orange wire was moved to select the resistors for a specific key on signal-2.

Unfortunately I still have not located the piece of paper I did my resistance and analog reading calculations on.

interzen,
Just curious,  did you happen to find your notes on the values of the button resistors?

I want to try and build this out on my desk,  and just see if I can get it working.  and would like to try and use the same resistors that the actual wheel has.

Question in the code,  just trying to understand how it works.
When I see this
wheel_ctrl_1 > 604

Does the 604 represent a resistance value?  or something else?
Reply
#33
That 604 is the digital representation of an analog voltage value.

The Arduino reads the analog voltage and returns a value between 0 and 1024 I believe, representing a value between 0 and 5V.

Attached is my CAD drawing of the resistors in my wheel and the voltages I read, all from the Honda.


Attached Files
.pdf   Accord Car PC 3 Model.pdf (Size: 51.94 KB / Downloads: 8)
Reply
#34
Elaborating on @jhornbr255's post, the values shown in the code represent the relative transition voltages between specific button states.

The calculation is (V_input / V_reference) * 1023 
This gives a value of 0 if the input voltage is 0V and a value of 1023 if the voltage is equal to V_ref.

In your case V_reference is 5V and the resistor network/divider circuit will be fed from the 5V pin, returning possible voltages between 0V and 5V on the analog input.

If (voltage on the wheel_ctrl_1 / V_ref) * 1023 is greater than 604 then the control is in idle state with nothing pressed.  When any button is pressed the resistance on that line of the steering control drops and the analog reading goes below that threshold and the program reads the wheel_ctrl_2 input to determine which button is being pressed.

I have not found my scratch paper with the resistance measurements from my tacoma and I don't have easy access to the connector ATM.  I can reverse the calculations and give you approximate resistances that will work with the program but I cannot guarantee they match the exact resistances.

In my circuit the wheel_ctrl_1 input is pulled high by a 100Ω resistor.

That sets up a resistor based voltage divider circuit and the voltage at the analog input is fed by this circuit:

V_ref
  |
(100Ω)
  |----------------- Analog input A2
(R_ctrl1)
  |
Ground

The calculation for the value read on analog input wheel_ctrl_1 (A2):
wheel_ctrl_1 = R_ctrl1 / (100Ω + R_ctrl1) * 1023.
 
After refreshing my algebra skills, solving this for R_ctrl1 gives this:
R_ctrl1 = 100Ω * ( (wheel_ctrl_1 / 1023) / (1 - (wheel_ctrl_1 / 1023) )

for an analog reading of 604 I calculate this resistance:
100Ω * ( (604/1023) / ( 1 -  (604/1023) ) = 100Ω * ( .59042 / ( 1 - .59042) ) = approximately 144Ω

This means that the resistance on the steering control line 1 is higher than 144Ω when nothing is pressed and drops below it when a button is pressed.  I don't know the exact values and I don't think it dropped to 0Ω on button press but until you measure the exact values you could use a 10kΩ resistor and a switch that shorts to ground when pressed.

5V
|
(100Ω)
|
|-------------------------- Analog input A2
|
|--------------|
(10kΩ)      Switch (normally open)
|--------------|
|
Ground

When the button is not pressed this should give an analog reading of 10000Ω / (100Ω + 10000Ω) * 1023 = 1012 which is > 604
When the button is pressed that would change to 0Ω / (100Ω + 0Ω) = 0 which is < 604

I think the resistance when pressed was greater than 0. Possibly 22Ω but 0Ω will work for testing.

I chose the analog values to be half way between each input state. I can also use these analog transition values in the next part of the code to reverse engineer compatible resistances.

wheel_ctrl_2 reading : Mode > 875  > Vol Down > 602 > Vol Up > 340 > Ch Down  > 107 > Channel Up >=0

if Ch Up is 0Ω then the analog reading for that would be 0. 
A value of 107 would be half way between 0 and the reading for Ch Down.  This means Ch Down gives a reading of 214. 
340 is between Vol up and that 214 (Ch Down) which means Vol up gives a reading of 466.
602 is between Vol Down and that 466 (Vol up) which means Vol Down gives a reading of 738.
875 is between mode and that 738 (Vol Down) which means mode gives a reading of 1012.

My circuit feeding the wheel_ctrl_2 input uses a 120Ω pull up resistor so the resistance calculation is:
R_ctrl2 = 120Ω * ( (wheel_ctrl_1 / 1023) / (1 - (wheel_ctrl_1 / 1023) )

Using that I get:
Mode: 1012 -> R_ctrl2 = 11040Ω ~= 11kΩ
Vol Down: 738 -> R_ctrl2 = 310.7Ω ~= 330Ω
Vol up: 466 -> R_ctrl2 = 100.4Ω ~= 100Ω
Ch Down: 214 -> R_ctrl2 = 31.7Ω ~= 33Ω
Ch Up: 0 -> R_ctrl2 = 0Ω (direct short to ground)

The circuit for the second line
5V
|
(120Ω)
|
|-------------------------- Analog input A1
|
(R_ctrl2 Ω)  
|
Ground

Substituting R_ctrl2 with one of the values above will simulate the associated button when you press the switch in the second circuit I drew.

Hope this gives you what you need to understand the circuit and simulate the control.  I probably could have pulled apart my dash and read the resistances again in less time than it took to write and calculate this but at least I refreshed my algebra in the process Cool
Reply
#35
wow so very helpful.
Now I need time to work on this project. I have it about done on my desk, but I need to get it installed.
Also need to buy an amp and a sub still. $$$$$$$
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)