Monday 7 July 2014

arduino - BC547/BC548 with 5V at base can't control 12V at collector-emitter?


For an Arduino project I needed both 5V and 12V voltages. Specifically, for an IC I needed 5V and I needed to be able to switch it on and off using an Arduino PIN. Since the current drawn by the IC might exceed what can be drawn from the Atmega328 pins, and since I couldn't tolerate any less than 5V, I tried using the following circuit. enter image description here


So the idea was to control the 12V source using the BC547 transistor with the base controlled by an Arduino pin, and then to feed the emitter of the transistor into a standard 7805 regulator setup (with cap sizes taken from the 7805 datasheet).



However, the circuit doesn't work as expected. I'm only seeing 4.32V on the emitter of the transistor - not 12V as I had expected. I can see that the input to the base is drive to 5V, and given the 4K resistor there should be amble current for the base (at least for 100-200 of collector-emitter current). Yet it seems the only voltage I'm seeing at the emitter is the mentioned 4.32V which seems to be just the base voltage minus some voltage drop. Changing the 4K resistor to e.g. 800 ohm didn't change this.


So what is the problem here? It is not possible to control 12V using 5V at the base? If so, from what values in the datasheet can this fact be derived?


I tried replacing the BC547 with a 2N7000 MOSFET, and that actually worked and I'm seeing 11.3V at the emitter of the transistor, and 5V at the output PIN, as expected. But I don't see why the BC547 couldn't do the job.



Answer



The problem is that your transistor is connected in emitter follower configuration. The output will always be a bit less than the input. The point of a emitter follower is usually current gain, you actually get a small loss in voltage.


It would be better to use a PNP to switch the voltage into the regulator, instead of the NPN you show:



When the digital signal goes high, the emitter of Q2 will be about 700 mV less, or about 4.3 V. That will cause 10 mA to flow thru R1, most of which will be coming thru the collector of Q2, which also means it will be going thru the base of Q1. R2 is only to guarantee Q1 will be off when intended, despite a little leakage and maybe some noise in the system.


You didn't say how much current you need at 5 V, but this needs to be considered. The maximum current Q1 can handle will be its base current times its gain. In this example, the base current is about 10 mA as already shown. With a gain of 30, for example, this setup can support up to 300 mA. If you need more current than that, then changing Q1 to a darlington or a P channel FET will probably be a better tradeoff than increasing the base current.


This circuit is intended to be simple and work with a wide range of parts. Q2 can be just about any small signal NPN transistor. Q1 could be a jellybean PNP if you only need 100 mA or so. Otherwise, a small power transistor may be better.



Added:


You now say that the regulator only needs to supply 30 mA maximum at 5 V. In that case Q1 can be most any jellybean PNP transistor, like a 2N4403. Such small transistors will have more gain than a power transistor. Figure you can count on a gain of 50 minimum, so the base current only needs to be 600 µA. A couple of mA base current would then be enough to put Q1 solidly into saturation. That allows making R1 larger, like 2 kΩ. So here is the final circuit:



No comments:

Post a Comment

arduino - Can I use TI's cc2541 BLE as micro controller to perform operations/ processing instead of ATmega328P AU to save cost?

I am using arduino pro mini (which contains Atmega328p AU ) along with cc2541(HM-10) to process and transfer data over BLE to smartphone. I...