High level switching with PNP darlington

Hi I am new to this forum, I hope I have posted this in the correct section I have done some searches on this but am still a little baffled

I am planning to use an arduino to control the electrics on a Kit Car

Because car components tend to have a negative earth it makes sense to use a high level switching system so I tried using this kind of circuit which i copied from a robotics website:

The led in this case is the direction indicator flasher unit which is a led matrix using about 200 mA

The problem is that the npn transistor that sinks the base to ground to switch on the pnp darlington (incorrectly labelled mosfet on here by me) is getting v hot with an Ie of 150 mA so i wonder if i need to add a seies resistor to the PNP base :

however i'm not sure if this is right and was not completely sure how to choose it's value looking at the TIP125 data sheet in the on state it quotes Ib values of 10-20mA but this is for collector currents of 3-5A but my led matrix will only draw 200 mA or so so not sure what to use for the series resistor .For 12v ignoring the 2.4K and the transistor resistances when switched on for 15mA led me to choose 800 ohms but would really value some help on this also would like to understand the values for the 2.4 K and the 10K resistors as well

Any help would be gratefully received.

my code which seems to work ok if interested is :

//Switch
int switchPin = 5;
int ledPin = 4;
unsigned long flashfreq = 400;
boolean flashbool=0;

void setup() {
  pinMode(switchPin, INPUT_PULLUP);
  pinMode(ledPin, OUTPUT);
}

void loop(){
  flashbool=(boolean)((millis()/flashfreq)%2);
  
  
  digitalWrite(ledPin, (!(digitalRead(switchPin))&&(flashbool)));
  
}

The TIP125 is not a mosfet, is it a PNP darlington. Because of that, you need to add a resistor between Q2 collector and the TIP125. I suggest 1K. The TIP125 has base-emitter resistors built in, so it does not need r2 (2.4K).

Alternatively, use a P-channel mosfet instead of the TIP125, and keep r2.

The value of r1 is fine at 10K.

How much current are you switching? Is the load inductive (motors, solenoids, relays?)

Typical darlingtons lose 1 to 2V due to the way they saturate, which will take a car's
12V down to 10V - perhaps not what you want. Large heatsink is almost certainly required.

A p-channel MOSFET would be much better, if chosen appropriately for the load current it
will not need so much heatsinking. It will need a fuse to protect it from over current though.

The original circuit will switch a p-channel but lacks one important feature, a zener diode across
source/gate to protect the MOSFET gate oxide from overvoltage (car electrics are very noisy).

You don't want the wire going to ground at the Arduino O/P.

Thanks everyone that's been v helpful.

I think I am beginning to get it I was getting muddled between high level switching with mosfets and with pnp darlington transistors.

If I keep the pnp darlington then:

I will add a resistor into the pnp base at 1k which would give emitter to base current of ? 12mA which should be enough to switch up to 3 or 4 amps ? I think from the data sheet

Remove the 2.4 K from pnp base to 12v (because the base of the pnp will be kept high when the in the off state by internal base emitter resistor?)

Keep the 10k input resistor from the arduino output into the npn base as 0.5 mA should be enough to switch the 12mA of emitter current ?

Remove the ground wire from arduino out on the schematic although did not actually have this.

MarkT:
How much current are you switching? Is the load inductive (motors, solenoids, relays?)

Typical darlingtons lose 1 to 2V due to the way they saturate, which will take a car's
12V down to 10V - perhaps not what you want. Large heatsink is almost certainly required.

A p-channel MOSFET would be much better, if chosen appropriately for the load current it
will not need so much heatsinking. It will need a fuse to protect it from over current though.

The original circuit will switch a p-channel but lacks one important feature, a zener diode across
source/gate to protect the MOSFET gate oxide from overvoltage (car electrics are very noisy).

Thanks for these insights at the moment I am going to use this circuit to drive each lamp I will only be using led array based lamps which are all under 1 amp (mostly 200-500 mA) the only inductor load is the horn ( not sure if this is an inductive load but maybe) and a solenoid that moves a lens to shift main and dipped beam, the main beam itself is 2 x 5 amps so I thought I might use a solid state relay for this circuit . The schematic for the tip 125 seems to have an internal flywheel diode in it does this mean i dont need another for inductive loads ??

