SparkFun Forums 

Where electronics enthusiasts find answers.

Have questions about a SparkFun product or board? This is the place to be.
By hassmaschine
#140859
Mee_n_Mac wrote:
hassmaschine wrote:The transistors are basically acting as relays to turn on the indicator lights (left turn signal, right turn signal, high beam, fog light, and two ABS indicators). Since I'm not using the light control computer that goes with this cluster, i need to turn them on manually. The signals on my car are active high (12v), while the signal lights on this cluster are active low (ground). I've tested it already and they work flawlessly. :D
Are the indicators some type of incandescent light bulb or LEDs ? If they are the former you could forgo the resistors from 5V to the collectors and perhaps even the diodes, and just attach the bulbs to the 2N2222 collectors. It'll save space, parts and electricity. If the indicators are LEDs then your circuit may work but eventually I predict LED failures as there doesn't seem to be any current limiting resistor(s).
They are LEDs, and the current limiting resistors are built into the cluster already. I'm just providing a ground path that is normally switched on by the CPU of the cluster.
hassmaschine wrote:For the dimmer, I could just use 10k, 10k, 13k, and 14k, right? I'm not actually very worried about the dimmer circuit - it doesn't need to be super accurate. I just want some control over the brightness and for it to be linked to my stock dimmer switch. Otherwise I was just going to hook it straight up to 12v with a resistor.
Dimmer ? What dimmer ? :mrgreen: Is this the op-amp circuit with 100's of ohms ? If so yes, 10K - 14K in place of 100 - 140 ohms is good.
hassmaschine wrote:any suggestions on a cap size? I probably have a bunch laying around actually.
100 nF is typical.
Yeah, I need another inverting op-amp to dim the LED backlights with the stock light switch. same thing as the gas gage, just a different scale.

done and done, schematics/PCB updated.
By Mee_n_Mac
#140864
hassmaschine wrote:They are LEDs, and the current limiting resistors are built into the cluster already. I'm just providing a ground path that is normally switched on by the CPU of the cluster.
Something like the below is what's generally done.
LED_drivers.jpg
For that matter, how sure are you that whatever you have driving the 2N2222's won't drive the intrument cluster all by itself. Most MCU output pins can sink 20 mA or so, which is about the normal current level for an LED. That said, there usually is a total current spec (for all the pins together) that shouldn't be exceeded.
You do not have the required permissions to view the files attached to this post.
By hassmaschine
#140868
that's what the diodes are for. the inputs from my car are all 12v (it normally drives the bulbs directly). Anyway, I've tested it, and it works perfectly. :)

thanks for all the help! I want to check one more thing (see if the backlights will work on 5v instead of 12v) and then I'll order the board and components.
By Mee_n_Mac
#140883
hassmaschine wrote:that's what the diodes are for. the inputs from my car are all 12v (it normally drives the bulbs directly). Anyway, I've tested it, and it works perfectly. :)
I'm still not sure what the diodes are for but ... Here's my comparison FWIW (your schematic on the right).
LED_driver_compare.jpg
You do not have the required permissions to view the files attached to this post.
By hassmaschine
#140911
I think i know what you're saying - it looks like i have two diodes in a row. But:

-the input from the cluster is 12v, not 5.
-the other inputs from the car.high beeam, turns) are 12v

And most imporantly, between the two diodes is a connection to the CPU of the new cluster. The "extra" diode stops 12v from reaching that pin, but allows the 2n2222a to complete the ground and turn on the leds. :)
By Mee_n_Mac
#140930
hassmaschine wrote:I think i know what you're saying - it looks like i have two diodes in a row. But:

-the input from the cluster is 12v, not 5.
-the other inputs from the car.high beeam, turns) are 12v

And most imporantly, between the two diodes is a connection to the CPU of the new cluster. The "extra" diode stops 12v from reaching that pin, but allows the 2n2222a to complete the ground and turn on the leds. :)
OK ... I thought the op-amps were running off of 5V from the cluster. But now that I look more closely I can see that only U1 is running off of what I thought was 5V. It looks that U2 is running from whatever pin 20 provides, presumably 5V. U1 is running from pin 2's voltage ... which I now understand to be 12V (or the battery, 12-13.5V). So if I've now got that correct let me still say that you could eliminate all the resistors tied to the "pin2" line and leave only the op-amp (U1) tied to it. Those resistors do nothing but waste power ... maybe.

With those resistors gone, there's no need for the diodes, at least that I can see. Maybe.

