how to connect an LED to PC

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

Reply to
wills.kingspanama
Loading thread data ...

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:

formatting link

Good luck

Michael

Reply to
mrdarrett

Why not use the serial port?

Reply to
gfretwell

Ya know, this is kind of interesting.

formatting link

(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.

Reply to
mrdarrett

formatting link

Reply to
ehsjr

So if it's 2.6 mA max (data pins to ground), are the 470-ohm resistors still necessary? (grin)

Michael

Reply to
mrdarrett

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

Reply to
gfretwell

This circuit was loads of fun.

formatting link

I used a modified version of this:

formatting link

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

formatting link
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

Reply to
mrdarrett

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 .

Reply to
wills.kingspanama

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

Ed

Reply to
ehsjr

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)

Reply to
mrdarrett

I posted a page on my website re: controlling a light bulb by parallel port:

formatting link

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

Reply to
mrdarrett

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

Reply to
ehsjr

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

Reply to
ehsjr

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

Reply to
mrdarrett

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

Reply to
ehsjr

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.

--

Bye.
   Jasen
Reply to
jasen

ehsjr wrote: ...

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

Michael

Reply to
mrdarrett

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

Reply to
ehsjr

Ok thanks!

Michael

Reply to
mrdarrett

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.