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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
04/07/05 20:24
Read: times


 
#91206 - A few things
Responding to: ???'s previous message
Joshua Vavra said:
I would like to use the 8051 to control two 12VDC relays that will then control a door-lock actuator for a project I am working on. I have two circuits, but am having trouble combining them. Its tough to explain, but I will try:

Actually, it is probably a derivative. Since you are using port 0 for general purpose I/O, you must not have external program or data memory. The only time 8051s are used in such a configuration is when they have mask programmed ROM.

each of the output pins of PO are first hooked to a 2N2222 transistor (10k pullup transistors are installed for P0). The output of the 8051 runs to the Base of the 2N2222, while the Emitter is connected to ground. My question is then how exactly do I interface this with my relay/door lock circuit? Here is the 8051 circuit I found online:

I am not sure what kind of relay you are using, but I would look into whether such a configuration will allow you to develop the necessary collector current required to operate your relay. Once you have looked into this, try connecting the base of the 2N2222 to Vcc through your base resistor and see if you can get the relay to switch.

You need to use a flyback diode across the coil of the relay to prevent back EMF transients associated with connection/disconnection of the inductive load (relay coil). As an alternative to your 2N2222 based system, there are lots of integrated driver chips that make driving relays remarkably easy. At the low end, there are devices like the ULN2803; at the high end are things like the LMD18400. Typical functionality in these devices include inputs that may be directly driven from logic devices, integrated flyback diodes, overcurrent/overtemperature protection, etc.

Also, it is necessary to use <pre> and </pre> when posting code or ASCII diagrams to get them to display legibly; I have formatted your illustration below.

         +5
           |
           / 
            R3           
-------    /              2N2222     ------ 
       |                      _____|      |___///___ +5v
       |   |              B |/ C    | load |     R2
 Micro |

In your illustration, "load" is the relay coil. For a 12v coil, R2 is unnecessary, and +5v should be replaced with +12v. Also keep in mind that the relay's coil will be polarity sensitive; the collector of the 2N2222 needs to be connected to the side you want to have the lower potential when the coil is energized. In general, though, this kind of setup makes me a bit nervous though, and I probably would want to consider a more robust solution.

Once you have the relay working, you can deal with the door latch that you wish to connnect to it. The outputs of the relay are nothing more than switch terminals. Think of them that way, and use them as a way of interrupting the path from the voltage supply to your door latch to ground.

--Sasha Jevtic

List of 29 messages in thread
TopicAuthorDate
Driving 12V Relay W/ 8051            01/01/70 00:00      
   Ammended Image Post            01/01/70 00:00      
      that get you nowhere.            01/01/70 00:00      
   A few things            01/01/70 00:00      
      No, that is not so.            01/01/70 00:00      
         an 8751, perhaps            01/01/70 00:00      
   Pull Ups and Base Current            01/01/70 00:00      
      ULN2003            01/01/70 00:00      
   door lock diagram            01/01/70 00:00      
   One more method...            01/01/70 00:00      
      Why not use 2N7000            01/01/70 00:00      
         2N7000 Not Good By Itself            01/01/70 00:00      
            You have a point            01/01/70 00:00      
               FET solution            01/01/70 00:00      
                  Elegant?            01/01/70 00:00      
                     True..            01/01/70 00:00      
               It Can Be Small            01/01/70 00:00      
                  Zetex            01/01/70 00:00      
                  Could it be smaller?            01/01/70 00:00      
                     Think so.            01/01/70 00:00      
                     Onboard Resistors            01/01/70 00:00      
                     Digital transistors            01/01/70 00:00      
                        Missed            01/01/70 00:00      
      an added note            01/01/70 00:00      
         solved by Allegro            01/01/70 00:00      
            part number for Allegro chip?            01/01/70 00:00      
               take your pick            01/01/70 00:00      
                  I missed a few            01/01/70 00:00      
            It was a note :)            01/01/70 00:00      

Back to Subject List