As I think I understand it from the above (see underlined and bolded), the high beam, turn signals, etc, all provide some battery voltage to the base(s) of the transistor(s) though the 1.5 K resistor(s). When each device (high, turn, etc) is switched on, the appropriate transistor goes saturated and provides a "ground" to the clusters. This makes the appropriate LED go on and also sends a "low" signal to the CPU of the new cluster. So my question now is ... what does the new cluster need to "see" when those signals are not "low" ? Whether you loose the resistors and/or diodes or not, those new cluster CPU inputs will "see" what I labeled "Vcc" in the diagram below (assuming I've got the diagram correct). They'll get some very small, itty bitty current through the cluster LEDs and their dropping resistors. There won't be much of a voltage drop through those so the "high" (transistors off) voltage between the diodes would be Vcc. Is that OK ? It would seem to be designed into the new cluster so I'd guess it would be OK but ... maybe I'm not getting where those CPU inputs are quite right.

I put the maybes above because I think I'm missing part of the picture. My guess is you put the resistors above (that I say can be eliminated) in for some reason, perhaps to be pull-ups for the aforementioned CPU inputs ? If so the D1-D6 diodes aren't doing what you want. Or I'm missing something ... :doh: :think:
LED_driver_compare2.jpg
You do not have the required permissions to view the files attached to this post.
By hassmaschine
#140941
I think what may be confusing is these 2n2222a circuits.. they are totally unrelated to the U1 and U2 op-amps! the only thing they really share is a ground plane. I actually realized that the backlights run on 5v, not 12v. I adjusted U1 to run on 5v now. but, it was still unrelated to the indicator LEDs.. :)

I tried the indicators without 12v connected to the upper pin in your diagram - it doesn't work. I found that the signal voltage and the voltage at that pin need to match for it to switch on the ground plane - since the signal from my car is 12v, the other pin needs to be a constant 12v as well. I do appreciate the possibility of saving some space - but, the circuit works perfectly. the resistors are to prevent frying the 2n2222a (already melted two). The pin at the CPU is an output, not an input - the cluster won't "see" anything (I've tested it too). All I'm doing is shorting the LED's to ground. the diode is keeping 12v from feeding back into the cluster where it doesn't belong. Maybe there's another way I can configure the 2n2222a to eliminate the extra parts?

moving onto the more difficult problems - testing my crude prototype op-amp circuit, I've found a problem. The circuit I built doesn't follow the curve I want exactly, but it doesn't matter for testing purposes - what I want to see is the output voltage range match what the cluster is expecting. it does that easily, I have a range of about .1v to 3.15v. the cluster only needs .9 to 2.75v

BUT - when I hook it up to the signal pins from the cluster, it gets "clipped". it will stop decreasing at about 1.6v. even though the output from the op-amp at that point is less than half a volt. This must have something to do with how the ADCs are built - they must be putting out some amount of voltage thats leaking into my circuit? this is where i get foggy..

Guessing for a solution, I tried hooking a resistor from the output to ground. it worked - around 50 ohms brought the low-voltage end of the curve way down to the point where I can now reach ~.9v as expected. Well, except now I only get 2.5v max out of the op amp, but if I just change the slope of the curve to get more power out of it with a full input, I can get that extra .25v and have a full range sweep. I'lll probably add a 100ohm pot to the PCB so I can adjust the bottom of the slope to where I want it, and change the resistors to get ~3v out of the op-amp when the input is "full".

I also made some headway into figuring out the gauge's software calibration. Actually it al made alot of sense once I just thought about the values and multiplied/divided them by 10's. I can manipulate the tank empty and full values, the ADC curve, and the voltage transfer curve. This gives me some wiggle room to adjust once I can get a full range signal to the cluster..
By Mee_n_Mac
#140961
hassmaschine wrote:I think what may be confusing is these 2n2222a circuits.. they are totally unrelated to the U1 and U2 op-amps! the only thing they really share is a ground plane. I actually realized that the backlights run on 5v, not 12v. I adjusted U1 to run on 5v now. but, it was still unrelated to the indicator LEDs.. :)

