Interfacing 12V relay with AT89C51

Thread Starter

aamirali

Joined Feb 2, 2012
412
1. I have to interface 12V relay & used circuit attached.
I have used R2=1K & R3=4.7K. Relay is operating fine but I have seen my pin gets loaded.
When logic is +5V at AT89C51, due to loading voltage across it reduces to 1V or less.

What should be correct values I should select.


2. I have to connect relays to PORT0 also. Now for using port0, first I needed external 10K sip after which I will connect the circuit. Is this correct??

Because I think this created two pull-ups across port0. One is 10K from sip & other is 4.7K(R3). Should I remove 10K sip from port0 in this case.


3. What should be max IOH & IOL for AT89C51.
I was reading:
http://www.atmel.com/images/doc0265.pdf

On Page 10, maximum Iol per 8 bit port is 26mA(port 0) & 15mA other ports.

What should be Ioh per port or per pin
 

Thread Starter

aamirali

Joined Feb 2, 2012
412
I am using transistor to drive relay. Circuit shown in link given by you cannot drive transistor into saturation to does not work with AT89C51.
 

Gorgon

Joined Aug 14, 2005
113
1. I have to interface 12V relay & used circuit attached.
I have used R2=1K & R3=4.7K. Relay is operating fine but I have seen my pin gets loaded.
When logic is +5V at AT89C51, due to loading voltage across it reduces to 1V or less.

What should be correct values I should select.
The key to answer this is the transistor you use. The necessary base current to drive the transistor Depends on the transistors hFE, or gain, and the current needed by the relay.

If the resistors in question is pure pullups, and the less than 1V(mayby around 0.7V) is correct, since this is the transistors Vbe.

2. I have to connect relays to PORT0 also. Now for using port0, first I needed external 10K sip after which I will connect the circuit. Is this correct??

Because I think this created two pull-ups across port0. One is 10K from sip & other is 4.7K(R3). Should I remove 10K sip from port0 in this case.
For port0 this is not a loading voltage, it's only the value of the external pullup over the transistors Vbe. If you manage to pull this value to 5V, you will have the Magic smoke from the transistor, destroying it, and possibly the output, if activating it at the same time.

The resulting value of the pullup is again depending on your selected transistor. A 10k resistor in parallel will only add some 0.5mA to the load of the output driving low, or 4mA for all pins on the port, if all are low at the same time.
[/QUOTE]

3. What should be max IOH & IOL for AT89C51.
I was reading:
On Page 10, maximum Iol per 8 bit port is 26mA(port 0) & 15mA other ports.

What should be Ioh per port or per pin
Since port0 is an open drain port there is no Ioh for this port related to the MCU. All high drive is comming from the external pullup resistors. You should take car to remain inside the max Voh for the output, since overvoltage may ruin the MCU.

For the other ports there are internal pullups, and you have to check their value before you define the external pullups on these ports. If you use all 8 pins on the ports you can only sink with less than 2mA on each, at the same time.
 
Top