Simple automotive circuit, annoying problem.

Thread Starter

JohnnyD

Joined Aug 29, 2006
79
Hi,

I hope you might be able to suggest a solution to this seemingly simple problem I have. Let me explain the circuit first.....

My car is just old enough to have a pin on the diagnostics socket that you can connect to 0v which puts the ECU in 'diagnostics mode'. In this mode, there is a light on the dashboard which flashes in certain sequences to indicate any problems which have been logged in the ECU.

I wanted to make a latching circuit so that when I push a button, it will ground the pin on the diagnostics socket and keep it grounded until I press the button again. I also wanted an LED to come on to show that it was in diagnostics mode. Simple enough so far...

I then discovered that some models of my car were made with traction control, and the button for it fits in a really handy place and looks more 'factory fitted' so, rather than have to make a panel to fit the pushbutton and LED on, I decided to go to my local dealership and buy this traction control switch along with the mounting panel for it. The button has a light built into it as well which is great cos I can use that instead of a seperate LED.

My problem arises from the light inside the button which is a 12v bulb. I am trying to switch it using 5v CMOS logic. Due to the internal wiring of the button, I have to use a PNP transistor to interface between the 5v CMOS logic and the 12v bulb.

Herein lies what I think is my problem - the voltage at the base of the transistor can never rise high enough to turn the transistor off.

Here is the schematic:
http://img.photobucket.com/albums/v330/agua-moose/Electronics/ECUFlash-RevB.jpg

The current drawn by the bulb at 12v is around 40mA.

In the top corner I have a possible solution, to use an NPN transistor and a low value (around 25ohms) resistor to drop only 1 volt, so that the bulb receives around 11 volts. The problem with that is that when the transistor is on, the current drawn will be around half an amp! which is way too much.

I also thought of using a relay, but I don't really want to unless its absolutely necessary.

What do you think? How can I get around this problem?

Thanks.
 

bloguetronica

Joined Apr 27, 2007
1,541
It seems that you want your output to work under false logic right? (so if pin 2 has logic low, the bulb will light)

If you really want to use false logic, use this alternative instead:
View attachment 1071

It won't consume as much power when the bulb is off, and you will only need
two 2N3904.
 

Thread Starter

JohnnyD

Joined Aug 29, 2006
79
Thanks for the reply.

I see what you're saying but it doesn't matter if the logic is the right way round or not. the point is I need to somehow switch the 12v bulb using 5v logic.

If I were to wire the switch/bulb the other way round, ie - connect their common connection to +12v instead of ground, then the switch would be at the wrong voltage to interface with the logic ICs. Does that make sense? The problem occurs because of the internal connection between switch and bulb. If I could disconnect the internal connection inside the switch and have the bulb and switch completely seperate then I could just use an NPN with the bulb connected between +12v and the collector with the emitter connected to ground. It might need connecting to the other output of the flip-flop but it would work.

I think the problem is that with the PNP transistor base being at 5v but the emitter being at 12v, the base isn't high enough to turn the transistor off. But I don't really understand enough about PNP transistors to know this for sure.

One other thing, I don't want to have anything else connected to the terminal labelled 'Diagnostic pin 6' because this is directly connected to the ECU of my car and I can't risk any harm to it.

Thanks, I think my lack of knowlege about PNP transistors is the main issue in this probem!
 

bloguetronica

Joined Apr 27, 2007
1,541
Notice that I've updated the answer since I was answering wrong. I don't know if you read it. Now it should be ok.

Thanks for the reply.

I see what you're saying but it doesn't matter if the logic is the right way round or not. the point is I need to somehow switch the 12v bulb using 5v logic.
The circuit presented is valid only for false logic (signal low will turn on the bulb). If you wan't to use true logic (signal high will turn on the bulb), you just need to connect the bulb to the collector of the transistor, like in this circuit:
View attachment 1073

I think the problem is that with the PNP transistor base being at 5v but the emitter being at 12v, the base isn't high enough to turn the transistor off. But I don't really understand enough about PNP transistors to know this for sure.
What you are saying is truth, the PNP transistor won't work since the output needs to reach 12V.

Notice that the solution in the previous post has similarities with your solution. It is better to use an extra transistor in these cases, so the current consumed won't be that large.

The resistor values are rought calculations. Make sure that the current biasing R4 is 100 times smaller than the current across the bulb. On the other resistor it should be 10 times smaller. Feel free to PM me if the circuit doesn't work (but specify the subject, or I may not recall it).
 

Thread Starter

JohnnyD

Joined Aug 29, 2006
79
Thanks for the reply. I did read the post before you editted it, hence my long reply!

I understand your suggestions, but they won't work in this situation due to the internal wiring of the switch. If you look in the bottom right corner of the schematic in my first post, this is how the switch is wired. I only have access to three terminals: switch +ve, bulb +ve and a common ground for both of them. If I had access to the bulb ground seperately from the switch ground then I could use either of your suggestions. With the switch and bulb wired together as they are, the transistor in either of your suggestions that switches the bulb would also affect the working of the switch (ie - the switch ground would also get connected to the collector of the transistor). Do you see what I mean?
 

