Emulate Steering Wheel Controls to Radio

Hi people!

Here's my situation. I have an imported radio and I would like to send it commands from an arduino. From what I am able to determine, the unit expects to see a few buttons, each followed by a different value resistor, which then connects to ground. If I take a resistor and touch the wire (KEY1) while I am touching the other end of the resistor (apparently, I'm ground) it will register a keypress.

I had been thinking that I could use the a PWM pin of the arduino to drive a transistor (PN2222A) and the radio would read the average of the PWM signal as resistance, and register a key. It seems to not be working.

Is there a way to smooth out the signal? Or am I going about this in the wrong way? Keep in mind, outputting voltage isn't needed here, I need to offer the KEY1 line different values of resistance to ground.

Any ideas?

Thanks!

Edit: Searching specifically for steering wheel controls has turned up a device called a "digital potentiometer". Sounds like this is what I should be using.

Sure, what you can do is connect the Arduino outputs to the base of a transistor (through a resistor), emitter grounded. Then connect the resistor value that selects the key on the transmitter, to the transistor's collector.

It seems like you're confusing digital and analog signals. A keypress is a digital value, why would you use PWM? The resistor you mention supplies the analog bias that the transmitter requires. All you need to do is ground it with the transistor's collector.

Then, a high value on the Arduino output will cause the transistor to conduct, in effect "grounding" the resistor for you. It's called an "open collector" driver.

Well, I need multple resistor values, because there are multiple buttons sharing one wire.

Like this:

http://www.instructables.com/id/How-to-access-5-buttons-through-1-Arduino-input/step3/The-theory-Multiple-buttons-on-one-pin/

I know that you can generate different voltages with a PWN pin, a resistor and a small capacitor for PWM smoothing. I was hoping I could generate a variable resistance with PWM and a transistor, but that doesn't seem to work.

So I'm onto the digital potentiometer. They are available in 5k, 10k, 50k and 100k ohms versions with 64 settings.

I know the radio puts out 5v. I think I need to measure the amps it puts out, to determine which digipot I need.

clearchris: Well, I need multple resistor values, because there are multiple buttons sharing one wire.

Yes, you would need 5 outputs and 5 transistor circuits to do it with the open collector method. With your digital potentiometer, how do you intend to register a non-press? No keys pressed? Because that would be infinite ohms.

clearchris: It seems to not be working.

Is there a way to smooth out the signal?

Yes, an RC filter.

aarg: Yes, you would need 5 outputs and 5 transistor circuits to do it with the open collector method. With your digital potentiometer, how do you intend to register a non-press? No keys pressed? Because that would be infinite ohms.

Now that's an excellent question. I suppose I'll have to use a transistor to offer the infinite ohms. On the plus side, that means I only need one AD5171 to run the two lines to the radio. Each digital pot has A and B (opposite sides of the pot) terminals and one for the wiper, so if I hook up transisistors before the A & B terminals and W to ground, then I can get away with one chip.

I'm waiting on some sot23 to dip adapters, so I'm doing some testing to find out how I can provide infinite ohms to simulate no button press.

Unfortunately, when I hook up the transistor with a resistor to test, I can't read the ohms of the resistor. I think there is some leakage coming from the transistor which confounds my multimeter. I assume this will also cause problems with the radio.

I will post a schematic in my next post.

So, am I doing something wrong here, or do I need an optocoupler or a relay to make this work?

Thanks!

Schematic attached.

Hi, You do have the gnd of the arduino and gnd of the radio connected together?

Tom..... :)

clearchris:
Unfortunately, when I hook up the transistor with a resistor to test, I can’t read the ohms of the resistor. I think there is some leakage coming from the transistor which confounds my multimeter. I assume this will also cause problems with the radio.

I will post a schematic in my next post.

So, am I doing something wrong here, or do I need an optocoupler or a relay to make this work?

Thanks!

You really can’t directly measure resistance of a “live” circuit with a multimeter. Measure the voltage across the 220 ohm emitter (assuming NPN) and use Ohm’s Law to calculate total R.

TomGeorge: Hi, You do have the gnd of the arduino and gnd of the radio connected together?

Tom..... :)

As a matter of fact, during testing, I did not. Your question leads me to believe that this is a problem. I'll retest with them connected. Thanks!

Paulcet: You really can't directly measure resistance of a "live" circuit with a multimeter. Measure the voltage across the 220 ohm emitter (assuming NPN) and use Ohm's Law to calculate total R.

Yes, NPN was used. So use voltage drop across the resistor to calculate the resistance. Thanks!

What was the result?

I am looking to do something very similar. Essentially I am taking the vehicle's speed as an input and using it to control volume up or down buttons. I have the code setup to allow for taking in the speed as input and sending out a HIGH output to a transistor (NPN) to close a circuit. I just can't figure out how to wire it all up.

I am using BC547 transistors (http://www.arduino.cc/documents/datasheets/BC547.pdf).

One is connected to an output pin 2 on the arduino to close a circuit for emulating a resistance value equal to that needed for Volume Up.

Another is connected to a separate pin (13) to close a different circuit for emulating a resistance value equal to that needed for Volume Down.

The resistance essentially needs to be sent to the Pioneer radio through a 3.5mm jack that plugs into the back of the unit. I plan to cut a 3.5mm cable in half and wire up two of the wires from the cable into the resisted circuits. I will have to connect to both of the resisted circuits with the 3.5mm cable. I will also have to make sure that when the NPN transistors are not being activated, that the resistance reads infinity as the circuit will be open. (Simulating no buttons being pressed).

Resistance values were derived from this forum post. (http://forum.arduino.cc/index.php?topic=230068.0)

I've also included a drawing of what I think is supposed to be how it hooks up but, my little knowledge with circuit building makes me think I'm probably a bit off and hopefully someone can steer me in the right direction.

|500x375

The above image may be hard to see. If so, you can see it bigger by right clicking on it and then choosing to open it in a new tab.

Also, I forgot to label them but, the NPN transistors are connected just after the 220ohm resistors on pins 2 and 13.

Is the ground of your Arduino connected to the sleeve of the jack plug one way or another?

Are the NPN transistors connected so their emitters are connected to the sleeve?

Archibald: Is the ground of your Arduino connected to the sleeve of the jack plug one way or another?

Are the NPN transistors connected so their emitters are connected to the sleeve?

No but I can add the ground and also make sure its connected to the emitters. Is that all that I am missing?

geruta: No but I can add the ground and also make sure its connected to the emitters. Is that all that I am missing?

I expect you have connected your Arduino ground to vehicle 'ground'. I would expect the sleeve of the jack to be connected to ground via its socket in your head unit but we cannot be certain of this. That would create the necessary circuit for transistor base current to flow.

I cannot recommend connecting the sleeve to ground just in case it damages your audio. It's probably connected to ground when plugged into the head unit anyway.

Are you disconnecting your steering wheel controls and instead plugging the jack shown on your drawing into the back of the head unit?

Have you tried connecting a 16kΩ or 24kΩ resistor on its own to your head unit via the jack plug lead? Does it give the expected change in volume?