Wednesday 13 September 2017

Transistor weak current when switched from microcontroller


I have ATMEGA328 (running on 5V) connected to a C4793 NPN transistor which controls the TEC1-12706 thermal component.


I'm using the code below to turn the transistor on and off:


#define F_CPU 8000000UL


#include
#include

void delayms( uint16_t millis )
{
while ( millis )
{
_delay_ms( 1 );
millis--;
}

}

int main( void )
{
DDRD = 0b00000001;

while ( 1 )
{
PORTD = 0b00000001;
delayms( 10000 );


PORTD = 0b00000000;
delayms( 10000 );
}

return 0;
}

schematic


simulate this circuit – Schematic created using CircuitLab



Everything is working great, except that the thermal module only gets 0.6A of current, even though the datasheet of the C4793 transistor states that it can handle 1A of current.


If I connect the base of the transistor directly to the VCC, I get 1.07A to the thermal module, which is exactly what I need.


I can't understand why I only get 0.6A when doing the same thing from the ATMEGA328. I thought maybe it's because ATMEGA328 puts out only 20mA from the PIN, but isn't the transistor triggered by the voltage instead of current? Any suggestions please? Thanks!



Answer



You are using a NPN transistor for high side switching. This means the bjt will never turn on fully. Voltage at base needs to be about 0.7 V more than voltage at emitter for NPN to turn on fully.


Here's the circuit with low side switching (transistor connected to ground, instead of +ve rail):


schematic


simulate this circuit – Schematic created using CircuitLab


Additionally, I do not recommend running the uC pin at full current it is capable of. So minimum resistor should be (5.0-0.7)/0.02 = 220 ohms. But 330 ohms is better. Typically, 1K is used. Which means, for an optimal design, you need a transistor with higher gain. You can do this yourself by putting 2 transistors in a darlington configuration.


schematic



simulate this circuit


You can replace the transistors with a single logic level mosfet. A cheap and (somewhat) commonly available one that will work here is AO3400.


NOTE that your load no more has a common ground with the rest of your circuit. If this is a problem, you will have to use high side switching. However, this will require PNP BJT or P-channel mosfets. It will also invert the switch on/off logic. If the load operates at more than 5V, it will also mean an additional NPN switch for the PNP switch.


Alternately, in the first schematic, 2SC4793 can be replaced with the TIP122, which is a complete darlington pair transistor in a TO220 package... quite cheap and common, has great characteristics, and finds many uses in the lab and for projects.


In the second schematic, one can replace the specialized, hard to find and expensive 2SC4793 with the very cheap and common BD139 which has both higher gain and higher current capability. [2SC4793 has a Vceo of 230V, so better to keep it for special uses, since it is expensive.]


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...