Shop OBEX P1 Docs P2 Docs Learn Events
For the Electronics Gurus. A question to insure I'm not doing something which c — Parallax Forums

For the Electronics Gurus. A question to insure I'm not doing something which c

James LongJames Long Posts: 1,181
edited 2009-11-30 22:43 in General Discussion
I want to control a mosfet (logic level) with a 5 volt digital output. Can I also put a led (with a current limiting resistor) on the same line?

Will the line be pulled down to the LED forward voltage? Or not?

James L

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
James L
Partner/Designer
Lil Brother SMT Assembly Services

Are you addicted to technology or Micro-controllers..... then checkout the forums at Savage Circuits. Learn to build your own Gizmos!

Comments

  • dMajodMajo Posts: 855
    edited 2009-11-25 19:54
    yes you can

    pEdit: the limit is your current capability of the output. The led will not change the line voltage level, it will only draw 3..20mA (depends on the led)

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · Propeller Object Exchange (last Publications / Updates);·· Vaati's custom search

    Post Edited (dMajo) : 11/25/2009 7:59:25 PM GMT
  • James LongJames Long Posts: 1,181
    edited 2009-11-25 19:59
    dMajo said...
    yes you can
    pEdit: the limit is your current capability of the output. The led will not change the line voltage level, it will only draw 3..20mA (depends on the led)

    Dmajo,

    I know the LED and resistor will draw exactly 7 mA. I'm wondering if the LED will prevent the mosfet from turning to full on.

    I may do something different. I may use the pin to sink the led and source the mosfet. I know that should work.

    James L

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    James L
    Partner/Designer
    Lil Brother SMT Assembly Services

    Are you addicted to technology or Micro-controllers..... then checkout the forums at Savage Circuits. Learn to build your own Gizmos!
  • dMajodMajo Posts: 855
    edited 2009-11-25 20:08
    Both the solution will work as none the solution will change the output voltage level until it is capable to supply the needed current. mosfets are driven by voltage not current. If i have understoog correctly you have choosen one with logic level gate so no problem at all. Look at the moset datasheet for the voltage treshold on gate. 5v output should be ok, no problem

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · Propeller Object Exchange (last Publications / Updates);·· Vaati's custom search
  • James LongJames Long Posts: 1,181
    edited 2009-11-25 20:23
    dMajo said...
    Both the solution will work as none the solution will change the output voltage level until it is capable to supply the needed current. mosfets are driven by voltage not current. If i have understoog correctly you have choosen one with logic level gate so no problem at all. Look at the moset datasheet for the voltage treshold on gate. 5v output should be ok, no problem

    So basically, if the pin can source more current than the LED can draw, the pin voltage will never fall.

    Just to insure we are on the same page, I attached a image of how the items are connected. The wire from the right is the input (digital 5v), the top wire is the voltage source to the Mosfet, and the lower wire is the supply from the mosfet.

    James L

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    James L
    Partner/Designer
    Lil Brother SMT Assembly Services

    Are you addicted to technology or Micro-controllers..... then checkout the forums at Savage Circuits. Learn to build your own Gizmos!
    574 x 715 - 35K
  • kwinnkwinn Posts: 8,697
    edited 2009-11-26 04:49
    Should be fine as long as the output pin can put out more than 7mA.
  • James LongJames Long Posts: 1,181
    edited 2009-11-26 05:17
    kwinn said...
    Should be fine as long as the output pin can put out more than 7mA.

    I decided to go a different route. I decided to sink the LED and source the Mosfet. I do not want to breadboard the whole project, so I just decided it was best that way. That will invert the LED output, but not a big deal for what it is.

    This is on a solar power project so the LED being off when the mosfet is on is actually giving 7mA of more power.

    But I do appreciate all the information. I figured I was correct, but I do try to insure I'm not wasting my time. If I would have had a mosfet, I would have just tried it. I didn't have any that could be put on a breadboard....I have plenty of surface mount items I could have hacked around to get to work, but too much of a pain to do so.

    James L

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    James L
    Partner/Designer
    Lil Brother SMT Assembly Services

    Are you addicted to technology or Micro-controllers..... then checkout the forums at Savage Circuits. Learn to build your own Gizmos!

    Post Edited (James Long) : 11/26/2009 5:22:29 AM GMT
  • dMajodMajo Posts: 855
    edited 2009-11-26 10:25
    James Long said...
    dMajo said...
    Both the solution will work as none the solution will change the output voltage level until it is capable to supply the needed current. mosfets are driven by voltage not current. If i have understoog correctly you have choosen one with logic level gate so no problem at all. Look at the moset datasheet for the voltage treshold on gate. 5v output should be ok, no problem

    So basically, if the pin can source more current than the LED can draw, the pin voltage will never fall.· YES

    Just to insure we are on the same page, I attached a image of how the items are connected. The wire from the right is the input (digital 5v), the top wire is the voltage source to the Mosfet, and the lower wire is the supply from the mosfet.····························································································································································· output

    James L

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · Propeller Object Exchange (last Publications / Updates);·· Vaati's custom search
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2009-11-26 14:46
    James Long said...
    A question to insure I'm not doing something which can not be done.
    John Lennon said...
    There's you can do that can't be done.
  • James LongJames Long Posts: 1,181
    edited 2009-11-26 20:08
    PJ Allen said...
    James Long said...

    A question to insure I'm not doing something which can not be done.
    John Lennon said...

    There's you can do that can't be done.

    Yea I know....horrific grammar.

    @Dmajo......yes you are right....it is an output.

    But any how...I did change the direction of the LED to facilitate a different operation.

    James L

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    James L
    Partner/Designer
    Lil Brother SMT Assembly Services

    Are you addicted to technology or Micro-controllers..... then checkout the forums at Savage Circuits. Learn to build your own Gizmos!
  • kwinnkwinn Posts: 8,697
    edited 2009-11-26 20:34
    Horrific grammar indeed. Horrific spelling too, sometimes to the point that it is painful to read.

    Do keep in mind though that this is an international forum, and for many participants English is a second language. They have learned a second language, which is more than a lot of us (myself included) have done.

    Of course then there are those I know have English as a first language and their spelling and grammar are.... oh well, just grin and bear it.
  • James LongJames Long Posts: 1,181
    edited 2009-11-26 20:41
    kwinn said...
    Horrific grammar indeed. Horrific spelling too, sometimes to the point that it is painful to read.

    Do keep in mind though that this is an international forum, and for many participants English is a second language. They have learned a second language, which is more than a lot of us (myself included) have done.

    Of course then there are those I know have English as a first language and their spelling and grammar are.... oh well, just grin and bear it.

    Hey my spelling is not great, but I have definitely seen worse.

    James L

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    James L
    Partner/Designer
    Lil Brother SMT Assembly Services

    Are you addicted to technology or Micro-controllers..... then checkout the forums at Savage Circuits. Learn to build your own Gizmos!
  • kwinnkwinn Posts: 8,697
    edited 2009-11-26 21:57
    James, that post was most definitely NOT aimed at you. If you thought it was I apologize for not making my post clear. I find your posts to be some of the better, more easily understood ones here. It was intended as a general observation with the added observation that the errors of those for whom English is not their first language are understandable.
  • James LongJames Long Posts: 1,181
    edited 2009-11-26 22:23
    kwinn said...
    James, that post was most definitely NOT aimed at you. If you thought it was I apologize for not making my post clear. I find your posts to be some of the better, more easily understood ones here. It was intended as a general observation with the added observation that the errors of those for whom English is not their first language are understandable.

    Kwinn,

    No problem......I may have taken it to heart, mainly because I do not spell well. It really sucks when I have to re-edit my own post 4 times before I get it right.

    I do also see many post from members who have English as a second language. It is hard at time to follow their meaning, that is why I try to keep everything in a formal manner when posting to them. I try to stay away from slang or other bad habits.

    It's Thanksgiving here in the US, and I give thanks for all the friends and associates I have here online and in the Parallax forums. Especially those to help with the non-microcontroller stuff. smile.gif


    James L

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    James L
    Partner/Designer
    Lil Brother SMT Assembly Services

    Are you addicted to technology or Micro-controllers..... then checkout the forums at Savage Circuits. Learn to build your own Gizmos!
  • dMajodMajo Posts: 855
    edited 2009-11-26 22:25
    Actually English is my third language after Italian and Slovenian, then also a little bit of Spanish and French

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · Propeller Object Exchange (last Publications / Updates);·· Vaati's custom search
  • kwinnkwinn Posts: 8,697
    edited 2009-11-27 02:39
    James, I know what you mean about editing. At one time I was an excellent speller but I seem to be getting worse day by day. Now I check my posts carefully for the red highlights and out of place words. Have a great Thanksgiving.

    dMajo, now I am impressed. Your English is excellent and your posts clear and easy to understand. I wish I had half your linguistic talent. After all these years traveling to Quebec regularly I am barely able to order a coffee and bagel at Tim Hortons.
  • dMajodMajo Posts: 855
    edited 2009-11-27 13:55
    @Kwinn: Yes, Italian and Slovenian are my mother/father languages, English has been learned at school (I have to thanks that teacher even if I hated her at that time) and then improved by travelling much around the world·alone (I was for long time a field assistance/commissioning technician, thus have learned the basis of spoken spanish/french). When you are alone you haven't friends to speak with in your mother language so you are forced to learn foreign people's language or speak english. This is a big advantage. Now that I am not travelling so much I use to watch DVD/BD movies in english, if I have some troubles I switch on also english subtitles, but I still miss someone to speak with to exercise also the spoken part. I feel my english still very bad, a lot of spelling/grammar errors, a lot of unknown words which meaning I try to non misunderstood from the sentence context. Your good impression is because this is a technical forum and I am a technician who has all the life studied, read datasheets, manuals that is available mostly in english.

    Anyway thank you very much

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    · Propeller Object Exchange (last Publications / Updates);·· Vaati's custom search

    Post Edited (dMajo) : 11/27/2009 2:02:01 PM GMT
  • ercoerco Posts: 20,260
    edited 2009-11-30 21:54
    Getting back to the original question, I like to use high efficiency LEDs from Junun that burn fairly bright on just 2 mA. They come in red and green.·See http://www.junun.org/MarkIII/Info.jsp?item=62·and http://www.junun.org/MarkIII/Info.jsp?item=63·. 2 mA is extremely low current, unlikely to disturb any adjoining circuitry.

    I use these with a series resistor in parallel with a high-efficiency Aromat polarized relay coil (w/flyback diode), and drive them all directly with a Stamp pin; total current draw is just·17 mA. No driver transistor required.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    ·"If you build it, they will come."
  • Peter JakackiPeter Jakacki Posts: 10,193
    edited 2009-11-30 22:43
    James,

    Something to keep in mind with CMOS outputs is that they are primarily resistive so it's not true that they hold their voltage as that voltage will vary with load. With no load you will have maximum output voltage but even a 7ma load will affect the output voltage a bit and this is especially important when driving a MOSFET. You did the right thing though by sinking the LED and sourcing the MOSFET as this will ensure the MOSFET gets the maximum drive. The last suggestion with using a high-efficiency led (or just super-bright) at low currents will also work if you have to source the led. I find that it only takes a little effort to find super-bright leds at around the same price as common leds. I used some 0603 leds recently from DIGIKEY which are really bright and cheap, but they are perhaps a tad small for prototyping.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    *Peter*
Sign In or Register to comment.