Hi, So this should be fairly straighforward. I have steering wheel controls that output a signal with a transistor, however the signal switches on the negative side. This makes it difficult to work with,and it is about 12v to make it more complicated. But i have a wiring diagram.
I'm thinking simply using another transistor will solve this, but just don't have the knowledge to make it, would it need a PNP or NPN transistor, maybe more than one? To try and avoid 12v feedback to the Arduino.
If your device switches to gnd from 12v, you need to make sure that the 12v does not get to the Arduino input. The easiest way is total isolation via optoisolators. The next is via voltage divider.
Your wiring diagram shows nothing of any transistor switching outputs.
We need to know what voltage is on the outputs (with respect to gnd) when the outputs are on and off.
Using an 11.65v lithium battery, the output is 4.6v (negatively switched), i've seen it at 5.9 before, though. It gives no voltage when no buttons are pressed.
I really like the sound of the voltage divider, it could nearly work with no transistor because of the internal resistors.
Just wondering though, when you say there is no transistor switching outputs, you aren't saying there is no transistor? I just want to clarify, because it seems ambiguous.
The thing i call a transistor in the diagram is on the right, between the 2 resistors. The 'output' is the green wire
As there is nothing to indicate what is connected to the green wire, I was not sure of what it was.
Please do not use the term "negatively switched". It causes confusion when the signal switched to ground.
If you are certain that the voltage only changes between a maximum of 5.9v and nearly ground, you can use a voltage divider to make sure the voltage does not go over 5v.
A possibly safer way is to take a 10k resistor from the output and use it to drive a general purpose NPN transistor as a switch to ground for an input on the Arduino. Use a pull-up R as well.
Perhaps not the dread "XY problem", but the related "lack of detail" problem.
The assembly in question should be quite straightforward, it has the two supply terminals and what appears to be a mis-drawn open-collector output.
The question is - are you using it as it is connected to the car wiring, or are you adapting it for some other purpose, in which case you will need to provide a pull-up resistor - say 1.5k - to the 12V for that signal wire.
You can then use a 10k resistor to the Arduino input pin with a diode from that pin to the Vcc (cathode to Vcc).
Thank you both for such informative replies, and for pointing out my issues in asking questions. I still have a lot to learn.
So far, the voltage divider works fine. But I must check the voltage when the car is running, as i can easily read the codes running from a lithium battery but the voltage is rather low in that situation.
I'm glad that there are simple solutions, with either a voltage divider or pullup resistor. It will be straightforward to find which one will work.
It will be connected to the car wiring with power and ground, with nothing but the Arduino on the output. This is so i can read the codes and convert them to infrared, negating the need for an expensive commercial solution.
Once again, thanks for such fast and helpful responses.
Edit: Hi, TomGeorge, so what i am doing is decoding the digital signal so i can send infrared remote codes to the radio. This will allow me to use the steering wheel controls again, without spending over a hundred for an overpriced gadget to do it for me. I have already decoded the signal, it helps to have an older car (1991).
Might as sell throw in a photo of the steering wheel controls, personally i find it annoying to see wiring diagrams without knowing exactly what it is i'm looking at.
Hi,
Why not just pull the IC assembly out and use it to drive the IR Tx.
Or check ebay etc for a second hand steering remote unit.
Go visit a wreckers yard.
Well, it's just because it's a bit compact, and fits nicely in the steering wheel as it is. besides, i have already decoded the signal and have the system working (off an 11.1v battery, not 14.4v). Just without the sending of IR codes part. Finding the IR codes was easy.
It's difficult to use the steering wheel controls with a head unit since the output pulses a transistor to ground rather than positive, however i fixed that with an LM317 instead of a transistor. I have it working on the bench with an 11.1v lithium battery, putting out 0.25v, but for some reason when i hook it up in the car, it puts out 11.5v or more. Nearly killed my Due with that. At least it works and retransmits IR codes.
I will happily provide the sketch, it works on signals with about 0.5ms bit pulses according to a sound card oscilloscope.