I can see that dropping the source voltage by 2 volts could be a problem with some components but I think with the lamps it will be ok I suppose they will be a little bit less bright that if they where being switched by relays but I doubt this would be noticeable.

I was thinking I would need to clean up the 12 v supply when it's actually in the car as well as a zener diode I was wonderIng about a protective series diode for negative spikes and some low pass filtering ?? There are some posts about this and I was going to address this later as I haven't finished building the car yet and was planning to get it all working on the kitchen table first !!

Anyway thanks to everyone for these v informative posts and your patience with my muddled ideas.

jonh:
the main beam itself is 2 x 5 amps so I thought I might use a solid state relay for this circuit .

One or two P-channel power mosfets would be suitable. Use mosfets with a low Rds(on) such as IRF4905. A single IRF4905 will need a small heatsink to switch 10A.

jonh:
The schematic for the tip 125 seems to have an internal flywheel diode in it does this mean i dont need another for inductive loads ??

The flyback diode needs to be connected across the load, not the transistor. So you still need to add a flyback diode.

I have now got a working circuit so thanks all components nice and cool the TIP125 not even warm at 200 mA and the npn cold so well pleased thanks to all:

new circuit is :

I will now build up the code and circuits for all the other components. And get them working indoors before taking into car.

dc42:
The flyback diode needs to be connected across the load, not the transistor. So you still need to add a flyback diode.

Oh ok I understand thanks a lot.

I will try the MOSFET for the main beam lights if i wanted to use 2 (presumably would be less likely to fail) would it be better to have two outputs one for each lamp each with its own mosfet or have one output and put 2 in series if so would i need to balance them ??

Thanks again

Either use one per lamp, or connect 2 mosfets of the same type in parallel.

Also remember that filament bulbs pull a low more current at switch-on than when the filament reaches
temperature (an order of magnitude more). So an 80W 12V bulb will perhaps take 40 to 50A briefly (few
ms) and 7A once at temperature. If the switching device isn't up to handling the surge currents it could
mean failure. Most devices have a maximum current pulse rating which is for this sort of situation.

Thanks again for your comments, so my latest plan is to make a board with about 6-8 of these driver circuits :

I have added a flyback diode (I chose 1N5401 100V and 3A continuous and 125 A surge) please let me know if you think this is ok ??

It will be used for all the lights which will all be LED's max current about 1 amp per circuit, and the horn, then i think I will use the same circuit to switch on a standard automotive relay for the main/dipped beam (same bulb but moved with solenoid) as this could be up to 2x 60w or 12 amps (or more transiently thanks MarkT) I could then put 2 amp fuses (mcb's) on each circuit to protect my Power transistors.

Do you know if I will need heat sinks on the darlington's if i limit the current to 1 amp or so (continuous).

Thanks again for your help

This is my latest circuit I have looked at a few posts to try to produce a clean power supply to the arduino from my car battery as I understand it the inductor will try to smooth the power supply the zener will drop out voltages over 10v (I could choose 12v ) the D2 will stop negative spikes and stop the capacitors discharging if the voltage drops and the capacitors will remove high frequency and vhf noise the nice clean 10v will then be input to the on board regulator.

My questions are :

is this sufficient protection for the arduino
do I need to protect the Darlington from the raw 12v on the car battery ? leave the choke and a 12v zener in series with the 12v for the darlington

I have just realised i have no series resistor for the zener so it will draw 1 amps for every volt over 10 which is well over its limit, in order to work out the value of the series resistor i need to know what sort of mA the arduino mega will draw looking around this seems to be ? 200mA max if so then a 50 ohm series resistor which would protect the zener will drop to much voltage at 200mA and the arduino will switch of but if i reduce the series resistor to 20 or 30 ohms then too mmuch current will pass through it ?? do i need a higher power zener or am i missing something ??

I have decided to use a In car USB power supply unit for the arduino as these seem to have 12-24 v regulators and protection and are v cheap.

Do you think I need protection for the Darlington transistors they are rated at 60 amps but apparently you can get 100+ volt transients but maybe they can cope with these I could get 100v darlingtons or use a transient suppression diode any thoughts ??

LEDs and bulbs won't need the flyback diode. They ARE NEEDED for inductive loads like motors, relays and solenoids. Putting them in won't hurt anything, they just won't do anything.

