Optoisolating a computers paralell port from motor drive circuit

Discussion in 'General Electronics Chat' started by hspalm, Jun 30, 2011.

  1. hspalm

    Thread Starter Active Member

    Feb 17, 2010
    201
    8
    Hello
    I want to optically isolate the computers parallel port from a motor drive circuit.

    Question #1
    On the ports inputs (this will be the limit switches from CNC machine) I have no +5v for the pull-up resistors on the paralell port side, thus there will not be 100% isolation. I was thinking to let the transistor outputs pull the port inputs to ground when the limit switch is closed, but while switch is not closed, I need to pull the pin high.
    Is this a correct implementation of optically isolating a circuit from the paralell port, or do you suggest another method for the the inputs?

    Question #2
    The outputs of the parallel port is straight forward, at least I think so. The voltage from the output pin of the parallel port will source current for the LED in the optoisolator, which in turn turns on the transistor part of the isolator on. On the circuit side I can use "local" +5v to pull microcontroller pins high.
    But will the current from the parallel port be sufficient to turn the LED in the optoisolator on?

    Thank you!

    Edit: Added a schematic to help clarifying the problem. I don't know if it does, though.
     
    Last edited: Jun 30, 2011
  2. #12

    Expert

    Nov 30, 2010
    16,248
    6,745
    1) yes
    I expect that +5 is SOMEWHERE on the parallel connector, but I don't know where.

    2)I think you'll have to measure the current available from the output pin of the parallel port. Use a resistor and measure how much the voltage fails to still be the original voltage.

    4 instance, if your parallel port delivered +12 volts and you put a 12,000 ohm resistor from that to ground and the voltage fell to 11.89 volts, that would be OK.and indicate that the internal resistance of the +12V was .11v/(11.89/12,000) or 111 ohms.

    If you then used a 1000 ohm resistor, the voltage should fall to 10.8 volts because you were using 9.72 milliamps.

    This is how to measure. Now, you do it and you will have answers.
     
  3. hspalm

    Thread Starter Active Member

    Feb 17, 2010
    201
    8
    Thank you for your answers, #12.

    I didn't want to measure the current from the parallel port myself. This is because I first had to find some software to control the ports output and then go about actually measuring them. You might find this a bit irritating, but I figured I might as well ask when I was already putting up question number one.

    I have read the datasheets for my optoisolators and found that 10mA of current is max allowed on 5v. And if my parallel port is IEEE compliant, it will be able to sink 14mA, and in some cases source 14mA. I found this by googling, which is what I've should have done in the first place. But at least now people who read my can find two usefull answers :)

    I am pretty sure there are no +5v lines on the parallel port, though. I'm considering just putting in a USB or PS/2 port just for the isolation purpose.
     
  4. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
    +5v is not available on the DB25 printer connector.
    However, you could use a ATX "Y" molex power supply cable and get 5v from that; between red and black (GND) is +5v, yellow and black is +12v.
    Example of the cable is on this page: http://www.atxpowersupplies.com/atx-power-supply-ysplitter.htm

    I'll also suggest that you purchase a PCI printer card. If you "zap" the mobo's LPT port, you may very well wind up zapping a lot more than just the port. If you zap a PCI card, you can just swap in a new one in a few minutes.

    I'll suggest that you don't expect your printer board to source or sink more than 1mA per pin. Use driver ICs or the like instead of stressing the board.
     
  5. #12

    Expert

    Nov 30, 2010
    16,248
    6,745
    As a practical, hands-on, kind of person, measuring is what I resort to when I don't know the answer. I have no objection to googling it. Whatever works is OK with me, but I didn't know how to ask the question! Something like, "parallel port +12v current available"?

    The more specific the question, the less likely to get useful answers, especially with high tech questions. For me, the lazy way is to measure it, and I always prefer the lazy way. :)
     
  6. hspalm

    Thread Starter Active Member

    Feb 17, 2010
    201
    8
    What do you think of using the USB or PS/2 port instead of ATX supply? It's just a bit more available.
    When you say driver ICs, I start thinking it will clog up space on my PCB. You see, I'm trying to compact everything right now because of the supercheap 10x10cm PCB service at itead studio and seeed studio. Do I have to use something like the ULN2003 or similar? I guess it's just one chip, and all I need is 6 drivers.

    Thank you for your suggestions.

    edit: or maybe I can just use 74LS series buffers? Like the 74LS367 Hex Buffer Tri-State?
    Now here's a dumb one: In the 74LS367 it says "HIGH Level Output Current -2.6 mA". That's something I have yet to understand. Why is there a negative current specified on the output HIGH level? And why is it 1/5th of the LOW level current?
    In tlp281 data sheet (my optoisolator) it says 2.6 mA forward current on LED will give transistor collector current of ~2-3 mA. I guess this is more than sufficient to drive uC pin LOW, but which pull-up resistor to use?
    Hope you understand my questions. This analog bit often confuses me...
     
  7. hspalm

    Thread Starter Active Member

    Feb 17, 2010
    201
    8
    I guess your right. And also, for a more hands-on answer, measuring the actual current you have available for your application is always the best!
    BUT, as I luckily found out, in this application I want to build a motor driver circuit which does not only fit my computer, but everyone else's to! Since it seems that DB25 connector on paralell port not always is able to deliver sufficient current, other people could have problems with their computer.
     
  8. #12

    Expert

    Nov 30, 2010
    16,248
    6,745
    Yes, you have to consider these things when going public. You'll probably end up using about 100 to 1000 microamps from each relavent pin to get information from the parallel port, and use a seperate power supply to run the device.
     
Loading...