Go Down

### Topic: High level switching with PNP darlington (Read 12355 times)previous topic - next topic

#### jonh

##### Sep 01, 2013, 10:25 pm
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 :

Code: [Select]
`//Switchint 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)));  }`

#### dc42

#1
##### Sep 01, 2013, 11:26 pm
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.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### MarkT

#2
##### Sep 02, 2013, 12:36 am
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).
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### larryd

#3
##### Sep 02, 2013, 01:28 am
You don't want the wire going to ground at the Arduino O/P.
No technical PMs.
If you need clarification, ask for help.

#### jonh

#4
##### Sep 02, 2013, 02:32 am
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.

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.

#### dc42

#5
##### Sep 02, 2013, 10:56 am

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.

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.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### jonh

#6
##### Sep 02, 2013, 12:46 pm
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.

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

#### dc42

#7
##### Sep 02, 2013, 02:05 pm
Either use one per lamp, or connect 2 mosfets of the same type in parallel.
Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.

#### MarkT

#8
##### Sep 03, 2013, 01:55 pm
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.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

#### jonh

#9
##### Sep 03, 2013, 03:16 pm
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).

#### jonh

#10
##### Sep 08, 2013, 05:56 pm

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

#### jonh

#11
##### Sep 09, 2013, 06:03 pm
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 ??

#### jonh

#12
##### Sep 10, 2013, 10:12 pm
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 ??

#### kf2qd

#13
##### Sep 10, 2013, 11:30 pm
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.

#### drjiohnsmith

#14
##### Sep 11, 2013, 07:51 pm
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,