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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/08/04 02:16
Read: times


 
#64215 - Are teachers always right?
Responding to: ???'s previous message
Venkat,

let's make some simple circuit analysis:
Assume a 12V relay showing a DC resistance of 330Ohm. Then 12V causes a current of 12V / 330Ohm = 36.4mA. If a NPN transistor is used to switch-on the 12V relay, it will need a base current of about 1/10...1/20 of collector current. In our example this means a base current of 1.8mA...3.6mA.
If your microcontroller shall turn-on this transistor, it has to guarantee, that this base current will flow. So, how to proceed?

If you choose a microcontroller with standard outputs you get a problem, because it's impossible to deliver this current by the micrcontroller. Secial port circuitry of standard '51 microcontroller limits output current to about 50µA maximum in this situation. Not enough to turn-on the transistor!! In this case a pull-up resistor must be inserted. How does it work?
If microcontroller tries to emit high state, output voltage breaks down to base emitter voltage of about 0.7V. Then, internal pFET3 is turned-off. pFET2 is still turned-on, but delivers only less than 50µA. Now, inserted pull-up resistor comes into play: It delivers the base current which is needed to turn-on transistor!
Pull-up resistor is calculated very easily: R = (5V - Ube) / (1.8mA...3.6mA) is about 1k2...2k4.

If you choose a microcontroller with push-pull outputs on the other hand (which is not a feature of standard '51 micro, by the way!!), then much higher high state output current can be provided, and a special pull-up resistor is not needed. Connect a resistor of same resistance directly from Port pin to base of transistor. Following schematic shows the situation:



Circuit with pull-up resistor has a big disadvantage: Whenever the relay is turned-off, there will be a permanent current flow through pull-up resistor into Port pin!
But there's even a much worse disadvantage of pull-up resistor circuit: Port pin contains an internal strong pull-up, pFET1. This FET is turned-on for two oscillator periods, whenever state at output toggles from low to high. If now the base of transistor is connected directly to port pin, pFET1 is almost short circuited! Although this does not cause a destruction of pFET1, this will result in a heavy, short lasting current spike and cause a heavy increase of ground noise. ('Good night', if you toy with a bread board...)
Finally, a third disadvantage of pull-up resistor circuit: Whenever microcontroller is resetted, Port pin shows high state, and relay is turned-on!!

So, if you have a microcontroller with standard outputs, driving a relay only by ONE npn transistor and ONE resistor is not at all a good idea. It's possible, but not an elegant way! If you (and your teachers?!) search for an elegant methode to drive a relay, it's wise to have a look at Michael's schematics, posted above.
What may sound funny at school, like 'Who is able to turn-on a 12V relay with only ONE resistor and ONE transisitor?', can cause total desaster in real world!! If a factory has a stand-still for some hours, only because YOUR circuit failed, do you think big boss of company is interested in how many resistors your relay driver contains??? This is total irrelevant! Relevant is something total different:

How reliable is your circuit?

Kai

List of 32 messages in thread
TopicAuthorDate
Drive a relay-Sorry for incorrect ckt.            01/01/70 00:00      
   RE: Drive a relay-Sorry for incorrect ckt.            01/01/70 00:00      
   RE: Drive a relay-Sorry for incorrect ckt.            01/01/70 00:00      
   RE: Drive a relay-Sorry for incorrect c            01/01/70 00:00      
   RE: Drive a relay-Sorry for incorrect ckt.            01/01/70 00:00      
      RE: Drive a relay-Sorry for incorrect ckt.            01/01/70 00:00      
         RE: Drive a relay-Sorry for incorrect ckt.            01/01/70 00:00      
             i didnot get you,eriK            01/01/70 00:00      
               RE: i didnot get you,eriK            01/01/70 00:00      
                  RE: i didnot get you,eriK            01/01/70 00:00      
                     RE: i didnot get you,eriK            01/01/70 00:00      
                        RE: i didnot get you,eriK            01/01/70 00:00      
                  a better way            01/01/70 00:00      
                     RE: a better way            01/01/70 00:00      
      RE: Michel            01/01/70 00:00      
         RE: Michel            01/01/70 00:00      
            Thanks            01/01/70 00:00      
               RE: Thanks            01/01/70 00:00      
         RE: Michel            01/01/70 00:00      
            RE: Michel            01/01/70 00:00      
   RE: Drive a relay-Sorry for incorrect ckt.            01/01/70 00:00      
      RE: Drive a relay-Sorry for incorrect c            01/01/70 00:00      
         RE: Drive a relay-Sorry for incorrect c            01/01/70 00:00      
      RE: Drive a relay-Sorry for incorrect ckt.            01/01/70 00:00      
         RE: Drive a relay-Sorry for incorrect ckt.            01/01/70 00:00      
            RE: Drive a relay-Sorry for incorrect c            01/01/70 00:00      
            RE: Drive a relay-Sorry for incorrect ckt.            01/01/70 00:00      
         RE: Drive a relay-Sorry for incorrect ckt.            01/01/70 00:00      
            RE: Drive a relay-Sorry for incorrect ckt.            01/01/70 00:00      
   Are teachers always right?            01/01/70 00:00      
      RE: Are teachers always right?            01/01/70 00:00      
   RE: Venkat Ramu            01/01/70 00:00      

Back to Subject List