# BJT NPN Switch not fully turning off under certain conditions

My first post here, I'm relatively new to electronics and this is my first project that I'm trying to accomplish myself.

First off, some background of what I'm trying to accomplish. I am trying to build a CD Emulator for VW Golf MK5 and have it use a bluetooth module. I have got the emulator and bluetooth part sorted out, my only problem right now is the transistor switch.

I have got this circuit:

Please note that U4 (JST-XH-04) connects to a 12V to 5V DC-DC Voltage regulator, I haven't marked the regulator in the schematic. VCC is 12V.

Both VCC and signal come from the radio, VCC is always on, even with car locked and key out, the signal however is at around 11V when the radio is on (it switches between 12 and 11 depending if engine is running or not) and is off when the radio is off.

Now if I plug in U4 GND and 5V to a USB (off a power supply or computer usb port) and plug in J1 Signal to another usb port (5V) everything works exactly as expected (note: the bluetooth module doesn't have enough power to play songs in this state, as the base resistor was chosen for 12-11V, however it still turns on and connects to the phone, as does arduino). So, using 2x usb cables and connecting them to the 5V, GND and Signal lines, this circuit works exactly as I would expect - when signal is low, circuit is off, when signal is at 5V, the circuit turns on.

However, when I connect it in the car, about 70% of the time the circuit does not fully turn off. At first I thought it could be a floating base, so I connected it to ground through a resistor (should have done from the beginning, but better late than never..).

Then I thought it could be a bad transistor, but I have tried 4 different ones now. I have also tried swapping collector-emitter, just in case I got it wrong, but the resistor went up in smoke fairly quickly when i tried that, so the polarity is also correct.

I have only 1 idea left - somehow the arduino grounds itself through CLK/MOSI/DATAIN, and the circuit completes that way. What should I check to confirm/dismiss this possibility?

Am I missing something? Does anyone have any better ideas?

Again, this is my first project where I'm trying to figure things out on my own, so my terminology or approach will be far from perfect, but I thank you for any and all help.

The circuit is available at https://easyeda.com/binginsin/rcd300-cdc . Anyone is welcome to add to it.

UPDATE: I have done some testing and found interesting results - on my 2x USB setup, I connected CLK / MOSI / DATAIN to ground without connecting the Signal. This ended up turning on the circuit, so the Arduino just grounds through it's digital pins... I will do some measuring in the car as soon as I have a chance - I will check if any of the CLK/MOSI/DATAIN lines have a connection to ground (car chassis) when the radio is off. I expect it will have a connection to ground with quite a high resistance. If that is the case, how would I go about ensuring that the arduino does not ground itself through the digital pins? Is that even possible? Is my arduino a dud?

• Be careful you do not trigger a latchup condition with inputs outside the Vdd Vss at any time. ground switch can be risky with inputs connected May 25, 2020 at 2:52
• Dainius, a detailed presentation of the problem. Though I found reading through it taking a little more work than I'd wished. But the writing is better than most presentations here, I admit, and I appreciate all of the work you put into this before writing. So +1 for that. I'd give more, but I can't. Regardless, are you aware than an NPN can conduct as a forward biased diode from base to collector? Take a look at your circuit with that in mind. Trace your +11 through the NPN to the Arduino. Do you tie the two grounds together? Car and +5 supply?
– jonk
May 25, 2020 at 3:22
• Are you using the built-in usb connection of the arduino to power it up? Where is the GND signal of $U_4$ connected to? By connecting the arduino's ground to the radio ground through a common emitter, you might also unintentionally be amplifying noise from the radio ground to the arduino ground. You might also consider connecting both grounds through a capacitor only. May 25, 2020 at 8:45
• Thank you for the consideration Tony, as per another suggestion I will probably modify my transistor circuit to switch the supply rather than ground, which should avoid latchup. @jonk , you are right, I tend to over-explain things, I will try to make my posts more concise in the future. The voltage at base (after resistor) will never be higher than voltage at the collector, so that shouldn't be a problem, as far as I'm aware. The car ground connects to "ground in" of the DC-DC Converter, while the entire circuit uses "ground out" connection of the converter. I'm not sure if that ties them. May 25, 2020 at 12:23
• @vtolentino, No, I'm using the VCC and Ground pins of the Arduino. U4 is a dc-dc converter, it has ground in and ground out. GND from J2 (this is the radio ground) connects to GND flag (ground in) in U4 and the Ground out is used to ground the entire circuit. I'm not quite sure what you mean by common emitter or connecting both grounds through a capacitor. May 25, 2020 at 12:29

Yes the SPI connection has a ground connection which is annotated on your diagram, is this what you're referring to? Also, keep in mind that you'll never get your transistor down to 0 Vce so your 5V supply is now only 4.5V or less depending on the current.

If you're using an isolated DC-DC supply (to prevent ground loop) for your 12V to 5V supply, you're defeating the purpose by switching the low side of the isolated Arduino supply using your radio's signal. For this reason you might consider switching the DC-DC supply side instead of the output side.

You can also switch high-side if you think the Arduino grounding is causing an issue but it adds an additional PNP. Basically use the 12V on/off signal from the radio to drive an NPN common emitter which can drive a PNP high side transistor for your 12V supply. The ultimate goal is to limit the galvanic connection between your audio/Arduino and car to only the AGND and signal wires (no ground loop!).

simulate this circuit – Schematic created using CircuitLab

• Thank you for the response. I'm not sure what do you mean about SPI having a ground connection, the Ground on J2 connects to the DC-DC converter. I'm actually not sure whether the converter is isolated, and I'm only using it to lower the supply voltage. The PNP idea is actually really good, if I don't supply the circuit with voltage, it has no chance to find another "ground" to complete the circuit, so thank you for that. May 25, 2020 at 12:13
• banggood.com/… This is the kind of DC-DC Converter I'm using. It does not state that it is isolated anywhere, and I don't quite have enough electronics understanding to know if it is. Also, ground loops are a mystery to me at this point, I tried understanding them a few times, but got nowhere. Will try again, thank you. Will update on progress once I modify my switch circuit. May 25, 2020 at 12:34
• Use a multimeter to see what the impedance is between the supply ground and the output ground on your DC-DC converter module. If it's connected than it's not isolated. A ground loop is when there is more than one ground return path for the audio signal, in this case there would be one through your radio in the audio cable and possibly one through your power supply to the car's chassis. That loop can cause buzzing and humming. May 25, 2020 at 14:01
• Ahh I see. It's a straight pass through for the ground on the DC-DC, so not isolated. I'm pretty sure I don't have any ground loops for the audio as it's clear with no buzzing or humming, so should be ok there. Thanks for the explanation. May 25, 2020 at 14:14
• Also, before you redo your circuit you could try reducing the value of that resistor from 100k to 10k. The 12V signal should be able to easily overcome that and it will ensure that the transistor closes. May 25, 2020 at 14:21