element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Experts, Learning and Guidance
  • Technologies
  • More
Experts, Learning and Guidance
Ask an Expert Forum What is the best way to drive a relay?
  • Blog
  • Forum
  • Documents
  • Leaderboard
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Experts, Learning and Guidance to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • Replies 6 replies
  • Subscribers 291 subscribers
  • Views 6918 views
  • Users 0 members are here
Related
See a helpful answer?

Be sure to click 'more' and select 'suggest as answer'!

If you're the thread creator, be sure to click 'more' then 'Verify as Answer'!

What is the best way to drive a relay?

swankybarbecue4
swankybarbecue4 over 7 years ago

I want to use raspberry pi GPIO pins to control a few relays. I was planning to use a 3904 NPN transistor with a 330 ohm resistor on the base of the 3904 and a fly back diode across the coil of the relay (just as shown in the attached image). My questions are: would it be more efficient power consumption wise to drive the relay with an MOSFET or power resister? And will I destroy an NPN 3904 transistor over time if I use it in the circuit shown below? I see people using BC transistors (like a BC 141) instead of an NPN transistor like I described. image

  • Sign in to reply
  • Cancel

Top Replies

  • dougw
    dougw over 7 years ago +3
    Your circuit should work fine depending on the coil impedance. I prefer a MOSFET because they are more efficient - no wasted base current, less load on the digital output, and more voltage across the relay…
  • geralds
    geralds over 7 years ago +3
    Hi, This is often an important question, but not often really correctly answered. First you have see your application, e.g. which component you will drive. A relay normally is current driven by the given…
  • luislabmo
    luislabmo over 7 years ago +3
    I think before considering a final solution, you need to ask yourself what are exactly your needs, that way you can define what will work best for your specific scenario so, here my two cents: I agree…
Parents
  • shabaz
    shabaz over 7 years ago

    Hi Merrick,

     

    I see you've copied a diagram from some website, but if that website didn't help explain or provide you with some confidence that the circuit was a suitable way of doing things, then it isn't a very good website to use for learning. You're better off grabbing a couple of beginner books, because they will cover this. Please see the information (in the body of the post, and in the comments section) here: I Want to Do Electronics!  Where do I start?

     

    It will be far quicker than trying to explain the behaviour of a NPN transistor, or a MOSFET, or a power resistor. Also, you should just try it (with low voltage) to experiment with it. If you want to see example circuits connected to GPIO, check out this link, it has a relay circuit too, and you'll see it is similar to what you've shown in the diagram.

    Raspberry Pi GPIO Explained

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
Reply
  • shabaz
    shabaz over 7 years ago

    Hi Merrick,

     

    I see you've copied a diagram from some website, but if that website didn't help explain or provide you with some confidence that the circuit was a suitable way of doing things, then it isn't a very good website to use for learning. You're better off grabbing a couple of beginner books, because they will cover this. Please see the information (in the body of the post, and in the comments section) here: I Want to Do Electronics!  Where do I start?

     

    It will be far quicker than trying to explain the behaviour of a NPN transistor, or a MOSFET, or a power resistor. Also, you should just try it (with low voltage) to experiment with it. If you want to see example circuits connected to GPIO, check out this link, it has a relay circuit too, and you'll see it is similar to what you've shown in the diagram.

    Raspberry Pi GPIO Explained

    • Cancel
    • Vote Up +2 Vote Down
    • Sign in to reply
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube