# How to dual power PIC18F4550?

In the datasheet there is this shematic how to dual power 18F4550. However they don't specify which transistor to use and what resistor values have to be. For capacitor I use 100uF (diode side) and 470nF (Vusb side). I tried putting in whatever BJT I have at home but it did not switch to Vbus when no Vself available.

Could someone please suggest which BJT to use (model no.) and which resistors should come with it. BJTs are like a dark forest for me.

• What transistor (part number) did you use? – W5VO Aug 16 '12 at 13:37
• KSP06TA - es.co.th/detail.asp?Prod=12303085 – Denis Pshenov Aug 16 '12 at 13:51
• In case the PNP were just another diode, both power sources will be active at the same time, but there shouldn't be a problem, right? – mFeinstein Dec 28 '12 at 5:15

The problem is that you used an NPN transistor instead of the PNP transistor specified in the schematic. Replacing the transistor with a PNP device should get things working. A common PNP transistor that I can remember off the top of my head is the 2N3906, but there are probably other devices better suited for this task.

The basic premise of the circuit is that when the circuit is not self powered, VSELF is floating or at 0 V. This causes a current to be pulled from VBUS through the emitter and the base, and through the two resistors to ground. To estimate what the sum of these resistors should be, we can make some assumptions about the circuit that are somewhat pessimistic. We will say that VBUS = 4.5 V and that we will be drawing 100 mA, which is one of the power levels of USB. We will use the 2N3906 datasheet for some of these numbers.

$V_{BE} = 0.8 V\mbox{ to }0.9V \mbox{ at }\beta=10$ depending on temperature (see figure above)

$I_B=\dfrac{I_C}{\beta}=\dfrac{100 mA}{10} = 10mA$

$V_B=V_{BUS}-V_{BE}=4.5V - 0.9V=3.6V$

$R_1+R_2=\dfrac{V_B}{I_B}=\dfrac{3.6V}{10mA}=360\Omega$

Without knowing what else is connected to VSELF or how VSELF behaves when it is not powering the device, I would be inclined to recommend the bottom resistor be 330 Ohms, and the top resistor be 33 Ohms, or omitting the top resistor completely (and having the bottom resistor equal to 360 Ohms).

• While the 2N3906 will do here I would go for a BC327. hFE of minimum 100 at 100 mA, the BC327-40 even 250. In many applications you can't have too much hFE, and it's much more convenient and cheaper to use the same type as much as possible. Also helps you to get to know the part. – stevenvh Aug 16 '12 at 14:36
• @stevenvh I was trying to illustrate a method, not necessarily an optimal part choice. I am aware that the 2N3906 is generally a small signal device and it may not be available to the OP, but I didn't want to make it too localized (e.g. "just use this transistor, you'll be fine"). – W5VO Aug 16 '12 at 14:45
• @W5VO where did you see in the datasheet the Beta is 10 depending on the temperature? Thanks.. – mFeinstein Dec 30 '12 at 6:36
• @mFeinstein You misunderstood the statement. I'm saying that at saturation (Beta = 10), Vbe will be between 0.8V and 0.9V depending on temperature. On page 3 of the linked datasheet, the middle left figure shows Vbe vs. Ic at 3 temperatures. At room temperature, Vbe will be 0.9V. At 125 degC, Vbe will be at 0.8V. – W5VO Dec 30 '12 at 8:12
• @W5VO, I still dont see where did you get the beta = 10 from. Could you explaind it please? – mFeinstein Dec 30 '12 at 12:37