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