Using an Optocoupler as a switching device

Discussion in 'The Projects Forum' started by rapseez, Aug 2, 2009.

  1. rapseez

    Thread Starter Member

    Aug 2, 2009
    11
    0
    Hi everyone,

    I am doing a project where I need to use an optocoupler as a switching device. I ll need to input a 5 V pulse that will close the circuit and output 24 VDC onto a terminal of a certain device. A 0 V will open the circuit.

    I am planning to use HCPL-3020 0.2A output current gate drive optocoupler. This is the first time I am dealing with an optocoupler so bear with me if I ask too many stupid questions.:)

    I ll be sending 5 V pulses from a DAQ (data acquisition) device. The idea is to control a frequency controller that requires 24V DC, max. 140mA to activate. I want too be able to use the DAQ along with the optocoupler to switch this Freq. controller ON and OFF.

    Q.1 Is the above mentioned optocoupler suited for this ?

    Q.2 Any help regarding a basic circuitry to get me started will be greatly appreciated.

    I know I am asking a lot but my project depends on this bit of information. I am a computer engineer and have very limited knowledge about electronics.

    Cheers,

    rapseez
     
  2. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    Not really.

    The voltage drop Vo is too much for your application. One would need to add additional component to it like transistor or P-Ch MOSFET etc..to turn it into a good switch.

    What you are after is a solid state relay. You can google "MOSFET relay" and get a lot of selections regarding physical size and rating.

    Something like the following:

    [​IMG]
     
  3. rapseez

    Thread Starter Member

    Aug 2, 2009
    11
    0
    Thanks for the suggestion.

    Just to let y'all know that this is what I intend to do. The DAQ device produces digital output HIGH/LOW pulses that is used to switch (relay as the switching device) the 24VDC external power supply ON/OFF. This 24VDC is vital for the controller to activate its digital inputs like start, stop etc etc. Hope I made that a bit clearer in comparison to my starting post. :)

    Will I need anything else in addition with the relay or is it ok just by itself and what sort of specs am I looking for in a relay ? The above optocoupler was suggested by a mate of mine as I had no idea what I was looking for. I think a relay sounds better though as I want to go with something that is less complicated.

    DAQ device specs are attached.

    As mentioned earlier, supply to digital inputs of the controller are 24 V DC, max. 140 mA.

    Cheers,

    A lost individual. :(
     
  4. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    You might need extra circuitry.

    It is not absolutely clear from the data you have posted whether the DAQ output can provide sufficient current to drive the MOSFET relay.

    You could ask the manufacturer or someone familiar with the device if the DAQ output can source current of 10mA to drive an external load or not.

    Without this piece of information, you will need to use an additional NPN transistor to drive the relay because you want +24V to come ON with +5V DAQ pulse.

    I have drawn up such a circuit for you.

    The relay requirement are max. voltage > 50V, max. current > 200mA and the effective ON resistance during turn ON. In the example I quoted previously, the values are 60V, 500mA and 1Ω typical at 500mA.

    If the typical resistance is too high a value, voltage would drop across the relay and you will get less than 24V to the frequency controller.

    If you put in your physical location, other members can advise you on what parts to get in local shops as it might take time to obtain parts from other countries.

    [​IMG]
     
  5. rapseez

    Thread Starter Member

    Aug 2, 2009
    11
    0
    Thanks a lot mate for all your help. I cannot begin to thank you enough.

    I ll get back to you on how much current the DAQ can source. I am pretty sure it sources about 10 mA as I remember putting a multimeter across it and getting around 10mA; I ll check again and let you know soon enough. The datasheet does say the following: -

    Power available at I/O connector
    +5 V output (200 mA maximum) ......... +5 V typical, +4.85 V minimum.

    I am from Australia and do I start a separate thread for seeking help from others regarding the component I need ?

    Cheers.

    EDIT: I found a possible MOSFET relay and I would appreciate it if you could check it for me. If you approve, I ll place an order for this asap.
     
    Last edited: Aug 3, 2009
  6. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    That would mean a short circuited loading. You will get more meaningful result if you places a 470Ω from DAQ to 0V and measures the voltage across this 470Ω. The 470Ω simulates a 10mA loading at 5V.

    If you get 3.5V or higher under this condition, you can drive the relay directly and do away with the NPN transistor I used in the above circuit.

    The relay you have located suits the circuit requirement but there are issues you need to confirm before ordering:

    1. a choice between ASSR-1218 or ASSR-1219. The 1219 drops less voltage.

    2. circuit connection is slightly different with 1218 or 1219-connection 'B'.

    3. physical size of part package. The ASSR-1218 don't come in usual DIP package. check for their physical dimension in the datasheet.
     
  7. rapseez

    Thread Starter Member

    Aug 2, 2009
    11
    0
    Thanks for that. I reckon I ll go with ASSR 1219 then. Just a quick question in relation with the ASSR 1219 schematics , why are there two different schematics ? Does it matter which one I use ?

    I will try the current test with my DAQ and post the results here.

    If I get this relay working, I am sending you a case of beer. :)
     
  8. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    The MOSFET relay is designed for AC usage. The two internal MOSFET switches are in effect put into series, one for each current polarity. That's what connection 'A' is for.

    For DC usage, there is only current in one direction. User can then join together pin#4 & 6 (as in connection 'B') to effectively has two MOSFET switches in parallel to reduce the ON resistance to half of that for AC usage.

    Lower ON resistance means lower voltage drop across the relay, i.e. more closely to the 24V DC for your frequency controller.
     
  9. rapseez

    Thread Starter Member

    Aug 2, 2009
    11
    0
    Couldnt place order for ASSR 1219 as it wasnt available so I placed order for ASSR 1218 instead. Hope its good to work as well ?
     
  10. rapseez

    Thread Starter Member

    Aug 2, 2009
    11
    0
    Hi eblc138,

    I tried doing the current test that you mentioned. With my DAQ, there are several terminals that can be configured as digital outputs and in addition to that there is also a power source terminal - 5V upto 200mA.

    When I use the built in power source with a 470Ω resitor, there is very little voltage drop across the resistor and I get around 5 V which is almost same as when there is no resistor but when I measure the current across it with resistor in place, I get 3.5 mA. Calculation would show that there is then a 1.7 V drop and effective V is 3.3 V. Where am I going wrong ?????

    Incase of when I use a digital output I only get about .45 Volts. This is strange as without any resistor I get 5 Volts across the terminals but with the resistor in, there is a massive drop. This is simple electronics and this is doing my head in ? Also, will the transistor in your diagram fix this issue somehow ? For my application I will be using the Digital output and not the power source.
     
    Last edited: Aug 5, 2009
  11. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    You have lost me there. One cannot measure the current "across" a component, only voltage. To measure current, the meter has to be in series with the component. Or one can measure the voltage drop across the component and use Ohm's law to work out the current.

    If you have tested the circuit as I shown below, then the simple reason is that the digital output cannot source the required current so there is a large voltage drop. That would be the purpose we do the test in the first place, to find out if the digital output can source the required current needed to turn on a relay. So it looks like it can't.

    [​IMG]

    Yes, it will. The transistor will take only about 0.5mA base current from the digital output so you will be fine.

    If you wants to be 100% sure, repeats the same voltage measurement but this time uses a 10KΩ resistor instead of the 470Ω. If you gets a voltage of 2V or higher, the NPN transistor will work correctly.
     
  12. rapseez

    Thread Starter Member

    Aug 2, 2009
    11
    0
    Thanks for getting back to me eblc1388.

    Well I checked the current DAQ today and its only sourcing about .36 mA which is very low.

    I am waiting for the MOSFET relay to still arrive so I was playing around with the octocoupler HCPL 3020 trying to get the LED working. Apparently it wasnt working because the DAQ isnt producing enough current. I had based my calculations assuming the DAQ was atleast producing 10mA.

    You said that the transistor will only take 0.5.mA base current and my DAQ isnt producing that much. The datasheet clearly says that the supply produces 5V , max 200mA whereas I am only seeing 0.36mA. ??????

    Anyway heres to hoping the MOSFET arrives next week and I can finally use the ckt. diagram you've provided to get things working.
     
  13. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    Then you should definitely perform the output voltage load test mentioned above using a 10K resistor. If that don't work, I'm afraid you have to modified the circuit to use a small MOSFET transistor to drive the MOSFET relay instead. We'll decide after you have the result of the voltage test.

    If you provide more details of the DAQ device you are using like part number, pdf documentation or manufacturer weblink, then there might be users here familiar with those devices which can offer you more assistance.
     
  14. rapseez

    Thread Starter Member

    Aug 2, 2009
    11
    0
    Yes I ll try the voltage test you mentioned soon and get back to you on this.

    I was playing around with the optocoupler to get its LED working. The HCPL 3020 need somewhere between 7mA to 12mA to function properly and if the DAQ isnt even sourcing that much current then looks like my project is in serious danger.
     
  15. rapseez

    Thread Starter Member

    Aug 2, 2009
    11
    0
    I got this from that DAQ datasheet: -

    Source/Sink Information
    The default configuration of the NI USB-6008/6009 DIO ports is open collector, allowing 5 V operation, with an onboard 4.7 kΩ pull-up resistor. An external user-provided pull-up resistor can be added to increase the source current drive up to a 8.5 mA limit per line as shown in the figure below.

    The NI USB-6009 ports can also be configured as active drive using the NI-DAQmx API, allowing 3.3 V operation with a source/sink current limit of ±8.5 mA. [Ignore this for the time being]

    Q. What is this load RL in the image attached according to my setup ? Do I need to have a load attached because as far as I know there isnt any for my setup ?
     
    Last edited: Aug 9, 2009
  16. eblc1388

    Senior Member

    Nov 28, 2008
    1,542
    102
    Whatever you connects to the output is a "load" to the circuit. If you wants to drive something, that presents a load to the circuit. RL is the manufacturer's way of showing that on a datasheet.

    If you drive a 330Ω+HCPL3020 directly, that's a load of some 330Ω impedance.

    The NPN transistor amplifier circuit I shown earlier is also a load to the circuit, of some 10KΩ impedance.

    No. You don't need to add extra load.

    Anything connected to the output is already a load. Even measuring the voltage using a meter presents a load, albeit a tiny tiny one.
     
  17. rapseez

    Thread Starter Member

    Aug 2, 2009
    11
    0
    hi eblc1388,

    I tried the voltage test by placing a 10KΩ resistor in between the Digital output of the DAQ and GND and I got 3.5 V across it.

    But when I place it between the the DAQ's internal voltage supply then there is no drop.

    Hopefully this information helps somehow.
     
  18. rapseez

    Thread Starter Member

    Aug 2, 2009
    11
    0
    Ok I seem to have got the LED part working. Thanks eblc1388 for your help.
     
Loading...