Arduino driven SWC used parallel in 12V and 5V

Currently I hooked up an Audi OEM controller to my Android Headunit, but I not only want it connected to my Headunit directly but additionally via Arduino to deepen the control inside 3rd party apps, since that is not possible via normal SWC on the unit (only Vol Up, Vol Down, Mute works)

To make things more clear here is an illustration of what I'm trying to achieve:

Currently the 12V wire and the GND and Orange wires are connected to the Headunit and everything is working great. However the Yellow wire which is supposed to be hooked up to my Arduino isn't just yet.

Whichraises my actual question:

Is it possible to have the Yellow wire and ground hooked up to the Arduino parallel to the 12V SWC connection made to the unit? Or will it fry the 5V Arduino?

Orange and Yellow wires are of course analog signals from the controller.

Huge thanks in advance!

You need to measure the voltage on that yellow wire. If it is greater than 5V then you must cut it down with a potential divider or isolate it with an opto isolator.

Is it possible to have the Yellow wire and ground hooked up to the Arduino parallel to the 12V SWC connection made to the unit?

Only if you connect the 12V to the power jack of the Arduino. However in a car the 12V line often exceeds 12V due to the battery charging circuit and can get up to 14.5V. This may be too much for the voltage regulator to cope with. Or if you are using a cheap clone the capacitors on the regulators might blow because of excess voltage.

Car electronics is normally "something else" and they are not as simple as they might first seem.

The analogue singal from you controller only seems to go into the Arduino, you show nothing going from the Arduino to anywhere. Be aware that the Arduino Uno does not have an analogue output, and the types of Arduinos that do have them will only output a maximum of 3.3V.

Thanks for the reply!

Well I measured the voltage with a multimeter on the Yellow Wire and Ground (both on the controller device) and I see no change in voltage :confused: But I see changes in resistance :slight_smile:

Sorry, I should mention that there is also a push button encoder hooked up to the arduino, here is an updated sketch:

The Controller device gets 12v power and ground from the headunit, the encoder gets VCC and GND from the Arduino (Spark Fun Pro, Arduino Nano clone, I think) which is connected via USB to the headunit to give HID values on encoder press.

So I should attach the power from the Arduino to the controller device even tho its already connected to the 12v of the headunit? Isn't Ground and the Yellow Wire enough to measure the resistance values and go from there? (Of course by hooking up a potential divider as you suggested)

So I should attach the power from the Arduino to the controller device even tho its already connected to the 12v of the headunit? Isn't Ground and the Yellow Wire enough to measure the resistance values and go from there

Yes.

But I see changes in resistance

If that indeed is true then it sounds like you only need a pull up resistor on the analogue input to 5V. Make it Close to the same value as the mid resistance of the range you measure.

Ok on the encoder but I still don’t see any outputs from the Arduino into your system, so I am still not sure what it is doing in the overall scheam of things.

Ok on the encoder but I still don’t see any outputs from the Arduino into your system, so I am still not sure what it is doing in the overall scheam of things.

The Arduino is connected via usb to the headunit where it gets power from and where its also converting the encoder signal to HID input in letters. I am then using a software to translate those letters into command buttons like 'Next Track' 'Home' 'Back' etc

Yes.

Yes in terms of attaching the power as you said, or in terms of connecting ground and yellow wire only?

Here is a new schematic to understand what you are suggesting, is that correct ?

So the 12V, Ground and the Yellow wire from the controller are connected to the Arduino WHILE the controller is getting 12V and Ground from the Headunit itself.

Or in another words the 12V and Ground cable between the controller and the Headunit are split into 2 other cables which are connected to the VCC and GND of the Arduino, as well as the extra Yellow Wire for the analog signal also from the controller to the Arduino :slight_smile:

But then what should be put through the potential divider to the Arduino, the 12V and ground cable only? Or also somehow the yellow wire?

Thank you for your help so far!

If the Arduino is getting its power from the USB then there’s no need to connect your 12V to it as well.

If there is no voltage output on the yellow wire and only a resistance change there is no need for a voltage divider, you just need a pull up resistor to 5V..

If the encoder is a separate thing then there is no need to feed it with 12V, connect it to 5V from the Arduino and then both the encoder outputs and the push button can be connected directly to the Arduino. The button should work as a push button to ground, so enable the internal pull up resistor for that pin.

Thanks for the quick and simple answer! It makes a lot more sense now.

If there is no voltage output on the yellow wire and only a resistance change there is no need for a voltage divider, you just need a pull up resistor to 5V..

So pull-up resistor needs to be between the 5V VCC of the Arduino and the Yellow wire?

So pull-up resistor needs to be between the 5V VCC of the Arduino and the Yellow wire?

So pull-up resistor needs to be between the 5V of the Arduino and the Yellow wire - yes.

And as I said in reply 3:-

Make it Close to the same value as the mid resistance of the range you measure.

Make it Close to the same value as the mid resistance of the range you measure.

What exactly do you mean by that?

If you measure the resistance change to be between 0 and say 20K. The mid resistance range is 10K. Then make the pull up resistor 10K.

If you measure the resistance change to be between 1K and say 240K.
The mid resistance range is (240 -1K)/2 = 119.5 Then make the pull up resistor 120K.

and so on.

I just wanna say a big Thank you for your help, I will report how it turned out when I install it tomorrow. I learned a lot about electronics through this one post :slight_smile:

Quick update:

I realized I made a mistake (quelle surprise) I measured the ground of the 12V controller and not the Arduino ground. So when I connected a resistor between the 5V of the Arduino and Analog yellow wire of the Controller, nothing happened :confused: So again, how can I connect the Controller (12V) to the 5V Arduino without frying it and get some resistance values?

I measured the ground of the 12V controller and not the Arduino ground.

These two points should be connected together. Your diagrams show them connected together. Once you do you should be able to measure the resistor.

So again, how can I connect the Controller (12V) to the 5V Arduino without frying it

If like you say this is purely a resistance then you can not get 12V into your Arduino. If it is not and the signal has some voltage to it then you need a voltage divider.