Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Thread Closed: Off-topic

???
02/08/04 11:58
Read: times


 
#64222 - RE: to drive a relay from 8051
Responding to: ???'s previous message

If we assume a standard 8051 port pin and you wish to drive a relay. The first question is: what voltage is the relay and what current does it's coil draw at the rated voltage.

For the purposes of discussion, we'll assume a 12 volt relay drawing about 60mA. Why 12volt? - this is a very common voltage along with 24volts.

Firt thing to remember is the the standard 8051 port pin doe not source current particularly well, but the will sink (as in to 0v) much better. Another thing to remember is that on reset, the port pin will assume a weak pullup to 5v. We don't want our relay to activate when the cpu is reset. To cope with this we need an inverter - something like a 74hc04. Depending on our actual design, we can chose between in integrated solution or a discrete solution. My usual choice is a uln2003 7 darlingtons in one i.c. You might wise to use a transistor and a resistor. In the case of the uln2003, the port pin of the 8051 connects to the input of the inverter(74hc04), the output of the inverter connects to the uln2003. Each output of the uln2003 can cope with up to 500mA of current (there's other specs that tell you about the total load for all 7 outputs). The uln2003 has inbuilt diodes so the diode common pin (9) connects to 12volts. The relay connects between +12volrs and the output of the uln2003.

If you wish to use a transistor, you'll have to calculate a suitable base resistor and select a NPN transistor with the appropriate ratings. The inverter output can only a limited amount of current (1mA of the top of my head).

To operate the relay in your code you have to make the port pin =0 to turn on the relay.



List of 5 messages in thread
TopicAuthorDate
to drive a relay from 8051            01/01/70 00:00      
   RE: to drive a relay from 8051            01/01/70 00:00      
      RE: to drive a relay from 8051            01/01/70 00:00      
   RE: to drive a relay from 8051            01/01/70 00:00      
   RE: to drive a relay from 8051            01/01/70 00:00      

Back to Subject List