element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • 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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • 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
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • 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
Arduino
  • Products
  • More
Arduino
Arduino Forum ULN2003A driving IRF540N mosfet
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Arduino to participate - click to join for free!
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Suggested Answer
  • Replies 34 replies
  • Answers 1 answer
  • Subscribers 412 subscribers
  • Views 7752 views
  • Users 0 members are here
Related

ULN2003A driving IRF540N mosfet

wallarug
wallarug over 11 years ago

Hey guys,

 

I am trying to expand the number of outputs on a board that I built 6 months ago that controls high current LED strips but am unsure if the following would work. Could someone please let me know if what I am trying to do in the following schematic will even work??

 

Thanks is advance.

 

imageimage

 

PS: I am aware of the 'negative logic' on the march 2014 version.

  • Sign in to reply
  • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 11 years ago in reply to wallarug

    yup, or this for the Darlington version

     

    http://au.element14.com/vishay-semiconductor/ilq55/optocoupler-photodarlington-5300vrms/dp/1612450

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • wallarug
    0 wallarug over 11 years ago in reply to Robert Peter Oakes

    I am reading the datasheet correctly:

    maximum 125mA output current

    20mA into the base (now an LED)

     

     

    1. To use one of these do you have to buffer both the input and the output if you plan on driving >120mA and your micro-controller can only handle <15mA output?

    2. Connect to controller like a normal LED?

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • mcb1
    0 mcb1 over 11 years ago in reply to wallarug

    you would have to provide some sort of 'boost'/buffer due to the input current being >30mA,  right?

    Not necessarily, as this is the maximum current.

     

    Your current transfer ratio is the 'gain/loss' in the system.

     

    In thisimage

    In this spec they apply 5mA to the LED, and the Collector current is 2.5-30mA (50-600%) at 5v supply

    At 10mA it is 6-12mA (60-120%) at 5v supply

     

    The other one peter quoted is between 100 and 400% transfer but has a higher saturation voltage (0.9v), which may cause some problems depending what fet you use.

    Since you will be driving a mosfet and its a voltage device, then high current isn't really necessary, and with the isolation, you can always use it to supply voltage to the gate, rather than drag down the voltage source.

     

    Your investigation about failures is absolutely right.

    For a production where you want nothing to go wrong having that litte extra insurance, for a few dollars is probably worth it.

    It also gives you some increased flexibility, so its not wasted.

     

     

    Mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • wallarug
    0 wallarug over 11 years ago in reply to mcb1

    Yes, for the supplying the FET there is nothing wrong with using the above Opto-coupler.

    Still learning about opto-couplers ATM and getting my head around the different terminology but I understand everything that you said above.

     

    However, I haven't been very clear on this thread and might have drifted a bit from the original question because I am working on a number of different projects at once, trying to see how I can improve each one with what is said in this discussion.  Other projects that I have done in the past have also drifted into this discussion as well.  I will just briefly outline each one for clarity.

     

    Project One:  The Musical Set Prop Control Board (A.k,a:  "The Hot Box Sign")

    Status:  Complete and FINISHED.  It is just being used as a reference for "project two" because it worked so well.

     

    Project Two:  Christmas Lights Control Board for controlling 5050 RGB LED Strips

    Status:  Planning stage.  It should be the one being discussed in this thread.  I might have mentioned it above somewhere but just for clarity I shall rehash:  I want to control seven RGB LED strips which vary in length from 0.5 meters to 2 meters.  I worked out that I need 21 channels to control each strips RGB colours individually. The power used by each 'channel' is approximately 0.6A maximum. I was going to use IRF540N MOSFETs allow me to control the LEDs from a micro-controller (possible a Raspberry Pi or Arduino).

     

    Project Three:  Model Railway Redo

    Status:  Planning Stage.  I will probably do a write up on this one later but I was going to use some of the content discussed here (such as: Opto-couplers, MOSFETs, ULN2003, etc.) on this project as well.  It involves controlling a variety of different devices (signals, point motors) with an Arduino, 98% software driven.

     

    So in response to mcb1

    Since you will be driving a mosfet and its a voltage device, then high current isn't really necessary, and with the isolation, you can always use it to supply voltage to the gate, rather than drag down the voltage source.

    I understand but I have been thinking about a variety of projects as well as discussing this one and that's why I asked:

    1. To use one of these do you have to buffer both the input and the output if you plan on driving >120mA and your micro-controller can only handle <15mA output?

    So you don't have to buffer the input if you plan on driving < 5mA load due to the gain/loss ratio.  Thank you for answering my ambiguous questions.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • gdstew
    0 gdstew over 11 years ago in reply to wallarug

    A series current limiting resistor is not needed for a MOSFET. The gate of the MOSFET is primarily a capacitive load with high input impedance and almost no current (there is some leakage in the gate "capacitor))

    required to maintain it in the on state. This means it is a voltage (not current) controlled device. Normally a series resistor between 4.K and 10K is used to help better match the output impedance of the driver to the

    input impedance of the MOSFET. At 100 KHz you may want to stay near the lower values to improve off to on switching times (some current is needed to charge the gate capacitor when switching).

     

    While you can use an opto-isolator to isolate the Raspberry Pi output from the voltage the MOSFET is driving the gate of the MOSFET is electrically isolated from the source and drain by a insulator between the

    gate and the source/drain conduction channel it is controlling. This provides some level of protection as long as the gate insulator breakdown voltage between the gate and the conduction channel is not exceeded.

    So in your case (a primarily non-inductive load) with a properly selected MOSFET an opto-isolator is overkill unless you want to be really, really, really safe. It would be even better if the source of the 12V has over

    voltage shutdown protection which many (but not all) voltage regulators do.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Robert Peter Oakes
    0 Robert Peter Oakes over 11 years ago in reply to gdstew

    The series resistor also provides slew rate limiting and will prevent or at least limit the output of the MOSFET from ringing, this can be substantial without the resistor and I have seen this first hand where it would drive my Keithley power supply crazy as it oscillated through capacitive feedback between gate, Drain and Source. Yes in some cases you can get away without the resistor but ultimately not worth the effort of not having it

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • michaelkellett
    0 michaelkellett over 11 years ago in reply to Robert Peter Oakes

    If the MOSFET is only switching relatively low voltages (less than 60V)  an opto isolator is quite un-necessary.  The 10k series resistor is a good idea because although it will slow the MOSFET down a lot it will also protect the micro-controller from power fed back from a failed MOSFET.

    If the MOSFET is driven directly by the Arduino you must pick one which will turn on properly with only 5V gate voltage. I wouldn't use the IRF540N because (at least in the IR data sheet) the on resistance is not specified for 5V gate drive.

    Using a photo darlington type opto isolator would mean the you must pick a MOSFET with a high gate threshold voltage.

    Remember when choosing parts that you can't count on anything that isn't specified.

     

    The TPIC2701 device suggested is nice but obsolete - you can't buy them from Farnell, RS, DigiKey or Mouser so it's best avoided.

     

    To summarise, if you don't wont to go fast use the Arduino driving a suitable MOSFET (logic level threshold) though a resistor (10k is good value for slow switching).

    If you need to go fast use a driver, either  a proper MOSFET driver for really fast, or an open collector device like the 7406 or an opto-isolator (but don't use a darlington type - and drive it as hard as you can within the limitations of the Arduino's outputs.)

     

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • mcb1
    0 mcb1 over 11 years ago in reply to michaelkellett

    Michael

    If you were to read all the reasons the opto-coupler was suggested, it wasn't just for protection.

    Yes if nothing ever goes wrong, then nothing should ever destroy the controller ... never seen that "nothing ever breaks scenario" in my career, but it's possible.

     

    Wallarugs last project included the abilty to PWM, and I'm assumming that the design should allow for it in this one.

    He hasn't said it will or won't so we are tending to allow for it.

     

    Some of the parts were choosen due to local suppliers and availability, so while you are correct and there may be other choices, we work with what the OP has suggested.

     

    I think Wallarug learned an awful lot in the last round (along with some other observers), and it's great that he is prepared to engage and increase his knowledge.

     

    Mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • michaelkellett
    0 michaelkellett over 11 years ago in reply to mcb1

    I'm not quite sure what you are getting at here:

    If you need to pwm the speed of the opto-isolator must be considered - the single transistor types mentioned in previous posts in this thread have turn off times of the order of 20uS and the darlington more like 40uS (both could be a lot worse but won't get much better as you change drive levels and loads). 20us turn off time would, in my book, suggest a maximum  switching frequency of 5kHz but for good efficiency below 500Hz. That's OK for some stuff but not very fast.

     

    Of course there are fast opto-couplers and isolating devices but they are expensive and actually don't usually have the ability to drive  MOSFETs directly.

     

    If you need protection and don't need speed (and I suggested only good up to about 60V) then a 10k resistor is fine. If you check on the ATmega328 data sheet it shows that all the IO is protected by diodes to OV and supply but I couldn't find a maximum current spec for them. The 60V and 10k combination results in only 6mA of fault current which is (based on other device specs) very unlikely to damage the processor.

     

    MK

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • mcb1
    0 mcb1 over 11 years ago in reply to michaelkellett

    MK

    You may have missed this in reply #7

    I planned to continue using my Raspberry Pi to switch them on, off and PWM them.  This should be ok since the raspberry pi's PWM is at a maximum of 100Hz.  Each GPIO pin can handle 1.5mA each (50mA/26 pins = ~1.9mA) which a 2k2 Ohm resistor will help limit the current to 1.5mA.  Pull-down resistor included for good practice (10k).

     

    One of the other 'adantages' of using the opto-coupler was to make the board versatile and able to be located some distance away from the controller.

     

    Perhaps this blog has shown that we should have something that covers driving large loads and some sensible and relatively cheap options.

    Pity the site doesnt allow those 'sticky' posts so everyone can easily find it.

     

    Mark

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
<>
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 © 2026 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