Connect with us

how to connect an LED to PC

Discussion in 'Electronic Design' started by [email protected], Oct 3, 2006.

Scroll to continue with content
  1. Guest

    Greetings,
    How to connect an LED to the PCs PPI and make it glow by program?
    Thanks in advance.
     
  2. Guest


    You could use a micrcontroller... Microchip's PIC or Atmel's AVR.

    Then the question becomes... "How do I program my microcontroller?"
    ;-)

    Or you could try something like this:

    http://taomc.com/bits2bots/lightbyte.htm

    Good luck

    Michael
     
  3. Guest


    Why not use the serial port?
     
  4. Guest


    Ya know, this is kind of interesting.

    http://www.taomc.com/bits2bots/litbit.htm

    (Amazing what one can learn when trying to answer someone else's
    question.)

    I have a new question for the group. I don't have any LEDs lying
    around, but I have a few light bulbs lying around. I know that the
    data output voltage is 5V, but what is the maximum safe current to
    draw? I'm guessing that, since resistors are required for the LEDs,
    the current is fairly high - hundreds of milliamps, I'm guessing. But
    I also wouldn't want my light bulb to fry my parallel port, if it draws
    too much current.
     
  5. ehsjr

    ehsjr Guest

  6. Guest

  7. Guest

    Parallel ports are very easy to blow, that is why I suggested
    experimenting with the more robust serial port.
    You certainly want to buffer the output with some kind of line driver.
    A 2n2222 (or similar small silicon NPN) in emitter follower will work
    if you just want to keep it simple
     
  8. Guest


    This circuit was loads of fun.
    http://mrdarrett.googlepages.com/blinkm.bmp

    I used a modified version of this: http://www.cpemma.co.uk/555pwm.html

    I used it to drive a 6V light bulb (in lieu of the the motor and diode)
    with a 9V battery. My 4-year-old son loved it.

    Had to use an old '486, booting from a DOS disk. I tried the Porttalk
    thing on my Win2k laptop
    (http://www.beyondlogic.org/porttalk/porttalk.htm), with mixed results.
    Simple debug scripts worked fine on Porttalk on Win2k...

    on:
    C:\>debug
    -a100
    mov dx,378
    mov al,1
    out dx,al
    ret
    (enter)
    rcx
    7
    non.com
    w
    q

    off:
    C:\>debug
    -a100
    mov dx,378
    mov al,0
    out dx,al
    ret
    (enter)
    rcx
    7
    noff.com
    w
    q

    (now you have on.com and off.com, loads of fun.)

    But a more advanced program using Turbo C++ 1.0 for DOS failed
    miserably with keyboard input. (Had to use a DOS disk, booted the '486
    with it, then the lights blinked like they should.)

    Just curious, what would a recommended resistor value be? Is 100 ohms
    good enough? Nothing seemed to get too hot with mine.

    Michael
     
  9. Guest

    Greetings,
    Thank you all for your reponses.I think before using the
    serial the data rate has to be set and it involes some more work to be
    done.Is it possible to send some data to a dummy address and connect an
    led to the data bus .
    Thanks .
     
  10. ehsjr

    ehsjr Guest

    Where's you get 470 ohms? That won't limit the current enough.

    Ed
     
  11. Guest


    Oh, good point. Got that from a random page on LEDs.

    To limit current to 2.6 mA, I'd need 2 k-ohm, right? (R = 5V / 0.0026A)
     
  12. Guest


    I posted a page on my website re: controlling a light bulb by parallel
    port:
    http://mrdarrett.googlepages.com/blinky

    Is a 2 k-ohm resistor big enough? Should I make it larger, just to
    stay on the safe side?

    Coming soon: PWM motor control via parallel port.

    Michael
     
  13. ehsjr

    ehsjr Guest

    Well, you need to take the LED Vf drop into account.
    Assuming 1.8v for the LED, 2K would limit it to ~1.6 mA
    The general case is (Vsource - Vf)/R = I

    Ed
     
  14. ehsjr

    ehsjr Guest

    You don't get a lot of base drive with that 2K resistor,
    and yet you want to be darn sure you protect the port.

    If you really intend to drive an incandescant bulb, you'd
    be better off with a darlington, like a TIP120. In terms
    of figuring the base resistor, you would be able to use a
    4.7K. The TIP120 in your circuit with 4.7K base resistor
    could drive a bulb that needs up to 1 amp.

    You can use the idea embodied in the circuit with a small
    transistor and drive a LED with that circuit, provided you
    put a proper resistance in series with the LED.
    Here's a diagram:


    +9 --------------------+
    |
    [470]
    |
    [LED]
    |
    /c
    Pin 2 -----[3.3K]---| PN2222 or similar
    \e
    |
    Gnd -------------------+

    The above will give you about 15 mA through
    the LED, and limit the current drawn from
    the parallel port to ~1.5 mA, worst case.

    Ed
     
  15. Guest

    Ah. I was planning on driving even bigger loads than my incandescent
    lamp. I drove a 1A 12V blowdryer fan with an IRF530, with the setup on
    my website. My MOSFET got kinda warm - about 105 F with a heatsink.
    (I used a diode and two caps as the 555 PWM circuit recommended.)

    Is a 3.3k still good for an IRF530?

    Thanks!

    Michael
     
  16. ehsjr

    ehsjr Guest

    Hmmm... since you change the design with every post, I'd
    recommend a "universal interface" between the parallel port
    and the device driver you choose. The interface would be
    there strictly to protect the parallel port, and/or to
    drive low current (< 175 mA) devices directly.
    You would use the output from it to control the driver
    for whatever device you intend to use. A ULN2003 comes in
    in a 16 pin DIP and provides 7 darlington transistors
    so you can use it for 7 pins. You could use a 3.3K
    resistor between each PP pin and the corresponding
    input pin on the ULN2003.

    With regard to your IRF530 - putting 5 volts on the
    gate won't turn it all the way on. The resistor at
    3.3K would be fine*, but the gate voltage is low.

    * = you need very little current on the gate - except
    when you need rapid turn on. But your 5 volts already
    is a problem which superceeds that.

    Ed
     
  17. jasen

    jasen Guest

    I was wondering what hardware PPI indicated, a web search gave little info.
    oh yeah, the parallel port is great for simple interfacing.

    IIRC 11 outputs and 5 inputs.
    there;s a resistor inside the port that'll limit the current you get to a
    safe amount (less than 5mA), not enough to light a lamp.
    they arenin this application they aren't.
    no.
     
  18. Guest

    ehsjr wrote:
    ....

    Gate fully open at 10VDC, then? (from reading the V_GS charts on an
    IRF530 spec sheet from digikey)

    Michael
     
  19. ehsjr

    ehsjr Guest

    10V will turn it on for you to drive heavy current,
    (presumably) like the motor will draw. I don't know
    what "gate fully open" means - I assume you mean
    turn the mosfet fully on.

    Ed
     
  20. Guest


    Ok thanks!

    Michael
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-