Please help using Optocoupler with Parallel Port

Discussion in 'The Projects Forum' started by cremaster, Sep 4, 2010.

  1. cremaster

    Thread Starter New Member

    Jun 30, 2010
    19
    0
    I am building a laser plotter with a dismantled etch a sketch. A stepper motors are attached to each knob and controlled via two ULN2003s by my parallel port. The laser is attached to the stylus of the etch a sketch and its driving circuit, which is in turn connected to a 7.2V 1400mAh rechargeable Ni-Cd battery.

    I have a big problem though! The parallel port must also be able to switch on and off the current from the battery to the laser driving circuit, which is a maximum of 400mA. I just recieved four 4N35 Optocouplers that I ordered:

    http://www.datasheetcatalog.org/datasheet2/1/03tgz200g5x4946jka7isojyj5wy.pdf

    And I realize that their absolute maximum collector current is 100mA. Im not entirely sure how I would use these at the moment, but I think a maximum collector current of 100mA will not do, as the 400mA should be flowing from collector to emitter.

    Your advice is appreciated. What is the best way to switch on and off 400mA of current from one pin of my parallel port? Should I just go looking for another optocoupler with higher current rating? Am I on the right track generally?
     
  2. t_n_k

    AAC Fanatic!

    Mar 6, 2009
    5,448
    782
    You could possibly use the 4N35 photo-transistor as the base side element of a Darlington pair. The main Darlington transistor could be one with a collector current rating commensurate with the 400mA requirement.
     
  3. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    You can build an interface circuit between the printer port and the laser drive. I have made a sketch for you.

    T_n_k's suggestion of using a darlington is simple and workable, but with a voltage drop of about 1V across the darlington transistor. That leaves your laser drive of only 6.2V.

    Therefore I've chosen to use two transistors instead which provides a much lower voltage of about 0.1~0.2V across the transistor. You can use any NPN transistor with a collector current higher than one ampere and any general purpose PNP transistor(size TO-92 is fine).

    Regarding to the connection to the parallel port, I myself would favour method #1 which requires a separate +5V supply as the current from the parallel port is limited. But I'm sure that method #2 will also work without much problem.

    With any method, current flowing in the Opto-isolator LED will turn ON the laser. So with method #2, the laser is ON when the LPT pin is HIGH. The opposite is true for method #1.

    [​IMG]
     
    cremaster likes this.
  4. DonQ

    Active Member

    May 6, 2009
    320
    11
    Or, since your output stage is opto-isolated, you don't need the level translating done by the BC557. The opto-isolation can be used to do the level translation. Just put the opto-transistor where the BC557 was (emitter toward the NPN), and delete the 22k and 4k7 resistors that used to be between the opto and BC77. Same end effect, less parts.

    To insure output saturation, you might want to reduce the 330 resistor a bit also. There is only about 15-20 mA supplied to the NPN base at this point. Several times as much would not be excessive for the opto, or the power transistor, and would saturate the power transistor, even if it is a fairly low gain.
     
  5. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    DONQ is right about the value of the 330Ω, which might be too high to saturate a low gain power NPN.

    I would lower its value to 100Ω.

    If I understand correctly, DONQ is telling you to use 50mA or more for the NPN power transistor, via the opto alone.

    I wish DONQ has consulted the 4N35 datasheet on the current transfer ratio and the collector-emitter saturation voltage before making his above comment. Perhaps he had but unfortunately have missed the important bits.(see graph below)

    To get 50mA Ic from the opto, the current in the IR diode=50mA and the manufacturer don't even show such a value on the saturation graph. It can be as high as 5V or more. It also implies that the "usual" operating current of the 4N35 opto collector current will be between 5mA~20mA. Anything more you will be in the look-out-for-yourself territory.

    Therefore I consider it would be wrong to remove the BC557 because one definitely do not have sufficient current from the parallel port pin to drive the IR LED to provide 50mA of secondary current to the power NPN.

    [​IMG]
     
  6. Dyslexicbloke

    Active Member

    Sep 4, 2010
    420
    19
    Have you considdered a small N-Channel logic level MOSFET.
    Given that you will only be turning it on and off relativly infreequently you could probably get away with a single pulup resistor on the port IO line connected to the FET gate.

    If you added a line driver ULN2003 / ULN2803 for example you could work with gate voltages as high as 30V if necessarry whilst only drawing a tiny current from the port.

    Given that level of flexibility any fet in your junk box with an low enough RDS On and high enough current handling capability would work.
    Just a thought!
    Al
     
  7. DonQ

    Active Member

    May 6, 2009
    320
    11
    Yeah, you're right. I didn't spend my time doing the details of the design work on somebody elses 'parallel port to med-power device' circuit. Probably because this has been done SO many times before.

    Instead, I brought things from my experience, where there are PLENTY of opto-couplers capable of more than 20mA output, INCLUDING the 4N35, and made a suggestion.

    From the databook:
    Code ( (Unknown Language)):
    1.  
    2. Parameter                        Symbol   Value         Units
    3. DC/Average Forward Input Current   If   100 (non-M), 60 (-M) mA
    AND the word might is there for a reason.

    And, going to your graphs...My suggestion assumes (and creates) saturated operation. When saturated, the Vce on your figure 7 will be well less than 1V, which puts you to the LEFT of the area where pulsed operation is required. Meaning, continuous operation is allowed. You need to get rid of that red dot on that graph that suggests that it means something. It doesn't since it doesn't consider the drop across the load. <1V across the opto, everything is fine.

    The only thing missing now is the horrible forward transfer characteristic of the opto-coupler chosen (Figure 6). e.g. 40mA in needed for 40mA out? Why bother? Perhaps another selection is in order?

    Other ways of insuring a saturated output from the power transistor include using an opto with a higher forward transfer ration, and/or an output transistor with a guaranteed min gain that is adequate at a lower current.

    My main point is that such a simple function does not require 8 parts, 9 nodes, 20 (or so) solder points, etc. There are many ways to do this simple function much more simply. The destination of design is to simplify, not obfuscate.
     
  8. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    But why then you are quoting input current from the data book?

    The OP mentioned he has just received four 4N35 in the first post. Isn't it nice to also tell him that these won't work in your new scheme and that he has to choose another one that works?

    Can you now suggest a suitable part number so that OP can proceed?

    Splitting hair is fine but just be sure the new scheme works so the OP won't be left in the cold.

    Regarding simplicity, why use the NPN anyway. Why not just buy a MOS relay like the following instead?

    [​IMG]
     
  9. DonQ

    Active Member

    May 6, 2009
    320
    11
    Not stocked at Digikey, 7 weeks at Mouser, and certainly not available at the school store. And, after scolding me about removing un-needed parts?! Or maybe having to spend an extra 30 cents for a more appropriate part.

    Oh, I get it... sarcasm. Helpful.

    How about the original circuit... What is the opto isolating? Two circuits with the same ground? I think not. If you aren't isolating, and not going to use the opto level shifting capabilities, using an extra transistor instead, then the opto seems to be unneeded. Oh, but since we already have it, I guess we need to use it.

    Good luck with your circuit. Hope you are able to add lots of parts. I'm out...
     
  10. cremaster

    Thread Starter New Member

    Jun 30, 2010
    19
    0
    Thank you eblc1388 and DonQ for your help. I think I will use method #2 of your original circuit diagram, because I already have many of the components needed.

    Just to clarify: When DonQ says "What is the opto isolating? Two circuits with the same ground?"

    The LPT is using the ground pin, and not the negative battery terminal, so they dont have the same ground, or am I mistaken?
     
  11. cremaster

    Thread Starter New Member

    Jun 30, 2010
    19
    0
    I have just gotten a break from school and have started this project again and will now build the optocoupling circuit eblc1388 has displayed above. But before I begin:

    In my first post I specified that I need to drive 400mA with my parallel port. Now that I look back I realize this may not actually be the case. The laser driver is supplying a steady 400mA to the IR Laser diode, however the current going into the laser driver could possibly be different. I do not know how much current is going into the laser driver from the battery. Is this a problem? I think you may have taken this into account even though I didnt specify it. Ideally this circuit is acting exactly like a switch between the 7.2V and the driver. Please let me know!
    Thank you
     
  12. cremaster

    Thread Starter New Member

    Jun 30, 2010
    19
    0
    I just checked the current from the battery to the driver, it is about 470mA, which is 70mA more than I specified at the beginning.
     
  13. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    The drive circuit will be fine for current below 1000mA.
     
  14. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    They don't have to. Ground in electronics is a reference, a point where you put the negative lead of the DVM to make measurements. Inside the SSR (solid state relay) it is isolated, no electrical signal need flow through or be reference on the two sides. This makes the SSR ideal for turned a lamp on and off with a computer.

    SSR is absolutely digital, no intensity allowed. I scanned this thread, but I don't have the time to get in depth on it.

    A good reference for printer port interfacing is Bill Bowden's website.

    http://www.bowdenshobbycircuits.info/page6.htm#PPRIC
     
  15. cremaster

    Thread Starter New Member

    Jun 30, 2010
    19
    0
    Ive just built the method 2 circuit you drew up here on a breadboard:
    http://forum.allaboutcircuits.com/attachment.php?attachmentid=22294&d=1283588799
    Ive checked the connections and tested it out several times and I believe the main body of the circuit is connected correctly.

    I have connected it to my LPT ports pin 16 which is a control output pin, non-inverted. I would have used any of the other output pins but they are being used for driving the motors.

    However, whether pin 16 is low or high has no effect on the circuit. The diode is always supplied with the correct 400mA even if pin 16 (C2) is low.

    I will clarify how I followed your design a little bit.

    LPT pin 16 --> opto pin 1
    LPT ground pin --> opto pin 2

    Is that incorrect somehow? That is the only contact my LPT port has with the circuit. I have checked the voltage between pin 16 and the ground pin, when 16 is high I get roughly the expected 5V and low 0V. The rest of the circuit I think is exactly how you defined. Please help! Thank you
     
  16. cremaster

    Thread Starter New Member

    Jun 30, 2010
    19
    0
    I just found the problem, silly mistake of mine. I connected the circuit to pin 15 and not 16! Pin 15 is of course an inverted status pin. Even though I was sending out zeros to the entire parallel port, pin 15 was remaining high and thus the circuit constantly activated. Thank you for your kind help again. Goodbye.
     
  17. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    Good news. Is the circuit working properly as you wanted it to?

    You can end this interesting thread by showing us a picture of the laser in action.
     
Loading...