Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

pin currents

Status
Not open for further replies.

aamirsherkhan

New Member
hi i m new in microcontroller i wnt to know that what will the current at the pin of AT89C51 microcotroller when it is cofigured as output and is high.i m using 5V supply.if i have to connect a relay 12v with the pin through transitor,how can i calculate the resistance used in series with the NPN transistor
 
The current at the pin will be whatever the load tries to draw for the voltage the pin outputs...up to a limit, usually somewhere between 5-25mA depending on the MCU. It will say in the datasheet what the maximum is. Beyond this current, the output voltage will rapidly drop.

The relay will have a voltage rating based on the current it needs and the coil resistance. THe coil resistance will make it so you do not need a resistor at all if you run the coil at its rated voltage (since the coil already has its own resistance). So if you put 12V through a 12V relay coil, no resistor is needed. If you put 12V through a 5V relay coil, then you need a resistor to limit the current and voltage across the the relay coil.
 
i m using At89C51 wtih 5V supply i m talking about the resistance that lies between the MCU pin and the base of transistor.The 12v relay needs 50mA of current.i m Using C1815 NPN transistor.how can i calculate the base resistance
 

Attachments

  • relay.jpg
    relay.jpg
    17.3 KB · Views: 435
aamirsherkhan said:
hi i m new in microcontroller i wnt to know that what will the current at the pin of AT89C51 microcotroller when it is cofigured as output and is high.i m using 5V supply.if i have to connect a relay 12v with the pin through transitor,how can i calculate the resistance used in series with the NPN transistor

Hi,
This circuit will cover most low power relay drivers.

What current/resistance is the relay.?


If the MCU pin is at +5V and the transistor has a Vbe of +0.7V, this gives 4.3V across R1.

If the relay draws say, 100mA and the gain of the transistor is 50,then ideally the base current would be 100/50= 2mA

but ensure saturation of the transistor I would provide a base current of about 4 to 8mA.

So, 4.3V/0.004 =1075R npv = 1K0

Does this help.?
 
Last edited:
I_desired = NPN_Beta * (Vpin/Rbase) [where Vpin/Rbase is the current sunk by the uC pin].

It's not terribly critical though. Just make sure the resistor isn't so small that the uC pin doesn't get burned out (using I = V/R and the output voltage and max current of the pin). As long as it's just a little bit more current than the relay needs, the relay resistance will regulate the rest of the current for you.
 
It seem to say 15mA max per pin under "electrical characteristics" so, that means that if your relay current > 15mA x NPN_Beta, then you are fine.
 
ericgibbs said:
Hi,
This circuit will cover most low power relay drivers.

What current/resistance is the relay.?


If the MCU pin is at +5V and the transistor has a Vbe of +0.7V, this gives 4.3V across R1.

If the relay draws say, 100mA and the gain of the transistor is 50,then ideally the base current would be 100/50= 2mA

but ensure saturation of the transistor I would provide a base current of about 4 to 8mA.

So, 4.3V/0.004 =1075R npv = 1K0

Does this help.?
thanks 4 helping
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top