ULN2803 Limiting Current Problem

Discussion in 'Embedded Systems and Microcontrollers' started by RavenerAbnorm, Sep 8, 2015.

  1. RavenerAbnorm

    Thread Starter New Member

    Sep 2, 2015
    9
    0
    Hi,
    I was testing a small circuit I had which I intend to recreate on a larger scale once I had the basics down.
    It involves using a micro controller and a P channel MOSFET to switch an LED on. And to later add a ULN2803 to sink the current.
    What I found weird is that by adding the ULN2803, the current to the LED drops significantly (20mA to 1mA). I am aware there is a voltage drop across the NPN transistor and that I did not change the value of the resistor value between adding the ULN2803 but the current supplied seems to be a constant 1mA making me believe that the ULN2803 is acting as a constant current device.

    Can anyone shine some light on this and maybe how I can get the load current back to around 20mA?
    Thanks
     
  2. blocco a spirale

    AAC Fanatic!

    Jun 18, 2008
    1,438
    368
    Don't you think the LED should be connected to the output side of the ULN2803?
     
    RavenerAbnorm likes this.
  3. RavenerAbnorm

    Thread Starter New Member

    Sep 2, 2015
    9
    0
    Hi. Thanks for your reply. I originally had it on the output- but the LED did not light. So I thought I had it the wrong way around.
     
  4. be80be

    Senior Member

    Jul 5, 2008
    431
    57
    Think you don't understand how a uln2803 works you hook the input side to your uC the led on the output side then too supply no need for MOSFET
     
  5. blocco a spirale

    AAC Fanatic!

    Jun 18, 2008
    1,438
    368
    The output of the ULN2803 is an open-collector so you must connect the anode side of the LED to +V and the cathode to the output (with a series resistor, of course).

    And yes, the mosfet does appear to be redundant.
     
  6. RavenerAbnorm

    Thread Starter New Member

    Sep 2, 2015
    9
    0
    Thanks for the reply. I'm using the uln2803 and a mosfet to protect the micrcontroller from sourcing and sinking too much current so I think its the correct way.

    I've since moved the LED to the output side. I've figured out my mistake. It was regarding the microcontroller software. Both outputs need to be driven high to turn it on - as the mosfet is P channel. I had originally one as a low and the other as high.

    Its redundant currently but it won't be when I have much more LEDs to supply current to.

    Thanks anyway guys.
     
  7. blocco a spirale

    AAC Fanatic!

    Jun 18, 2008
    1,438
    368
    Take a look at the datasheet for the microcontroller to determine its output current capability. You certainly don't need a mosfet between the output and the ULN2803. Since they both do the same job, use one or the other but not both.
     
  8. ScottWang

    Moderator

    Aug 23, 2012
    4,853
    767
    When you want to using the I/O ports to control the external device or components, you should send a high to active them, if you send a low, it could be active them during the uC initializing.

    And here, you don't need the p mosfet as be80be and blocco a spirale mentioned.
     
  9. be80be

    Senior Member

    Jul 5, 2008
    431
    57
    No you'll just have more leds that don't work. Your going about this all wrong.
    You only need to worry about current going one way use the mosfet and tie the grounds of the leds to ground.
    or use the uln2803 and tie the leds to VDD input to your I guess arduino with a 1 k then the output use a 200 ohm to the led and led tied to VDD not both.
     
  10. be80be

    Senior Member

    Jul 5, 2008
    431
    57
    Here with a mosfet
    [​IMG]
     
  11. be80be

    Senior Member

    Jul 5, 2008
    431
    57
    And here's with the uln2803
    [​IMG]
     
    Last edited: Sep 8, 2015
  12. ScottWang

    Moderator

    Aug 23, 2012
    4,853
    767
    if the led is 3V/20mA then the 220Ω is too small for a continuing current use, because the light fades, if for a 1khz signal that the 220Ω is too big, at least it can be providing around 30mA.
     
  13. be80be

    Senior Member

    Jul 5, 2008
    431
    57
    I didn't pick the parts I just showed how it's done you can't fix something if you don't have all the part's
    He would need to make changes for how many leds he is using and a red led if you look the voltage is 7.5 volts
    which works out to 20 mA a led . It would light up nice.
    I just posted how it could be done.

    Not how it shouldn't like the OP is thinking
     
  14. ScottWang

    Moderator

    Aug 23, 2012
    4,853
    767
    I knew you just linked the page for reference, I did the similar things and waiting the response from TS to see what to do the next step ... :)
     
  15. RavenerAbnorm

    Thread Starter New Member

    Sep 2, 2015
    9
    0
    Guys thanks for your input. But I assure you I will need a p channel mosfet in my final design. It will be a 32x8 LED matrix and an arduino is working with an led driver in the final design. This driver is capable of only sinking and sourcing small amounts of current when using common anode LEDs. 32 LEDS per column requires about 2A so there is a requirement to use the small current from the LED driver to allow current to flow from a power supply to the LEDs. I realise from the schematic I posted where things were lost in translation.

    An NPN switch requires high to turn the switch on, a P channel FET requires high to turn it off. To light an LED in a column you would need to write a column low (FET high) and row high (NPN high) in the LED driver.
     
  16. ScottWang

    Moderator

    Aug 23, 2012
    4,853
    767
    Shows the circuit of your final design.
     
  17. RavenerAbnorm

    Thread Starter New Member

    Sep 2, 2015
    9
    0
    View attachment 90909

    Some small modifications have changed in the meantime. Mostly on the powering of the project but matrix set up is the same.
     
  18. be80be

    Senior Member

    Jul 5, 2008
    431
    57
    OK you think so that's not the same at ALL
    I don't see no leds going to the input of a uln2803
     
Loading...