and when the starter motor kicks out,
and you get the 30 volt negative spike from the aulternator,
what will your darlingtons do then,

yes, car electronics are horrible,

OH, and cheap usb car adapters are just that,
cheap.

good luck,
just dont rely on the gear,

I'd at least put a rugged arduino in,
use MOSFET instead of Darlington,

and when the starter motor kicks out,
and you get the 30 volt negative spike from the aulternator,
what will your darlingtons do then,

Thanks for your help m latest plan is to use bidirectional TVS diode 40 V on main supply to all power :

mainly to suppress positive spikes but should suppress negative as well although could protect each power transistor with a large series diode do you think this is necessary ? could also use a big inductor if necessary

OH, and cheap usb car adapters are just that,
cheap.

i was thinking of using these :

http://www.ebay.co.uk/itm/181005107235?ssPageName=STRK:MEWNX:IT&_trksid=p3984.m1497.l2649

to power arduino i though looked quite robust

Do you think P channel MOSFETS will be more robust and forgiving than the darlingtons ? i couldn't really tell from the specs

Hi

large Mosfets are "normally" IMHE more rugged than darlingtons,
they for one dont have thermal run away, and are a lot lower 'resistance' when hard on,
and higher resistance when hard off, so assuming fast switching between on and off,
power dissipation of MOSFETS is also lower than darlingtons.

As for TRV's,
great things,
if you have a 12 volt supply, you dont need 40 volt tvs's,
rate them nearer to the expected voltage,

As for ebay items, from china, you take what u get.
I have had some fantastic stuff, and I have had some absolute corkers.
like a unit that is meant to work up to 24 volts input , which had 15 volt input capacitors,

diodes.
mosfets have an inherent reverse diode in them,
so if its possible for the supply to the load to go lower than the load voltage, you need a series reverse current limiter. A diode would suit.

u can take things to extream, depending how 'reliable' fault tolerant you want it,
remember also, the car shakes quite a bit, so everything needs to be well bolted down so it wont shake loose.

drjiohnsmith:
large Mosfets are "normally" IMHE more rugged than darlingtons,
they for one dont have thermal run away, and are a lot lower 'resistance' when hard on,
and higher resistance when hard off, so assuming fast switching between on and off,
power dissipation of MOSFETS is also lower than darlingtons.

True, however mosfets are easily damaged by excessive gate-source voltage. Either use an automotive mosfet with integral gate protection diodes (and an appropriate gate series resistor), or add external protection to ensure that the gate-source voltage stays within limits.

drjiohnsmith:
As for TRV's,
great things,
if you have a 12 volt supply, you dont need 40 volt tvs's,
rate them nearer to the expected voltage,

... allowing for the fact that when the battery is on charge, its voltage is nearer 14V than 12V.

drjiohnsmith:
diodes.
mosfets have an inherent reverse diode in them,
so if its possible for the supply to the load to go lower than the load voltage, you need a series reverse current limiter. A diode would suit.

Not quite sure what you mean there. Typical automotive loads such as lamps don't mind a reverse voltage; but for any that do, a diode is necessary.

thanks everyone will wait and see what arrives from china !! the reason i have done this is that i was getting overwhelmed with trying to work out this type of circuit myself.

the reason i chose the 40v diode was because the darlingtons where ok to 60v and wanted to allow possible 24 v boost

will keep everyone p[osted

Hi Guys have spent the last 4 months testing the above till i was happy then getting a nice shiney white fritzing board made with 16 of these circuits on one board:

It is working a treat however there is one strange effect that i wanted to get some ideas on i have yet to put it in the kit car (as we are still building it) so I have been trying it on the kitchen table the problem I get is that when i attach a halogen headlamp to one of the outputs everything goes off for a split second or so then it all come back on i wondered if this is a power supply problem my power supply is rated to 5A at 16v and this is pushing it as the lamp is rated to 60w (so 5amps at 12v) the output display on the PSU certainly drops to 9V but no lower than this the arduino is powered separately, is it possible that the lamp when cold draws alot more current and so for a small time the power supply does not output enough current for the other channels even the the current display doesn't go below 9V. If it is likely to be this then i am not worried as the car battery should presumably be happy to manage this all ok, but any thought would be gratefully received.