Can anyone help me with my calculations for the resistor values associated with the high side switching circuit in the attached diagram? The values on the diagram are pretty arbitrary at the moment, but I'm happy to use them if I can be convinced that they'd work ok. The switching circuit is just a simple pulsed ON-OFF cycle controlled from the Arduino.
I understand the theory of what each resistor is for, but get confused when trying to combine two sets of transistor data. Are the transistors I've selected to use here overkill? Can anyone suggest a suitable pair in SOT-23 form that would be better?
I've used this configuration because I believe the voltage at the PNP base would be more negative than Vcc, which although is the same supply as the Arduino, there would be sufficient voltage drop that the PNP wouldn't switch off - does that sound sensible?
bc807 Worst case hfe =100?. Wanted Ic 120mA. --> Ib >= min 1,2mA to saturate. Driving voltage ca. 3,5V --> Rb (R11) max 2k7
Pullup R12 100k is OK
The bc817 base current must drive transistor to sat. With an Ic 1,5 mA, Ib > 15uA.
Driving voltage ca 4V --> R10 < 220k
My concl. Replace R11 with a 2k2 or 2k7
Replacement transistors?? Use ONE logic level MOSFET
As I've got the NPN and PNP transistors, I'll try those first before trying a mosfet.
Having said that, I do have a IRLL014 lying around. How would I use one for high sides witching 120mA worth of leds? Simply as the attached sketch?
The IRLL014 is a n-channel logic level mosfet, it can only be used as low-side switching.
You would need a p-channel logic level mosfet.
Are you sure you need high-side switching, and that the leds need 5V ? Is there a way to make it low-side switching ?
Many times a protection resistor is used between the Arduino pin and the gate of 100 ohm to 1k.
If you want the output to have a predefined state during startup, you can use a resistor of 100k from the gate to the ground or to 5V.
I am uncomfortable driving saturated switches with just enough current. While an hfe of 100 is listed as worst-case, I'd still want to provide 1.5 to 2x the current calculated.
So for R11, I'd suggest nothing greater than 2.2k, maybe 1.5k.
For R10 following the same guidelines, <=39k. 33k is a good standard value, as is 22k.
I'm not saying that knut_ny is wrong. I'm just more comfortable with a little more of a safety zone.
The leds have to be high side switched because they are pre-existing, with their resistors, on a pcb that has an existing ground return common to the Arduino. Based on what you all have told me and re-looking at the data sheets, I think I'm going to drop all the values to around 1K for R10, 10K for R12 and drop right down to possibly 680R for R11. Hopefully that should give me the safety zone you mention Polymorph.
I'm relying on the internal pullup resistor of the arduino pin to give the defined startup state Caltoa, although for this application, a quick blink of the leds at startup wouldn't be a problem.
The nominal gain of a transistor is for small signals only - as you get towards the maximum
current of the device the gain drops, perhaps down to 20 or 30.
Then you need to saturate on top of that, so sometimes you need Ib to be as much as
5% to 10% of Ic...
R11 should be 470 ohms perhaps, R10 4k7, to be on safe side. The datasheet of the '807
only shows Vsat for Ib = Ic/10, I suspect Ib = Ic/20 is OK though for 120mA.
In general if a transistor is called a "superbeta" it will have superior saturation
characteristics, the '807 seems to be quite good from the Vsat curves.
test with a variable resistor (pot'meter)
Find the position where voltage across transistor shows saturation..
Then you can know for sure what max Rs are
Try your mosfet.. (invert your controling output pin)
A resistor from the gate to GND or 5V for a "predefined state" is for the mosfet.
A normal transistor needs current at the base, which result in a predefined state by itself.
A mosfet does not need current at the gate, so the mosfet could be anything or even jitter and bounce during startup.
Can you upload the new schematic ?
I prefer a mosfet, but with transistors I would only use a PNP transistor with a base resistor, and use software to invert the signal.
A MOSFET requires current to charge and discharge the rather large gate capacitance (it is actually gate charge, not exactly capacitance). For lower power MOSFETs, the gate capacitance may be low enough not to need a current limiting resistor, but for higher power MOSFETs, you should have a current limiting resistor to avoid drawing more than the Arduino (actually, the Atmel chip) maximum 40mA current.
Read reply #3 about "...protection resistor...".
That is the resistor to protect peaks in the current of the microcontroller, due to charging the gate.