1. Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.
    Dismiss Notice

3904 NPN transistor to drive a relay

Discussion in 'Electronic Projects Design/Ideas/Reviews' started by spestis, Jul 26, 2006.

  1. Roff

    Roff Well-Known Member

    Joined:
    May 16, 2003
    Messages:
    7,757
    Likes:
    89
    Location:
    Idaho, USA
    Last edited: Oct 7, 2009
  2. audioguru

    audioguru Well-Known Member Most Helpful Member

    Joined:
    Mar 16, 2004
    Messages:
    32,573
    Likes:
    950
    Location:
    Canada, of course!
    The diode eliminates back EMF.
    Maybe you connected the pins of the transistor backwards? Look at the datasheet for the transistor to see which pin is what.
     
  3. Roff

    Roff Well-Known Member

    Joined:
    May 16, 2003
    Messages:
    7,757
    Likes:
    89
    Location:
    Idaho, USA
    Like I said, 10k is too high for the base resistor. This will give you about 430uA base drive, and the collector current is 79mA. Base current needs to be around 8mA, which is why I recommended 560Ω for the base resistor.
     
    Last edited: Oct 7, 2009
  4. dave

    Dave New Member

    Joined:
    Jan 12, 1997
    Messages:
    -
    Likes:
    0


     
  5. kurrodu

    kurrodu New Member

    Joined:
    Aug 3, 2009
    Messages:
    41
    Likes:
    0

    I would thank you all for your support.
    Ron, As you said, I used two 1k resistors in parallel to make it 500 Ω. (I didn't have 560Ω resistor. The transisor (BC547) is connected properly. (I checked the datasheet)
    The power supply is 6.7V DC
    If you looked at the pdf, you will notice 4 dip switches, based on different combinations, the controller sends a signal to trigger the relay. after a while the relay doesn't get triggered. But when I power off and power back on with a gap of more than 5 seconds. everything works normally.

    I suspect there is some charge buildup somewhere.
     
  6. Roff

    Roff Well-Known Member

    Joined:
    May 16, 2003
    Messages:
    7,757
    Likes:
    89
    Location:
    Idaho, USA
    Could you have the resistor pac installed backwards (+5V on the wrong pin)? This could leave an input floating if a switch is open
     
    Last edited: Oct 7, 2009
  7. Roff

    Roff Well-Known Member

    Joined:
    May 16, 2003
    Messages:
    7,757
    Likes:
    89
    Location:
    Idaho, USA
    Your PIC is not guaranteed to work above 5.5V.
     
  8. kurrodu

    kurrodu New Member

    Joined:
    Aug 3, 2009
    Messages:
    41
    Likes:
    0
    Thanks for the support.

    You are correct. It is not the back emf. (The diode is taking care of it.)

    But unable o figure out the issue.
     
  9. Roff

    Roff Well-Known Member

    Joined:
    May 16, 2003
    Messages:
    7,757
    Likes:
    89
    Location:
    Idaho, USA
    You may have missed my last 2 posts.
     
  10. kurrodu

    kurrodu New Member

    Joined:
    Aug 3, 2009
    Messages:
    41
    Likes:
    0
    I checked. Resistor pack is wired properly.

    I wired in another power supply. It is giving out 5.75v to 6v.

    Wired that now. I started testing. Will update you in a little while
     
  11. kurrodu

    kurrodu New Member

    Joined:
    Aug 3, 2009
    Messages:
    41
    Likes:
    0
    After continuously changing the dip switch configuration (on and off) for 7 min. I have the same problem.
     
  12. Roff

    Roff Well-Known Member

    Joined:
    May 16, 2003
    Messages:
    7,757
    Likes:
    89
    Location:
    Idaho, USA
    As I said,
     
  13. Roff

    Roff Well-Known Member

    Joined:
    May 16, 2003
    Messages:
    7,757
    Likes:
    89
    Location:
    Idaho, USA
    The datasheet recommends 15pF caps for the crystal, and the PIC needs to be in HS mode.
     
  14. kurrodu

    kurrodu New Member

    Joined:
    Aug 3, 2009
    Messages:
    41
    Likes:
    0
    Ron, I agree with you on 5.5v. But I still think there might some other issue.
     
  15. kurrodu

    kurrodu New Member

    Joined:
    Aug 3, 2009
    Messages:
    41
    Likes:
    0
    You are correct. I also saw a note below saying, for vdd>4.5v, 30pf is recommended.

    Will change from 33 pf to 30 pf.


    Do you think I need to connect a capacitor across vdd and gnd?
     
    Last edited: Oct 7, 2009
  16. audioguru

    audioguru Well-Known Member Most Helpful Member

    Joined:
    Mar 16, 2004
    Messages:
    32,573
    Likes:
    950
    Location:
    Canada, of course!
    Of course.
    All electronic circuits need a supply bypass capacitor at the circuit.
    Use a 0.1uf ceramic capacotor plus a 22uF electrolytic.
     
  17. kurrodu

    kurrodu New Member

    Joined:
    Aug 3, 2009
    Messages:
    41
    Likes:
    0
    [​IMG]The problem is the relay gets triggered for the first 7 min. Later on the controller hangs (I get no output). If I plug the relay out then the circuit works fine. (I connected an led instead of the relay which glows)

    I think I need to get the triggering part of the relay correct. (circuit)


    I am using the following circuit in the pic which I think is wrong:

    http://www.flickr.com/photos/46781478@N00/3995363736/

    I would also like to say that relay would be triggering 40Watt bulb (230VAC)
     
    Last edited: Oct 9, 2009
  18. Roff

    Roff Well-Known Member

    Joined:
    May 16, 2003
    Messages:
    7,757
    Likes:
    89
    Location:
    Idaho, USA
    Are you sure you have the transistor connected correctly? The collector and emitter of BC547 are swapped relative to most transistors (e.g., 2N3904). This would give you low beta, which would still possibly drive an LED but not a relay.
    Also - are you sure you have a 5V relay, and not a 12V (or other) one?
     
  19. Bob Scott

    Bob Scott New Member

    Joined:
    Apr 10, 2006
    Messages:
    441
    Likes:
    10
    Location:
    Vancouver, BC
    Also check the relay data sheet. Some DC relays require the correct polarization. (+ to + and - to -). Those have a partially magnetized armature and will only work reliably one way.
     
    Last edited: Oct 9, 2009
  20. kurrodu

    kurrodu New Member

    Joined:
    Aug 3, 2009
    Messages:
    41
    Likes:
    0
    Can I use the same power supply for the controller as well as the relay?


    Can someone send me a link showing a circuit where pic triggering a 5v relay
     
    Last edited: Oct 10, 2009
  21. kurrodu

    kurrodu New Member

    Joined:
    Aug 3, 2009
    Messages:
    41
    Likes:
    0
    I am positive. I also interchanged the emitter and collector. The relay does not get triggered at all. SO I think I have the transistor wired properly.
     
    Last edited: Oct 10, 2009

Share This Page