Opto-isolating PC parallel port, revised

Discussion in 'General Electronics Chat' started by hspalm, Mar 20, 2012.

  1. hspalm

    Thread Starter Active Member

    Feb 17, 2010
    201
    8
    Hello,
    this is my earlier post, http://forum.allaboutcircuits.com/showthread.php?t=56394, with a "bump" warning. If a moderator wants to combine the two threads, please do.

    Using KB817 optocouplers.
    Please note I forgot to draw pull-up resistor on CD4049UB input, and on logic side output (which value is ideal?)
    [​IMG]

    I was hoping to get some general input on my revised design. Some things I would like to point out:
    - Driver chips powered from USB, only sharing common ground with parallel port.
    - Now using CD4049/4050 inverters/buffers as driver chips to minimize load on PC parallel port, and also keeping polarity intact.
    - Using separate power source from USB for powering LEDs on PC side, and thus be able to totally isolate both 5v and ground on either side of circuit.
    - 1K series resistors on LEDs for If=4mA @ 5v (LED Vf=1.2V from KB817 optocoupler datasheet). CD4049/4050 has sink current of 3.2mA(min) to 6.4mA(typ) resulting in minimum Current Transfer Ratio of 110% in optocoupler.

    There will be 9 outputs used from PC parallel port, so I'm well within USB 100mA limit (500mA is only when properly asked for in software?).

    I am eager to take on this project again, hopefully you will have some additional good tips like last time!

    Henrik
     
  2. praondevou

    AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    The lower opto LED is inverted.

    The CTR is minimum 50% so above 2k pull up resistor it should be ok independent of the model (see page 3 of the datasheet).
     
  3. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,395
    1,607
    You could steal power from a USB port like that. It's more parts then making a USB based isolator but it works (and is certainly simpler).

    Check your TTL/LOGIC OUTPUT again. You have VCC directly to the transistor collector. That's one good way to burn out the isolator.
     
  4. hspalm

    Thread Starter Active Member

    Feb 17, 2010
    201
    8
    I see. That confuses me a bit. Since the plot at page 4 (CTR vs. If) defines a clear curve of CTR at different If, why is that CTR spec on page 3 so wide (50-600%) at a very specific 5mA @ 5v? Is it because "anything will pass" at 5v 5mA? I could put in a series resistor for 5mA If, but CD4049/50 is not guaranteed at this current (nor is at at 4mA as my intention, but closer).

    The LED should be correctly drawn. If you look at the pin numbers on the chip it's really only rotated 180 degrees.

    What is a USB based isolator compared to what I've done. Yes, this is an easy way to do this, and it's also the only way I could figure out for my self to make it completely isolated. Any hints on other implementations is considered :D

    And yes, I forgot to draw in the pull-up resistors. I stated that right before the picture :)
     
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,395
    1,607
    Exactly what a "USB based isolator" would be depends on what you're doing, but generally there are "generic" USB devices available that can give you several digital input and output lines. You could either use the same isolator approach you have for a parallel port, or put an isolator in the USB line itself. I know at least one company makes that USB isolator, I do not know if you can just buy one off the shelf.

    Printer ports are so 1990's you know ;-)
     
  6. hspalm

    Thread Starter Active Member

    Feb 17, 2010
    201
    8
    I see now, thanks for explaining. Parallel port is standard for hobby and some semi-professional stepper motor based CNC systems still. The design is real easy, each axis takes four pins: step, dir and enable outputs, plus one limit switch input. Many stepper motor drivers chips or H-bridge "front end" drivers use exactly these inputs like Allegro A3967 and A4988, ST L297 and toshiba TB6560/TA8435 with some additional logic on step/clock pins.

    So, this design is actually a feasible approach to interfacing my parallel port with isolation? That's all I needed to know :)
     
  7. praondevou

    AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    The buffers (4049/50) will work with 5mA.

    Consider the lowest CTR for your specific optocoupler and calculate the resistor accordingly. Have a look here http://www.vishay.com/docs/83706/83706.pdf

    Ok, just to make sure, the LED is drawn inverted, the anode needs to be connected to VCC. ;)
     
  8. hspalm

    Thread Starter Active Member

    Feb 17, 2010
    201
    8
    Can I just try and clear things up a bit for my self? The CTR of an optocoupler is "the ratio of the phototransistor collector current to the LED forward current". Does this mean that if an If of 5mA gave 100% (or ratio 1:1) CTR, could I expect 5mA Ic current? Or is 100% CTR the same as a fully saturated transistor base, so the Ic current is only limited by the load and Ic MAX from transistor specs?


    Ah, yes. I'd say my connections are inverted, because the optocoupler symbol is perfectly rotated 180 degrees, heh.
     
  9. praondevou

    AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    Look at figure 11 of the datasheet. VCEsat increases at lower LED forward current. That means you need to choose the output load resistor according to your forward current. Since your application is digital you want the transistor to be saturated, i.e. having a low voltage drop over CE .
    At 5mA forward current and 50% CTR min you can expect the transistor CE voltage to be low when the collector current is lower than 2.5mA.
     
  10. hspalm

    Thread Starter Active Member

    Feb 17, 2010
    201
    8
    I'm trying to wrap my head around that figure 11. Don't think I quite get it.
    The reason I want full saturation and low voltage drop Vce is because we're making digital signals, and want lowest voltage possible at output when transistor is conducting to ground?

    So I'm then looking at figure 11. What is most beneficial, choosing If first and then find lowest possible Vce OR finding best Vce, then limit If to fit?

    The Ic numbers with arrows pointing at the curves, are they valid for the whole curve they're pointing at, or only at that spot where the arrow hits?
    (I've been writing on this reply for ages now)

    Is it true that if I choose If=2mA will I have good (low) Vce saturation voltage at Ic=1mA?
     
  11. shortbus

    AAC Fanatic!

    Sep 30, 2009
    4,019
    1,542
    Most DIY CNC machine people have stopped using the opto-couplers/break-out boards on their machines. They have been found to be unneeded when using the printer port.
     
  12. hspalm

    Thread Starter Active Member

    Feb 17, 2010
    201
    8
    I have the opposite perception. I haven't seen many home-built controllers though, but most commercial states opto-isolated control board. Do you have any examples?
     
  13. shortbus

    AAC Fanatic!

    Sep 30, 2009
    4,019
    1,542
    Just what I've read about on the forum - CNCZone.com. In the beginning of home cnc everyone used a "break-out board" also known as a "BOB". So the companies that copied those boards (read- China) have just continued to do it. When you get a real stepper driver, like a 'Gecko', they don't have a BOB. They just wire directly to the printer port cable. In a stepper driver there are already several inter-faces between the 'logic' and actual motor drive, so the BOB has been found to be redundant.
     
  14. hspalm

    Thread Starter Active Member

    Feb 17, 2010
    201
    8
    Interesting. Would save me a lot of time prototyping...
     
Loading...