I tried the indicators without 12v connected to the upper pin in your diagram - it doesn't work. I found that the signal voltage and the voltage at that pin need to match for it to switch on the ground plane - since the signal from my car is 12v, the other pin needs to be a constant 12v as well. I do appreciate the possibility of saving some space - but, the circuit works perfectly. the resistors are to prevent frying the 2n2222a (already melted two). The pin at the CPU is an output, not an input - the cluster won't "see" anything (I've tested it too). All I'm doing is shorting the LED's to ground. the diode is keeping 12v from feeding back into the cluster where it doesn't belong. Maybe there's another way I can configure the 2n2222a to eliminate the extra parts?
It's good that it works, it just annoys me there's a mystery unsolved. :mrgreen:
hassmaschine wrote:moving onto the more difficult problems - testing my crude prototype op-amp circuit, I've found a problem. The circuit I built doesn't follow the curve I want exactly, but it doesn't matter for testing purposes - what I want to see is the output voltage range match what the cluster is expecting. it does that easily, I have a range of about .1v to 3.15v. the cluster only needs .9 to 2.75v

BUT - when I hook it up to the signal pins from the cluster, it gets "clipped". it will stop decreasing at about 1.6v. even though the output from the op-amp at that point is less than half a volt. This must have something to do with how the ADCs are built - they must be putting out some amount of voltage thats leaking into my circuit? this is where i get foggy..
I believe I understand why. Some posts back I believe you generated a cal curve for the new cluster. From that it seemed the cluster had a 5V source fed through a few hundred ohm resistor that would normally be connected to the sender. What's happening is your op-amp is "fighting" that source and resistor (Rint below). As the voltage output from the op-amp drops, the op-amp must sink more and more current from that 5V+resistor. At some point it can't sink any more and the output won't go lower. From Fig 2-13 in the op-amp datasheet I believe that current to be around 15 mA, which is just about what the op-amp would be sinking at low voltages.

http://ww1.microchip.com/downloads/en/D ... 21613c.pdf
BMWcircuitB.jpg
You do not have the required permissions to view the files attached to this post.
By hassmaschine
#141012
I toyed with it a bit last night, but I was tired and didn't get it fully nailed down. I was trying to get the 0 points to match, and then do whatever I needed to make the high points to match (by making the curve steeper/increasing voltage output). I got it pretty close using a 100 ohm pot.

I'm wondering, is this a good solution? or could there be a better one?

what if I removed Rint from the ADC? One problem with that is I don't know where it is. It's probably at least a 4 layer board, and all SMD of course. following traces won't be easy..

edit: I'm really thinking that removing Rint is the way to go. I don't have to mess with my op-amp design. I don't need Rint, the original purpose was as part of the voltage divider with the level sensor acting as R2. All the ADC cares about is the ~1-3v signal. Now to find it..
By Mee_n_Mac
#141024
hassmaschine wrote:what if I removed Rint from the ADC? One problem with that is I don't know where it is. It's probably at least a 4 layer board, and all SMD of course. following traces won't be easy....
Removing it would be my recommendation. You should be able to confirm you've got the right resistor as one end of it will be a dead short to the connector pin that you've got the op-amp attached to. The other end should be connected to 5V.
By hassmaschine
#141025
that's a good idea, I can just run a continuity test with my DMM from the sensor input connectors to all the resistors on the board until I find them. :)
By Mee_n_Mac
#141052
hassmaschine wrote:that's a good idea, I can just run a continuity test with my DMM from the sensor input connectors to all the resistors on the board until I find them. :)
Hopefully you'll only find 1 such resistor ! :mrgreen:
By hassmaschine
#141056
Mee_n_Mac wrote:
hassmaschine wrote:that's a good idea, I can just run a continuity test with my DMM from the sensor input connectors to all the resistors on the board until I find them. :)
Hopefully you'll only find 1 such resistor ! :mrgreen:
funny you say that - there was one for each ADC input, and another one that was connected but unrelated. I accidentally removed the "other" one and of course the cluster stopped working altogether.. fortunately I had enough foresight to save it, so I put it back and it's working fine.

anyway, removing those resistors did the trick! I now get full scale ADC inputs. I actually had to bypass the external connector and wire it straight to the ADC pins of the CPU (the external connector is wired directly to 5v). I might try to find a way around that though, as soldering wires directly to traces is obviously not a good idea.

Now, of course, I have a new problem - the signal is pretty noisy. I guess the 5v input it had before must have helped with the signal somehow. Could I put a small capacitor from the signal wires to ground?
By Mee_n_Mac
#141074
hassmaschine wrote:I actually had to bypass the external connector and wire it straight to the ADC pins of the CPU (the external connector is wired directly to 5v).
I'd have thought there would be a pin(s) that connects to the sender(s) in normal usage ?!?
hassmaschine wrote:Now, of course, I have a new problem - the signal is pretty noisy. I guess the 5v input it had before must have helped with the signal somehow. Could I put a small capacitor from the signal wires to ground?
There are a few places you could put caps to reduce the noise. First you could be picking up noise on the 5V line you're using for a supply on the op-amp. Put a bypass cap as mentioned before across the op-amp supply pins. Also you can put as large a cap as you can fit across R4. Lastly you can put one across R3 as well. This will make the inverting amp into an inverting amp with a low pass filter. 1 uF should give you a ~40 hZ filter, larger values give a proportionally lower filter bandwidth. C1 can be polarized if you want but C2 must be non-polarized.

You could put a cap across the sender but it's such a low resistance the cap won't help as much as the others. A cap on the op-amps output won't help as the op-amp will just "fight" it. You could add a resistor plus cap but I'd only do that if the aforementioned fixes don't work.

BTW when you say noisy, how much of a tank reading deviation are you seeing ?
BMWcircuitC.jpg
You do not have the required permissions to view the files attached to this post.