bloguetronica

Joined Apr 27, 2007
1,541
In that case, you can use a PNP transistor with the base directly connected to the collector of the NPN transistor. It will be a "true logic" circuit. See the diagram below:
View attachment 1074
The current across the resistor R4 is 100 times smaller than the current across the bulb. Here you need only one resistor to control all currents.

The other way is to use a more complicated circuit, this time using "false logic":
View attachment 1076
This time Rc will control the current across the NPN and PNP transistors, so the current across Rc is 100 times smaller than the current across the bulb. The current across R4 is 10 times smaller than the current biasing Rc.

It you don't want to use more than one transistor then you are better of with a relay. Hope this helps.
 

bloguetronica

Joined Apr 27, 2007
1,541
By the way, will you use true logic or false logic? Just curious.

Please feel free to PM me if it doesn't work. Don't forget to specify the subject, the circuit and the resistor values (since those are critical).
 

Thread Starter

JohnnyD

Joined Aug 29, 2006
79
It doesn't matter to me, it's only a simple flip-flop. If it doesn't work how I want using the Q output then I'll use the Qbar output.

BTW, is what I've done with C4 and R1 OK? That was the only way I could think to make sure the flip-flop always starts in a known state.

Thanks, your help is much appreciated.
 

JoeJester

Joined Apr 26, 2005
4,390
BTW, is what I've done with C4 and R1 OK? That was the only way I could think to make sure the flip-flop always starts in a known state.
You could have simply tied PRE to ground or if you wanted a power up reset use an integrator with one of the remaining nand gates in the 4093.
 

Thread Starter

JohnnyD

Joined Aug 29, 2006
79
Why not just solder in an led in place of the incandesent bulb? Seems like a simple solution since leds are available so cheaply.
Thats a good idea, i hadn't thought of doing that. I had assumed the switch was a sealed unit but a closer look reveals it is take-apart-able.
 

Thread Starter

JohnnyD

Joined Aug 29, 2006
79
If i were to go with the PNP switched by an NPN idea, I calculated the resistor at the base of the NPN would have to be around 44K, like this:

The diagnostic pin is held at 12v by the cars ECU. When this pin is grounded, the current flowing from it to ground is around 10.3mA (equivalent to a pullup resistor of around 1K2).

The current needed for the bulb is 40mA. The minimum gain for the PNP transistor with a collector current of 40mA is around 70. So the base current needed for the PNP is around 0.6mA

So the total current at the collector of the NPN is 10.9mA. The minimum gain at this level of collector current is more like 100, so the base current for the NPN is around 0.1mA. As the voltage needing to be dropped by the base resistor is around 4.4v, the resistor is 44K.

Is that right?
 

JoeJester

Joined Apr 26, 2005
4,390
Johnny,

The PRE or PRESET, sometimes called SET.

Attached is what I was thinking about ... but remember, it's your design.

Your input is also causing a longer than necessary high. Attached is a comparison for your input circuitry also. Ignore those two t switches ... I used them to toggle the input twice to show the whole circuitry in action. In reality, they are just the one switch you have on your diagram.
 

Attachments

Thread Starter

JohnnyD

Joined Aug 29, 2006
79
Wow, that is really great, thankyou so much.

I like the power-up reset idea, I will definately use that in my circuit, especially as I don't really like using the 4093 for just one schmitt trigger inverter when it has 4 available.

I am a bit unsure on the input circuit idea though. I don't see how your new idea provides any de-bouncing for the switch, as it doesn't use any capacitors?

How did you produce those simulations? I would find that really usefull.

Thanks again, much appreciated.
 

bloguetronica

Joined Apr 27, 2007
1,541
If i were to go with the PNP switched by an NPN idea, I calculated the resistor at the base of the NPN would have to be around 44K, like this:

The diagnostic pin is held at 12v by the cars ECU. When this pin is grounded, the current flowing from it to ground is around 10.3mA (equivalent to a pullup resistor of around 1K2).

The current needed for the bulb is 40mA. The minimum gain for the PNP transistor with a collector current of 40mA is around 70. So the base current needed for the PNP is around 0.6mA

So the total current at the collector of the NPN is 10.9mA. The minimum gain at this level of collector current is more like 100, so the base current for the NPN is around 0.1mA. As the voltage needing to be dropped by the base resistor is around 4.4v, the resistor is 44K.

Is that right?
No, since you are using a transistor in the saturation region, you have to consider the beta as 10. A beta of 70 would still correspond to the active region of the transistor. Switching transistors are used in the saturation region.

Always consider a beta of 10 for all transistors. Also consider the emitter to base voltage as a limiting factor. For instance, 12V at the base pull-up resistor of an NPN transistor would be equivalent to potential difference of about (12V - 0.7V) across that resistor. Knowing that, you can calculate more precisely the base current.
 
Top