How to drive relay from microcontroller?

Discussion in 'General Electronics Chat' started by moorejohn90, Dec 21, 2011.

  1. moorejohn90

    Thread Starter Member

    Dec 9, 2011
    57
    0
    Hi
    I want to drive 12V relay from microcontroller(Arduino).
    I have a problem when driving that may be connected circuit is wrong or other. I don't know. That is my first circuit of driving relay.
    I also sent my circuit diagram with attachment.

    I heard a sound when I connected the relay pin NO 1 & 3 to positive and ground of 12V DC battery. I think pin 2 is control pin, is it right?
    But nothing happen when I control pin no 2 with microcontroller(Arudino).
    I also test transistor(collector) with LED. It is work.

    John:confused:
     
  2. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Most "standard" Relays are SPDT

    So you'll have 2 connectors for the coil, which are what you want to deal with in this case, one side of the coil to +12V, the other side to the collector.

    That should make the relay go "click" when it is on and off.

    The other 3 switches are the relay poles. One of them is COM for Common, Another is NC (normally closed) and the Third is NO (or ON if upside down :) Which is Normally Open).

    When the coil is NOT energized, COM and NC are connected.
    When the coil IS energized, COM and NO are connected.

    There should be no connection between your logic circuit/transistor to any of the NO/NC/COM pins of the relay, only the coil pins.

    You can find the coil pins by using an ohmmeter and looking for the two pins that have about 50-150 ohms between them, those are your coil.

    If the coil is for 120VAC, 12V from the circuit won't pull the switch.

    You need one where the Coil is rated for 12VDC (if that is your supply voltage), while the contacts are rated for 120VAC@x amps (however much power your are switching.

    If you can, take a photo of the relay showing the numbers/part number, and one showing the pins. Make sure it is large, clear and in focus. Then post the photos here if you still are having problems.
     
  3. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    You need to have the 5v ground the same as the 12v ground; they must be connected together - otherwise, there won't be a path for current to flow back to the 12v ground.

    If you hear a clicking when you connect pin 1 to 12v and pin 3 to ground, then those are the terminals that the relay coil is. You need to have the collector connected between pin 3 and ground. You also need the diode connected across pins 1 and 3, cathode towards the +12v terminal on the battery.
     
  4. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    He shows all the pins going to the same light grey ground, where I am confused is he is showing 3 pins, 1 and 2 have a diode between them, facing properly, and a 3rd pin to ground, with 2 more pins out the side. I don't think he has the correct pins mapped out.
     
  5. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    Wouldn't it be better to drive the relay with a circuit similar to this:
    [​IMG]

    I'm having trouble understanding the connection around the NPN...

    (BTW: I'm a great MS Paint artist.:D)
     
  6. @android

    Member

    Dec 15, 2011
    178
    9
    Simply connect relay coil in series with the collector of the transistor.
     
  7. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Looks like you got a Wacom Bamboo Fun or similar tablet. It's actually legible, and I won't believe for 1 second you are that handy with a mouse. :p Nice work though. I think I'll use mine for schematics and then boss won't recognize me.
     
  8. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    OK, guess I got confused by the 5v inside the square.

    ...And Oh, yes. I am that good with a mouse. It's the MS Paint thing I got the rash from... :D
     
  9. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Ok, I got bored....

    [​IMG]
     
  10. nerdegutta

    Moderator

    Dec 15, 2009
    2,515
    785
    Amazing!

    You are a true Master of the Mouse. You don't even need an art class. :rolleyes:
    They should come to you. :D
     
  11. moorejohn90

    Thread Starter Member

    Dec 9, 2011
    57
    0
    Hi everyone, Thanks for your reply to my post.
    I don't know how the relay which I bought is constructed.
    But it is wired, it is not like others.
    But finally I can figure out how it work.

    -Relay's Pin No 1 to Collector
    -Relay's Pin No 2 to Battery's Negative
    -Relay's pin No 3 to 12V Battery's Positive
    -Relay's Pin No 4 to Load's Negative
    -Load's Positive to 12V Battery's Positive

    I also sent correct diagram of my circuit with attachment.
    Thanks to you all. :)
     
  12. moorejohn90

    Thread Starter Member

    Dec 9, 2011
    57
    0
    Hi everyone, I forgot to post my circuit diagram.
    Here it is.
     
  13. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    Here is a schematic of how a typical SPDT relay is wired internally:

    [​IMG]

    There are five terminals; two are for the coil, and three are for the contacts.

    First, you use an Ohmmeter and determine which pairs are connected together. The coil will have a higher resistance than the NC contacts.

    Then you determine which is the COM terminal by activating and deactivating the relay coil while measuring back and fourth between the one terminal that was not connected to anything, and the two that were connected together but not the coil.

    Some relays have only the coil terminals, and then a pair of terminals that are NC, or NO. There may or may not be a 5th terminal that is not connected to anything. Those types would be SPST.
     
Loading...